This makes it possible to set store type to be SQL and ensure that the operator creates only a single instance at a time for the specified cluster. In order to pass the credentials to the database, a secret has to be used and be mounted as part of the NATS Streaming container that will be connecting to the DB:
---
apiVersion: "streaming.nats.io/v1alpha1"
kind: "NatsStreamingCluster"
metadata:
name: "example-stan-db"
spec:
natsSvc: "example-nats"
# Explicitly set that the managed NATS Streaming instance
# will be using an SQL storage, to ensure that only a single
# instance is available.
store: SQL
# In order to use DB store support, it is needed to include
# the credentials as a secret on a mounted file.
configFile: "/etc/stan/config/secret.conf"
# Define Pod Spec
template:
spec:
volumes:
- name: stan-secret
secret:
secretName: stan-secret
containers:
- name: nats-streaming
volumeMounts:
- mountPath: /etc/stan/config
name: stan-secret
readOnly: true
The secret configuration file should be in regular NATS Streaming config format:
This makes it possible to set store type to be SQL and ensure that the operator creates only a single instance at a time for the specified cluster. In order to pass the credentials to the database, a secret has to be used and be mounted as part of the NATS Streaming container that will be connecting to the DB:
The secret configuration file should be in regular NATS Streaming config format:
Fixes #10