{{- if .Values.operator }}
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: {{ .Values.operator.name }}
  namespace: openshift-operators
spec:
  channel: {{ .Values.operator.channel }}
  installPlanApproval: {{ .Values.operator.installPlanApproval }}
  name: {{ .Values.operator.name }}
  source: {{ .Values.operator.sourceName | default "redhat-operators" | quote }}
  sourceNamespace: {{ .Values.operator.sourceNamespace | default "openshift-marketplace" | quote }}
{{- if .Values.operator.version }}
  startingCSV: {{ .Values.operator.version | quote }}
{{- end }}
  config:
    env:
    - name: DISABLE_DEFAULT_ARGOCD_INSTANCE
      value:  {{ .Values.operator.disableDefaultArgoCD | quote }}
{{- if and (.Values.namespaces) (.Values.teamInstancesAreClusterScoped) }}
    - name: ARGOCD_CLUSTER_CONFIG_NAMESPACES
      value: {{ join "," .Values.namespaces | quote }}
{{- end }}
{{- end }}
