apiVersion: apps/v1
kind: Deployment
metadata:
  name: productms-deploy-v2
  namespace: shoppingportal
spec:
  replicas: 1
  selector:
    matchLabels:
      name: productms
      zone: prod
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        name: productms
        version: v2
        release: stable
        tier: fe
        zone: prod
        managed-by: m2
    spec:
      containers:
        - name: productms-ctr
          image: metamagicglobal/productms
          imagePullPolicy: Always
          ports:
          - containerPort: 8082
          resources:
            requests:
              cpu: "200m"
          livenessProbe:
            httpGet:
              path: /productms/check/live
              port: 8082
            initialDelaySeconds: 15
            periodSeconds: 15          
          env:
          - name: PRODUCTMS_DB_CONNECTION_URL
            valueFrom:
              secretKeyRef: 
                name: productmssecret
                key: mysqlconnectionurl
          - name: PRODUCTMS_DB_USER
            valueFrom:
              secretKeyRef: 
                name: productmssecret
                key: mysqluser
          - name: PRODUCTMS_DB_PASSWORD
            valueFrom:
              secretKeyRef: 
                name: productmssecret
                key: mysqlpassword
          - name: PRODUCTMS_VERSION
            value: Product MS Version 2.0
