kind: Deployment
apiVersion: apps/v1
metadata:
  name: {{ .ClusterManagerName }}-registration-controller
  namespace: {{ .ClusterManagerNamespace }}
  labels:
    app: clustermanager-controller
spec:
  replicas: 3
  selector:
    matchLabels:
      app: clustermanager-registration-controller
  template:
    metadata:
      labels:
        app: clustermanager-registration-controller
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 70
            podAffinityTerm:
              topologyKey: failure-domain.beta.kubernetes.io/zone
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - clustermanager-registration-controller
          - weight: 30
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - clustermanager-registration-controller
      serviceAccountName: {{ .ClusterManagerName }}-registration-controller-sa
      containers:
      - name: hub-registration-controller
        image: {{ .RegistrationImage }}
        imagePullPolicy: IfNotPresent
        args:
          - "/registration"
          - "controller"
        livenessProbe:
          httpGet:
            path: /healthz
            scheme: HTTPS
            port: 8443
          initialDelaySeconds: 2
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /healthz
            scheme: HTTPS
            port: 8443
          initialDelaySeconds: 2
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
