Skip to content

Commit

Permalink
[olm-operator-installer] add support to target namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Bueno <49003339+tlbueno@users.noreply.github.com>
  • Loading branch information
tlbueno committed May 20, 2024
1 parent dbf3527 commit ccd9b19
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/olm-operator-installer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
13 changes: 13 additions & 0 deletions charts/olm-operator-installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ operatorGroup:
# operator group name
name: cert-manager-operator

###########################################################
# You may enable selector or targetNamespace but not both #
###########################################################

selector:
# do not set selector matchLabels if false
enabled: false
Expand All @@ -48,6 +52,15 @@ operatorGroup:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

targetNamespaces:
# do not set target namespaces if false
enabled: false
# A list of namespaces names to watch
# namespaces should be created before the operator deployment otherwise the operator
# could report errors on trying to access the namespace resources
name:
- my-example-namespaces

subscription:
# subscription name
name: cert-manager-operator-sub
Expand Down
13 changes: 13 additions & 0 deletions charts/olm-operator-installer/examples/amq-broker-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ operatorGroup:
# operator group name
name: amq-broker-operator

###########################################################
# You may enable selector or targetNamespace but not both #
###########################################################

selector:
# do not set selector matchLabels if false
enabled: true
Expand All @@ -22,6 +26,15 @@ operatorGroup:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

targetNamespaces:
# do not set target namespaces if false
enabled: false
# A list of namespaces names to watch
# namespaces should be created before the operator deployment otherwise the operator
# could report errors on trying to access the namespace resources
names:
- my-example-namespaces

subscription:
# subscription name
name: amq-broker-operator-olm-sub
Expand Down
10 changes: 8 additions & 2 deletions charts/olm-operator-installer/templates/OperatorGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ metadata:
name: {{ .Values.operatorGroup.name }}
namespace: {{ .Values.namespace.name }}
spec:
{{- if .Values.operatorGroup.selector.enabled }}
{{- if .Values.operatorGroup.selector.enabled }}
selector:
matchLabels:
{{- range .Values.operatorGroup.selector.matchLabels }}
{{ .name }}: {{ tpl .value $ }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.operatorGroup.targetNamespaces.enabled }}
targetNamespaces:
{{- range .Values.operatorGroup.targetNamespaces.names }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}

13 changes: 13 additions & 0 deletions charts/olm-operator-installer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ operatorGroup:
# operator group name
name: cert-manager-operator

###########################################################
# You may enable selector or targetNamespace but not both #
###########################################################

selector:
# do not set selector matchLabels if false
enabled: false
Expand All @@ -20,6 +24,15 @@ operatorGroup:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

targetNamespaces:
# do not set target namespaces if false
enabled: false
# A list of namespaces names to watch
# namespaces should be created before the operator deployment otherwise the operator
# could report errors on trying to access the namespace resources
names:
- my-example-namespaces

subscription:
# subscription name
name: cert-manager-operator-sub
Expand Down

0 comments on commit ccd9b19

Please sign in to comment.