apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
  labels:
    control-plane: controller-manager
spec:
  selector:
    matchLabels:
      control-plane: controller-manager
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: controller-manager
    spec:
      securityContext:
        runAsNonRoot: true
      containers:
        - command:
            - /pod-security-admission
          args:
            - --cert-dir=/certs
            - --config-path=/etc/pod-security-admission/config.yaml
          image: pod-security-admission:latest
          imagePullPolicy: IfNotPresent
          name: manager
          securityContext:
            allowPrivilegeEscalation: false
          ports:
            - name: metrics
              containerPort: 8080
            - name: health
              containerPort: 8081
            - name: webhook
              containerPort: 9443
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8081
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8081
            initialDelaySeconds: 5
            periodSeconds: 10
          lifecycle:
            preStop:
              exec:
                command: [ "sleep", "5" ]
          resources:
            requests:
              cpu: 100m
              memory: 20Mi
          volumeMounts:
            - name: config
              mountPath: /etc/pod-security-admission
      terminationGracePeriodSeconds: 10
      volumes:
        - name: config
          configMap:
            name: pod-security-admission-config
