apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: auth-data-stateful
  namespace: repoflow-blog-namespace
  labels:
    moduleid: microservice-auth-data
    version: 1.70.10-master
spec:
  serviceName: auth-data-service
  selector:
    matchLabels:
      app: auth-data-stateful
  replicas: 1
  template:
    metadata:
      labels:
        moduleid: microservice-auth-realm
        version: 1.70.4-master
        app: auth-data-stateful
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        -
          name: data
          image: 'bitnami/mongodb:4.0.12'
          ports:
            -
              containerPort: 27017
          volumeMounts:
            -
              name: data
              mountPath: /bitnami
          env:
            -
              name: MONGODB_DATABASE
              value: accounts
            -
              name: MONGODB_USERNAME
              valueFrom:
                secretKeyRef:
                  name: auth-data-secret
                  key: user
            -
              name: MONGODB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: auth-data-secret
                  key: user_password
            -
              name: MONGODB_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: auth-data-secret
                  key: root_password
      volumes:
        -
          name: data
          persistentVolumeClaim:
            claimName: auth-data-volume-claim
