apiVersion: apps/v1
kind: Deployment
metadata:
  name: manager
  namespace: system
  labels:
    control-plane: manager
spec:
  selector:
    matchLabels:
      control-plane: manager
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: manager
    spec:
      serviceAccountName: sa
      containers:
      - image: quay.io/kubecarrier/ferry:latest
        args:
        - "--service-cluster-name=$(SERVICE_CLUSTER)"
        - "--service-cluster-kubeconfig=/kubeconfig/kubeconfig"
        - "--provider-namespace=$(KUBERNETES_NAMESPACE)"
        - "-v=$(LOG_LEVEL)"
        name: manager
        env:
          # Inserted during manifest generation in resouce
          #- name: SERVICE_CLUSTER
          #  value: "__SERVICE_CLUSTER_NAME__"
          - name: KUBERNETES_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        volumeMounts:
          - mountPath: /kubeconfig
            name: kubeconfig
        resources:
          limits:
            cpu: 100m
            memory: 30Mi
          requests:
            cpu: 100m
            memory: 20Mi
      terminationGracePeriodSeconds: 10
      volumes:
        - name: kubeconfig
          secret:
            optional: false
            # Inserted during manifest generation in resouce
            secretName: "__KUBECONFIG_SECRET_NAME__"
            items:
              - key: "kubeconfig"
                path: "kubeconfig"
