################################################################################
# WARNING: This MongoDB deployment is not suitable for production as the data is
# not persistently stored and will go away every time the Pod restarts. Consider
# using a Helm chart that provisions a StatefulSet instead of Deployment.
################################################################################
kind: Deployment
apiVersion: apps/v1
metadata:
  name: go-guestbook-mongodb
  labels:
    app: guestbook
    tier: db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: guestbook
      tier: db
  template:
    metadata:
      labels:
        app: guestbook
        tier: db
    spec:
      containers:
        - name: mongo
          image: registry.redhat.io/rhscl/mongodb-36-rhel7
          env:
          - name: MONGODB_ADMIN_PASSWORD
            valueFrom:
              secretKeyRef:
                name: database-secret-config
                key: admin-password
          - name: MONGODB_DATABASE
            valueFrom:
              secretKeyRef:
                name: database-secret-config
                key: dbname
          - name: MONGODB_USER
            valueFrom:
              secretKeyRef:
                name: database-secret-config
                key: username
          - name: MONGODB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: database-secret-config
                key: password
          ports:
            - containerPort: 27017
          volumeMounts:
          - name: mongodb-data
            mountPath: /var/lib/mongodb/data
      volumes:
        - name: mongodb-data
          emptyDir: {}
