apiVersion: apps/v1
kind: Deployment
metadata:
  name: customers
  labels:
    app: spring-petclinic
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: spring-petclinic
      tier: customers
  template:
    metadata:
      labels:
        app: spring-petclinic
        tier: customers
    spec:
      containers:
        - image: leezhang/spring-petclinic-customers-service:latest
          imagePullPolicy: Always
          name: customers
          ports:
            - containerPort: 8080
          env:
          - name: MYSQL_HOSTINFO
            valueFrom:
              configMapKeyRef:
                name: mysql-config
                key: hostinfo
          - name: MYSQL_USERNAME
            valueFrom:
              secretKeyRef:
                name: mysql-credential
                key: username
          - name: MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-credential
                key: password
          - name: spring.profiles.active
            value: mysql
