apiVersion: apps/v1
kind: Deployment
metadata:
  name: connection-manager-api
  labels:
    app.kubernetes.io/name: connection-manager-api
spec:
  selector:
    matchLabels: &labels
      app.kubernetes.io/name: connection-manager-api
  template:
    metadata:
      labels: *labels
    spec:
      hostname: connection-manager-api
      restartPolicy: Always
      containers:
      - name: connection-manager-api
        image: ghcr.io/modusbox/connection-manager-api:1.7.8
        ports:
        - containerPort: 3001
        imagePullPolicy: IfNotPresent
        env:
        - name: DATABASE_HOST
          valueFrom:
            configMapKeyRef:
              name: mysql
              key: MYSQL_SERVICE
        - name: DATABASE_USER
          valueFrom:
            configMapKeyRef:
              name: mysql
              key: MYSQL_USER
        - name: DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql
              key: MYSQL_PASSWORD
        - name: DATABASE_SCHEMA
          valueFrom:
            configMapKeyRef:
              name: mysql
              key: MYSQL_DATABASE
        - name: DATABASE_PORT
          value: "3306"
        envFrom:
        - configMapRef:
            name: connection-manager-api
        volumeMounts:
        - name: secret-volume
          readOnly: true
          mountPath: "/mcm_secrets"
      volumes:
      - name: secret-volume
        secret:
          secretName: connection-manager-api-api-secret
