apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    control-plane: controller-manager
  name: '{{ .Release.Name }}-controller-manager'
  namespace: '{{ .Release.Namespace }}'
spec:
  replicas: 1
  selector:
    matchLabels:
      control-plane: controller-manager
  template:
    metadata:
      labels:
        control-plane: controller-manager
    spec:
      containers:
      - args:
        - --enable-leader-election
        command:
        - /manager
        image: '{{ .Values.image.repository }}:{{ .Values.image.tag }}'
        name: manager
        ports:
        - containerPort: 9443
          name: webhook-server
          protocol: TCP
        resources:
          limits:
            cpu: '{{ .Values.resources.limits.cpu }}'
            memory: '{{ .Values.resources.limits.memory }}'
          requests:
            cpu: '{{ .Values.resources.requests.cpu }}'
            memory: '{{ .Values.resources.requests.memory }}'
        volumeMounts:
        - mountPath: /tmp/k8s-webhook-server/serving-certs
          name: cert
          readOnly: true
      serviceAccountName: '{{ .Release.Name }}-controller-manager'
      terminationGracePeriodSeconds: 10
      volumes:
      - name: cert
        secret:
          defaultMode: 420
          secretName: '{{ .Release.Name }}-webhook-server-cert'
