apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller
  labels:
    app.kubernetes.io/component: execution-controller
spec:
  selector:
    matchLabels:
      app: execution-controller
  replicas: 1
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: controller
      labels:
        app: execution-controller
        app.kubernetes.io/component: execution-controller
    spec:
      securityContext:
        runAsNonRoot: true
      serviceAccountName: controller
      terminationGracePeriodSeconds: 10
      containers:
        - name: controller
          command:
            - /execution-controller
          args:
            - "--config=/etc/controller/config.yaml"
            - "-v=2"
          image: execution-controller:latest
          imagePullPolicy: Always
          securityContext:
            allowPrivilegeEscalation: false
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10
          volumeMounts:
            - name: controller-config
              mountPath: /etc/controller/config.yaml
              subPath: config.yaml
          resources:
            limits:
              cpu: 4
              memory: 2Gi
            requests:
              cpu: 500m
              memory: 512Mi
        - name: kube-rbac-proxy
          image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
          args:
            - "--secure-listen-address=0.0.0.0:8443"
            - "--upstream=http://127.0.0.1:8080/"
            - "--logtostderr=true"
            - "--v=0"
          ports:
            - containerPort: 8443
              protocol: TCP
              name: https
          resources:
            limits:
              cpu: 500m
              memory: 128Mi
            requests:
              cpu: 5m
              memory: 64Mi
      volumes:
        - name: controller-config
          configMap:
            name: controller-config
