apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  selector:
    matchLabels:
      app: app
      tier: backend
  replicas: 3
  template:
    metadata:
      labels:
        app: app
        tier: backend
    spec:
      shareProcessNamespace: true
      volumes:
      - name: secret-volume
        secret:
          secretName: app-secrets
      initContainers:
      - name: wait-for-phase2
        image: confdup:v7.3
        command:
        - sh
        - "-c"
        - "until confdup -a confd 2> /dev/null; do echo \"Waiting for confd to reach phase2...\"; sleep 2; done; echo done"
        env:
        - name: CONFD_IPC_ACCESS_FILE
          value: "/app/secrets/access.txt"
        volumeMounts:
        - name: secret-volume
          mountPath: "/app/secrets"
          readOnly: true
      containers:
      - name: app
        image: modifications-subscriber:v7.3
        env:
        - name: CONFD_IPC_ACCESS_FILE
          value: "/app/secrets/access.txt"
        args:
        - "modifications-subscriber"
        - "-a"
        - "confd"
        volumeMounts:
        - name: secret-volume
          mountPath: "/app/secrets"
          readOnly: true
