Skip to content

Commit 06bf132

Browse files
authoredMay 3, 2023
Update template to support watch namespace (#440)
As the controller runtime supports watching namespaces, we would need to add a support to watch namespaces other than where the controller is deployed. This is a common use case for multi-tenant K8s environments. This PR introduces a `watchNamespace` flag which lets user define the namespaces to be watched by the controller. If left blank, it would take the release namespace. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 6657565 commit 06bf132

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
 

‎templates/helm/templates/_helpers.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If release name contains chart name it will be used as a full name.
3333

3434
{{- define "watch-namespace" -}}
3535
{{- if eq .Values.installScope "namespace" -}}
36-
{{- .Release.Namespace -}}
36+
{{ .Values.watchNamespace | default .Release.Namespace }}
3737
{{- end -}}
3838
{{- end -}}
3939

‎templates/helm/values.schema.json

+3
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@
196196
"type": "string",
197197
"enum": ["cluster", "namespace"]
198198
},
199+
"watchNamespace": {
200+
"type": "string"
201+
},
199202
"resourceTags": {
200203
"type": "array",
201204
"items": {

‎templates/helm/values.yaml.tpl

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ log:
7272
# cluster wide.
7373
installScope: cluster
7474

75+
# Set the value of the "namespace" to be watched by the controller
76+
# This value is only used when the `installScope` is set to "namespace". If left empty, the default value is the release namespace for the chart.
77+
watchNamespace: ""
78+
7579
resourceTags:
7680
# Configures the ACK service controller to always set key/value pairs tags on
7781
# resources that it manages.

0 commit comments

Comments
 (0)
Please sign in to comment.