-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duplicate clustersrolebindings issue #10479
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{{- if .Values.rbac.create -}} | ||
{{- $root := . -}} | ||
{{- range append .Values.watchNamespaces .Release.Namespace }} | ||
{{- $watchNamespaces := .Values.watchNamespaces -}} | ||
{{- if $root.Values.watchAnyNamespace }} | ||
{{- $watchNamespaces = list -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If "watchAnyNamespace" is set to true, we will set variable watchNamespaces to empty List, and ignore the values of ".Values.watchNamespaces" Loop over new variable($watchNamespaces) instead of ".Values.watchNamespaces" |
||
{{- end }} | ||
{{- range append $watchNamespaces .Release.Namespace }} | ||
Comment on lines
+3
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we are not really Helm experts, would you mind explaining (perhaps int he PR description) what exactly does this code do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure @scholzj |
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
{{- if $root.Values.watchAnyNamespace }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{{- if .Values.rbac.create }} | ||
{{- if .Values.rbac.create -}} | ||
{{- $root := . -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, what does the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notice that we received a few empty lines in our YAML. Why? When the template engine runs, it removes the contents inside of {{ and }}, but it leaves the remaining whitespace exactly as is. YAML ascribes meaning to whitespace, so managing the whitespace becomes pretty important. Fortunately, Helm templates have a few tools to help. If it is the first line in a yaml file, I think it will not impact anything. |
||
{{- range append .Values.watchNamespaces .Release.Namespace }} | ||
{{- $watchNamespaces := .Values.watchNamespaces -}} | ||
{{- if $root.Values.watchAnyNamespace }} | ||
{{- $watchNamespaces = list -}} | ||
{{- end }} | ||
{{- range append $watchNamespaces .Release.Namespace }} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
{{- if $root.Values.watchAnyNamespace }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defined a new variable - "watchNamespaces", the default value is .Values.watchNamespaces.