# before applying, filled in the <managed cluster name> and <managed cluster namespace> and run the following command:
# kubectl -n multicloud-operators create secret generic appmgr-hub-kubeconfig --from-file=kubeconfig=</path/to/hub_cluster/kubeconfig> # note: the file name must be 'kubeconfig'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: multicloud-operators-subscription
  namespace: open-cluster-management-agent-addon
  labels:
    name: multicloud-operators-subscription
spec:
  replicas: 1
  selector:
    matchLabels:
      name: multicloud-operators-subscription
  template:
    metadata:
      labels:
        name: multicloud-operators-subscription
    spec:
      serviceAccountName: multicloud-operators
      volumes:
      - name: klusterlet-config
        secret:
          defaultMode: 420
          secretName: appmgr-hub-kubeconfig
      containers:
        - name: multicloud-operators-subscription
          image: quay.io/open-cluster-management/multicloud-operators-subscription:latest
          ports:
          - containerPort: 8443
          command:
          - /usr/local/bin/multicloud-operators-subscription
          - --alsologtostderr
          - --cluster-name=managed_cluster_name # cluster1
          - --cluster-namespace=managed_cluster_name # cluster1
          - --hub-cluster-configfile=/var/run/klusterlet/kubeconfig
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "multicloud-operators-subscription"
          resources:
              requests:
                cpu: 100m
                memory: 256Mi
              limits:
                cpu: 500m
                memory: 512Mi
          volumeMounts:
          - mountPath: /var/run/klusterlet
            name: klusterlet-config
