apiVersion: apps/v1
kind: Deployment
metadata:
  name: controller-manager
  namespace: system
  labels:
    control-plane: capz-controller-manager
    aadpodidbinding: capz-controller-aadpodidentity-selector
spec:
  selector:
    matchLabels:
      control-plane: capz-controller-manager
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: capz-controller-manager
        aadpodidbinding: capz-controller-aadpodidentity-selector
      annotations:
        kubectl.kubernetes.io/default-logs-container: manager
    spec:
      containers:
        - args:
            - --leader-elect
            - "--metrics-bind-addr=localhost:8080"
            - "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKS=${EXP_AKS:=false}"
            - "--v=0"
          image: controller:latest
          imagePullPolicy: Always
          name: manager
          ports:
            - containerPort: 9440
              name: healthz
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /readyz
              port: healthz
            initialDelaySeconds: 10
            periodSeconds: 10  
          livenessProbe:
            httpGet:
              path: /healthz
              port: healthz
            initialDelaySeconds: 10
            periodSeconds: 10
          env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace      
      terminationGracePeriodSeconds: 10
      serviceAccountName: manager
