Skip to content

Commit 1ca432f

Browse files
nammnfealebenpae
authored andcommitted
fix helm chart ordering and related var naming (#4143)
# Summary - removed the `s` from installClusterRole (we only install one) - fixed a bug in the ordering of clusterRole vs clusterRoleBinding ## Proof of Work ``` (venv) ~/projects/ops-manager-kubernetes git:[master] helm template operator helm_chart --set operator.telemetry.installClusterRole=false | rg clusterVersionDetection -C 2
1 parent 100f88c commit 1ca432f

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

config/rbac/operator-roles.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
# Source: enterprise-operator/templates/operator-roles.yaml
3-
---
43
# Additional ClusterRole for clusterVersionDetection
54
kind: ClusterRole
65
apiVersion: rbac.authorization.k8s.io/v1
@@ -29,6 +28,7 @@ rules:
2928
- list
3029
---
3130
# Source: enterprise-operator/templates/operator-roles.yaml
31+
---
3232
# ClusterRoleBinding for clusterVersionDetection
3333
kind: ClusterRoleBinding
3434
apiVersion: rbac.authorization.k8s.io/v1

helm_chart/templates/operator-roles.yaml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,23 @@ subjects:
183183
{{- $telemetry := default dict .Values.operator.telemetry }}
184184

185185
{{/* We can't use default here, as 0, false and nil as determined as unset and thus set the default value */}}
186-
{{- $telemetryEnabled := $telemetry.enabled }}
187-
{{- $installClusterRoles := $telemetry.installClusterRoles }}
188-
189186
{{- if ne $telemetry.enabled false }}
190-
{{- if ne $telemetry.installClusterRoles false}}
187+
{{- if ne $telemetry.installClusterRole false}}
188+
---
189+
# ClusterRoleBinding for clusterVersionDetection
190+
kind: ClusterRoleBinding
191+
apiVersion: rbac.authorization.k8s.io/v1
192+
metadata:
193+
name: {{ .Values.operator.name }}-{{ include "mongodb-enterprise-operator.namespace" . }}-cluster-telemetry-binding
194+
roleRef:
195+
apiGroup: rbac.authorization.k8s.io
196+
kind: ClusterRole
197+
name: {{ $clusterRoleName }}
198+
subjects:
199+
- kind: ServiceAccount
200+
name: {{ .Values.operator.name }}
201+
namespace: {{ include "mongodb-enterprise-operator.namespace" . }}
202+
{{- end }}
191203
---
192204
# Additional ClusterRole for clusterVersionDetection
193205
kind: ClusterRole
@@ -216,18 +228,3 @@ rules:
216228
verbs:
217229
- list
218230
{{- end}}
219-
---
220-
# ClusterRoleBinding for clusterVersionDetection
221-
kind: ClusterRoleBinding
222-
apiVersion: rbac.authorization.k8s.io/v1
223-
metadata:
224-
name: {{ .Values.operator.name }}-{{ include "mongodb-enterprise-operator.namespace" . }}-cluster-telemetry-binding
225-
roleRef:
226-
apiGroup: rbac.authorization.k8s.io
227-
kind: ClusterRole
228-
name: {{ $clusterRoleName }}
229-
subjects:
230-
- kind: ServiceAccount
231-
name: {{ .Values.operator.name }}
232-
namespace: {{ include "mongodb-enterprise-operator.namespace" . }}
233-
{{- end }}

0 commit comments

Comments
 (0)