apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: mongo
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mongo
    spec:
      containers:
      - image: mongo:latest
        name: mongo
        ports:
        - containerPort: 27017
        env:
        - name: MONGO_INITDB_ROOT_PASSWORD
          valueFrom:
            configMapKeyRef:
              name: dhbw-seminarbeit-db-env
              key: MONGODB_ROOT_PASSWORD
        - name: MONGO_INITDB_ROOT_USERNAME
          valueFrom:
            configMapKeyRef:
              name: dhbw-seminarbeit-db-env
              key: MONGODB_ROOT_USERNAME
        - name: MONGO_PASSWORD
          valueFrom:
            configMapKeyRef:
              name: dhbw-seminarbeit-db-env
              key: MONGODB_PASSWORD
        - name: MONGO_USERNAME
          valueFrom:
            configMapKeyRef:
              name: dhbw-seminarbeit-db-env
              key: MONGODB_USERNAME
        volumeMounts:
        - name: mongo-initdb
          mountPath: /docker-entrypoint-initdb.d
      volumes:
      - name: mongo-initdb
        configMap:
          name: mongo-initdb
      restartPolicy: Always
      serviceAccountName: ""
