apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-express
  namespace: demo-mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-express
  template:
    metadata:
      labels:
        app: mongo-express
    spec:
      containers:
      - name: mongo-express
        image: mongo-express
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 8081
        env:
          - name:  ME_CONFIG_BASICAUTH_USERNAME
            valueFrom:
              secretKeyRef:
                name: mongo-express-credentials
                key: mongo-express-web-username
          - name:  ME_CONFIG_BASICAUTH_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mongo-express-credentials
                key: mongo-express-web-password
          - name:  ME_CONFIG_MONGODB_ADMINUSERNAME
            valueFrom:
              secretKeyRef:
                name: mongodb-credentials
                key: mongodb-root-username
          - name:  ME_CONFIG_MONGODB_ADMINPASSWORD
            valueFrom:
              secretKeyRef:
                name: mongodb-credentials
                key: mongodb-root-password
          - name:  ME_CONFIG_MONGODB_SERVER
            valueFrom:
              configMapKeyRef:
                name: mongo-express-configmap
                key: mongodb-server-url
