{% if namespace != 'openshift-operators' %}
apiVersion: v1
kind: Namespace
metadata:
  labels:
    openshift.io/cluster-monitoring: "true"
  name: {{ namespace }}
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: {{ name }}-operatorgroup
  namespace: {{ namespace }}
spec:
  targetNamespaces:
  - {{ namespace }}
---
{% endif %}
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: {{ name }}
  namespace: {{ namespace }}
spec:
  channel: "{{ channel }}"
  name: {{ name }}
  source: {{ catalog | default('redhat-operators') }}
  sourceNamespace: openshift-marketplace
{% if csv is defined %}
  startingCSV: {{ csv }}
{% endif %}
{% if installplan is defined %}
  installPlanApproval: {{ installplan }}
{% endif %}
{% if name == 'sriov-network-operator' and devmode is defined and devmode %}
  config:
   env:
   - name: "DEV_MODE"
     value: {{ devmode }}
{% endif %}
