# TODO fill in the TEMPLATE markers

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "13"
  labels:
    app: controller
  name: controller
  namespace: default
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: controller
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: controller
    spec:
      containers:
      - args:
          - --kubeconfig=/etc/gardener-secret/kubeconfig # TODO double check if file name matches
          - --apprepo-kubeconfig=/etc/apprepo-secret/apprepokubeconfig
        command:
        - ./manager
        image: eu.gcr.io/sap-gcp-k8s-wm-live/hub/controller/integration:16 # TODO double check image version
        imagePullPolicy: IfNotPresent
        ports:
          - containerPort: 8085
        name: integration
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/gardener-secret
          name: gardener
          readOnly: true
        - mountPath: /etc/apprepo-secret
          name: apprepo
          readOnly: true
        - mountPath: /usr/image-pull-secret
          name: image-pull-secret
          readOnly: true
        env:
        - name: POD_NAMESPACE # TODO this env variable should not be necessary in the future
          value: "hub"
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: gcr
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: gardener
        secret:
          secretName: gardener-kubeconfig
      - name: apprepo
        secret:
          secretName: apprepo-kubeconfig
      - name: image-pull-secret
        secret:
          secretName: hubsec-image-pull-secrets-creds
