Skip to content

Commit 5b4565e

Browse files
authored
Default watchNamespace to release namespace (#501)
Issue aws-controllers-k8s/community#2006 This patch default the `watchNamespace` to the release namespace if not provided. When a helm chart is installed users can set two parameters to define the isntallation mode: `installScope`, `watchNamespace`. The latter is only actionable when `installScope` is set to `namespace`. This patch defaults the `watchNamespace` to the helm release namespace if the user doesn't provide any. Signed-off-by: Amine Hilaly <[email protected]> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 5f0e408 commit 5b4565e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

templates/helm/templates/cluster-role-binding.yaml.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ subjects:
1111
- kind: ServiceAccount
1212
name: {{ "{{ include \"service-account.name\" . }}" }}
1313
namespace: {{ "{{ .Release.Namespace }}" }}
14-
{{ "{{ else if .Values.watchNamespace }}" }}
15-
{{ "{{ $namespaces := split \",\" .Values.watchNamespace }}" }}
14+
{{ "{{ else if eq .Values.installScope \"namespace\" }}" }}
15+
{{ "{{ $wn := include \"watch-namespace\" . }}" }}
16+
{{ "{{ $namespaces := split \",\" $wn }}" }}
1617
{{ "{{ $fullname := include \"app.fullname\" . }}" }}
1718
{{ "{{ $releaseNamespace := .Release.Namespace }}" }}
1819
{{ "{{ $serviceAccountName := include \"service-account.name\" . }}" }}

templates/helm/templates/cluster-role-controller.yaml.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ metadata:
1010
{{ "{{ $key }}: {{ $value | quote }}" }}
1111
{{ "{{- end }}" }}
1212
{{ "{{- $rules }}" }}
13-
{{ "{{ else if .Values.watchNamespace }}" }}
14-
{{ "{{ $namespaces := split \",\" .Values.watchNamespace }}" }}
13+
{{ "{{ else if eq .Values.installScope \"namespace\" }}" }}
14+
{{ "{{ $wn := include \"watch-namespace\" . }}" }}
15+
{{ "{{ $namespaces := split \",\" $wn }}" }}
1516
{{ "{{ range $namespaces }}" }}
1617
---
1718
apiVersion: rbac.authorization.k8s.io/v1

0 commit comments

Comments
 (0)