apiVersion: apps/v1
kind: Deployment
metadata:
  name: canary-patch
  labels:
    app: canary-patch
spec:
  replicas: 2
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: canary-patch
      pipecd.dev/variant: primary
  template:
    metadata:
      labels:
        app: canary-patch
        pipecd.dev/variant: primary
    spec:
      # TODO: Remove this init container once go-yaml allows using dot in the field name.
      initContainers:
      - name: prepare-envoy-config
        image: busybox:1.33.1
        command: ['sh', '-c', "cp /etc/tmp-envoy/envoy-config /etc/envoy/envoy-config.yaml"]
        volumeMounts:
        - name: envoy-configmap
          mountPath: /etc/tmp-envoy
        - name: envoy-config
          mountPath: /etc/envoy
      containers:
      - name: helloworld
        image: gcr.io/pipecd/helloworld:v0.5.0
        args:
          - server
        ports:
        - containerPort: 9085
      - name: envoy
        image: envoyproxy/envoy-alpine:v1.18.3
        imagePullPolicy: IfNotPresent
        command:
        - envoy
        args:
          - -c
          - /etc/envoy/envoy-config.yaml
        ports:
        - containerPort: 9090
        - containerPort: 9095
        volumeMounts:
        - name: envoy-config
          mountPath: /etc/envoy
          readOnly: true
      volumes:
        - name: envoy-configmap
          configMap:
            name: canary-patch-envoy-config
        - name: envoy-config
          emptyDir: {}
