nats-io / nats-streaming-operator

NATS Streaming Operator
Apache License 2.0
174 stars 44 forks source link

Allow setting storage dir for persistence #21

Closed wallyqs closed 5 years ago

wallyqs commented 5 years ago

Allows setting directory to use for the file storage, which may be backed by a persistent volume claim that can be defined in the custom pod spec via a template.

Fixes #6

---
apiVersion: "streaming.nats.io/v1alpha1"
kind: "NatsStreamingCluster"
metadata:
  name: "example-stan-pv"
spec:
  natsSvc: "example-nats-1"

  config:
    debug: true
    trace: true
    storeDir: "/pv/stan"

  # Define mounts in the Pod Spec
  template:
    spec:
      volumes:
      - name: stan-store-dir
        persistentVolumeClaim:
          claimName: streaming-pvc
      containers:
        - name: nats-streaming
          volumeMounts:
          - mountPath: /pv
            name: stan-store-dir
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: streaming-pv
  labels:
    name: streaming-pv
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 128Mi
  hostPath:
    path: /data/pv0001/
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: streaming-pvc
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 128Mi
  selector:
    matchLabels:
      name: "streaming-pv"

Signed-off-by: Waldemar Quevedo wally@synadia.com