apiVersion: apps/v1
kind: Deployment
metadata:
  name: apiclient-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      component: apiclient-label
  template:
    metadata:
      labels:
        component: apiclient-label
    spec:
      volumes:
      - name: mariadb-configmap-volume
        configMap:
          name: mariadb-configmap
      containers:
        - name: apiclient 
          image: tarof429/api-client:latest
          imagePullPolicy: Always
          volumeMounts:
            - name: mariadb-configmap-volume
              mountPath: /etc/config
          ports:
            - containerPort: 5000
          env:
            - name: MYSQL_HOST
              valueFrom:
                configMapKeyRef:
                  name: mariadb-configmap
                  key: mysqlhost
            - name: MYSQL_USER
              valueFrom:
                configMapKeyRef:
                  name: mariadb-configmap
                  key: mysqluser
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: dbsecrets
                  key: MYSQL_PASSWORD
            - name: MYSQL_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: mariadb-configmap
                  key: mysqldatabase
