Skip to content

Commit be2afb0

Browse files
committed
add unit test
1 parent 1c5f517 commit be2afb0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

helm_chart/templates/operator-roles-webhook.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11

22
{{/* This cluster role and binding is necessary to allow the operator to automatically register ValidatingWebhookConfiguration. */}}
33
{{- if and .Values.operator.webhook.registerConfiguration .Values.operator.webhook.installClusterRole }}
4-
{{- if not (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "mongodb-kubernetes-operator-mongodb-webhook") }}
4+
{{- $webhookClusterRoleName := printf "%s-%s-webhook" .Values.operator.name (include "mongodb-kubernetes-operator.namespace" .) }}
5+
{{- if not (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" $webhookClusterRoleName) }}
56
---
67
kind: ClusterRole
78
apiVersion: rbac.authorization.k8s.io/v1
89
metadata:
9-
name: {{.Values.operator.baseName}}-operator-mongodb-webhook
10+
name: {{ $webhookClusterRoleName }}
1011
rules:
1112
- apiGroups:
1213
- "admissionregistration.k8s.io"
@@ -38,7 +39,7 @@ metadata:
3839
roleRef:
3940
apiGroup: rbac.authorization.k8s.io
4041
kind: ClusterRole
41-
name: {{.Values.operator.baseName}}-operator-mongodb-webhook
42+
name: {{ $webhookClusterRoleName }}
4243
subjects:
4344
- kind: ServiceAccount
4445
name: {{ .Values.operator.name }}

0 commit comments

Comments
 (0)