---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: prow
  name: prow-controller-manager
  labels:
    app: prow-controller-manager
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: prow-controller-manager
  template:
    metadata:
      labels:
        app: prow-controller-manager
    spec:
      serviceAccountName: prow-controller-manager
      containers:
        - name: prow-controller-manager
          args:
            - --dry-run=false
            - --config-path=/etc/config/config.yaml
            - --github-token-path=/etc/github/token
            - --github-host=github.com
            - --github-endpoint=http://ghproxy
            - --github-endpoint=https://api.github.com
            - --enable-controller=plank
            - --job-config-path=/etc/job-config
          image: gcr.io/k8s-prow/prow-controller-manager:v20211229-d20cd1c87e
          env:
            # Use KUBECONFIG envvar rather than --kubeconfig flag in order to provide multiple configs to merge.
            - name: KUBECONFIG
              value: "/etc/kubeconfig/config"
          volumeMounts:
            - name: github-token
              mountPath: /etc/github
              readOnly: true
            - name: config
              mountPath: /etc/config
              readOnly: true
            - name: job-config
              mountPath: /etc/job-config
              readOnly: true
            - name: kubeconfig
              mountPath: /etc/kubeconfig
              readOnly: true
          livenessProbe: # Pod is killed if this fails 3 times.
            httpGet:
              path: /healthz
              port: 8081
            initialDelaySeconds: 10
            periodSeconds: 5
          readinessProbe: # Pod is not considered ready (for rolling deploy and request routing) if this fails 3 times.
            httpGet:
              path: /healthz/ready
              port: 8081
            initialDelaySeconds: 10
            periodSeconds: 3
      volumes:
        - name: github-token
          secret:
            secretName: github-token
        - name: job-config
          configMap:
            name: job-config
        - name: config
          configMap:
            name: config
        - name: kubeconfig
          secret:
            defaultMode: 0644
            secretName: kubeconfig
