apiVersion: apps/v1
kind: Deployment
metadata:
  name: endpoint-observability-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: endpoint-observability-operator
  template:
    metadata:
      labels:
        name: endpoint-observability-operator
    spec:
      serviceAccountName: endpoint-observability-operator-sa
      containers:
        - name: endpoint-observability-operator
          # Replace this with the built image name
          image: REPLACE_WITH_OPERATOR_IMAGE
          command:
          - endpoint-monitoring-operator
          imagePullPolicy: Always
          env:
            - name: HUB_NAMESPACE
              value: REPLACE_WITH_HUB_CLUSTER_NAMESPACE
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: SERVICE_ACCOUNT
              valueFrom:
                fieldRef:
                  fieldPath: spec.serviceAccountName
            - name: COLLECTOR_IMAGE
              value: REPLACE_WITH_METRICS_COLLECTOR_IMAGE
            - name: OPERATOR_NAME
              value: "endpoint-monitoring-operator"
            - name: HUB_KUBECONFIG
              value: "/spoke/hub-kubeconfig/kubeconfig"
          volumeMounts:
            - name: hub-kubeconfig-secret
              mountPath: "/spoke/hub-kubeconfig"
              readOnly: true
      volumes:
        - name: hub-kubeconfig-secret
          secret:
            secretName: observability-controller-hub-kubeconfig
