---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller
  namespace: system
  labels:
    control-plane: controller
spec:
  selector:
    matchLabels:
      control-plane: controller
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: controller
    spec:
      securityContext:
        runAsNonRoot: true
      volumes:
        - name: manager-cache
          emptyDir: {}
      containers:
      - command:
        - /manager
        args:
        - --leader-elect
        env:
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace        
        image: controller:latest
        name: manager
        securityContext:          
          allowPrivilegeEscalation: false
        volumeMounts:
          - name: manager-cache
            mountPath: /cache
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        resources:
          limits:
            cpu: 100m
            memory: 128Mi
          requests:
            cpu: 100m
            memory: 64Mi
      serviceAccountName: controller
      terminationGracePeriodSeconds: 10
