apiVersion: apps/v1
kind: Deployment
metadata:
  name: workflow-controller
spec:
  selector:
    matchLabels:
      app: workflow-controller
  template:
    metadata:
      labels:
        app: workflow-controller
    spec:
      serviceAccountName: argo
      containers:
        - name: workflow-controller
          image: argoproj/workflow-controller:v2.12.11
          command:
            - workflow-controller
          args:
            - --configmap
            - workflow-controller-configmap
            - --executor-image
            - argoproj/argoexec:v2.12.11
          ports:
            - name: metrics
              containerPort: 9090
          # Periodically check we are listening on the metrics port
          # causing a restart if it is not OK.
          # This takes advantage of the fact that if the metrics service has died,
          # then the controller has died.
          # In testing, it appears to take 60-90s from failure to restart.
          livenessProbe:
            httpGet:
              port: metrics
              path: /metrics
            initialDelaySeconds: 30
            periodSeconds: 30
      securityContext:
        runAsNonRoot: true
      nodeSelector:
        kubernetes.io/os: linux
