apiVersion: apps/v1
kind: Deployment
metadata:
  name: creditcardservice-deployment
  labels:
    app: creditcardservice
spec:
  replicas: 3
  selector:
    matchLabels:
      app: creditcardservice
  template:
    metadata:
      labels:
        app: creditcardservice

    spec:
      containers:
        - name: creditcardservice
          image: kedikebba/creditcardservice:latest
          ports:
            - containerPort: 8080
          env:
            - name: KEY1
              valueFrom:
                configMapKeyRef:
                  name: creditcardservice-config
                  key: someKey1
            - name: NEXT_SERVICE
              valueFrom:
                configMapKeyRef:
                  name: creditcardservice-config
                  key: nextService
            - name: SERVICE_API_KEY
              valueFrom:
                secretKeyRef:
                  name: creditcardservice-secrets
                  key: service-api-key
            #MYSQL
            - name: MYSQL_HOST
              value: creditcardservice-db

            - name: MYSQL_USER
              value: root
            - name: MYSQL_PORT
              value: "8081"

            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: creditcardservice-secrets
                  key: mysql-root-password