1+ {{- $watchNamespace := list .Values.namespace }}
2+ {{- if .Values.operator.watchNamespace }}
3+ {{- $watchNamespace = regexSplit "," .Values.operator.watchNamespace -1 }}
4+ {{- end }}
5+
6+
7+ {{- range $idx, $namespace := $watchNamespace }}
8+
9+ {{- $namespaceBlock := printf "namespace: %s" $namespace }}
10+ {{- if eq $namespace "*" }}
11+ {{- $namespaceBlock = printf "namespace: %s" $.Values.namespace }}
12+ {{- end }}
113---
214apiVersion : v1
315kind : ServiceAccount
416metadata :
517 name : mongodb-enterprise-appdb
6- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
7- namespace : {{ .Values.operator.watchNamespace }}
8- {{- else }}
9- namespace : {{ .Values.namespace }}
10- {{- end }}
11- {{- if .Values.registry.imagePullSecrets}}
18+ {{ $namespaceBlock }}
19+ {{- if $.Values.registry.imagePullSecrets}}
1220imagePullSecrets :
13- - name : {{ .Values.registry.imagePullSecrets }}
21+ - name : {{ $ .Values.registry.imagePullSecrets }}
1422{{- end }}
1523
1624---
1725apiVersion : v1
1826kind : ServiceAccount
1927metadata :
2028 name : mongodb-enterprise-database-pods
21- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
22- namespace : {{ .Values.operator.watchNamespace }}
23- {{- else }}
24- namespace : {{ .Values.namespace }}
25- {{- end }}
26- {{- if .Values.registry.imagePullSecrets}}
29+ {{ $namespaceBlock }}
30+ {{- if $.Values.registry.imagePullSecrets}}
2731imagePullSecrets :
28- - name : {{ .Values.registry.imagePullSecrets }}
32+ - name : {{ $ .Values.registry.imagePullSecrets }}
2933{{- end }}
3034
3135---
3236apiVersion : v1
3337kind : ServiceAccount
3438metadata :
3539 name : mongodb-enterprise-ops-manager
36- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
37- namespace : {{ .Values.operator.watchNamespace }}
38- {{- else }}
39- namespace : {{ .Values.namespace }}
40- {{- end }}
41- {{- if .Values.registry.imagePullSecrets}}
40+ {{ $namespaceBlock }}
41+ {{- if $.Values.registry.imagePullSecrets}}
4242imagePullSecrets :
43- - name : {{ .Values.registry.imagePullSecrets }}
43+ - name : {{ $ .Values.registry.imagePullSecrets }}
4444{{- end }}
4545
4646---
4747kind : Role
4848apiVersion : rbac.authorization.k8s.io/v1
4949metadata :
5050 name : mongodb-enterprise-appdb
51- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
52- namespace : {{ .Values.operator.watchNamespace }}
53- {{- else }}
54- namespace : {{ .Values.namespace }}
55- {{- end }}
51+ {{ $namespaceBlock }}
5652rules :
5753 - apiGroups :
5854 - " "
@@ -74,20 +70,14 @@ kind: RoleBinding
7470apiVersion : rbac.authorization.k8s.io/v1
7571metadata :
7672 name : mongodb-enterprise-appdb
77- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
78- namespace : {{ .Values.operator.watchNamespace }}
79- {{- else }}
80- namespace : {{ .Values.namespace }}
81- {{- end }}
73+ {{ $namespaceBlock }}
8274roleRef :
8375 apiGroup : rbac.authorization.k8s.io
8476 kind : Role
8577 name : mongodb-enterprise-appdb
8678subjects :
8779 - kind : ServiceAccount
8880 name : mongodb-enterprise-appdb
89- {{- if not (eq (.Values.operator.watchNamespace | default "*") "*") }}
90- namespace : {{ .Values.operator.watchNamespace }}
91- {{- else }}
92- namespace : {{ .Values.namespace }}
93- {{- end }}
81+ {{ $namespaceBlock }}
82+
83+ {{- end }}
0 commit comments