File tree 5 files changed +34
-0
lines changed
5 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ {{- if .Values.clusterRole.create -}}
1
2
---
2
3
apiVersion : rbac.authorization.k8s.io/v1
3
4
kind : ClusterRole
12
13
- apiGroups : [""]
13
14
resources : ["secrets"]
14
15
verbs : ["get", "list"]
16
+ {{- end }}
Original file line number Diff line number Diff line change
1
+ {{- if and .Values.serviceAccount.create .Values.clusterRole.create -}}
1
2
---
2
3
apiVersion : rbac.authorization.k8s.io/v1
3
4
kind : ClusterRoleBinding
@@ -13,3 +14,4 @@ roleRef:
13
14
kind : ClusterRole
14
15
name : {{ include "nhi-explorer.fullname" . }}
15
16
apiGroup : rbac.authorization.k8s.io
17
+ {{- end }}
Original file line number Diff line number Diff line change @@ -7,9 +7,17 @@ templates:
7
7
- clusterrole.yaml
8
8
tests :
9
9
- it : " renders the ClusterRole with correct rules"
10
+ set :
11
+ clusterRole.create : true
10
12
asserts :
11
13
- isKind :
12
14
of : ClusterRole
13
15
- matchRegex :
14
16
path : metadata.name
15
17
pattern : -nhi-explorer$
18
+ - it : " does not create a ClusterRole"
19
+ set :
20
+ clusterRole.create : false
21
+ asserts :
22
+ - hasDocuments :
23
+ count : 0
Original file line number Diff line number Diff line change 5
5
- ../test_values.yaml
6
6
templates :
7
7
- clusterrolebinding.yaml
8
+ set :
9
+ clusterRole.create : true
10
+ serviceAccount.create : true
8
11
tests :
9
12
- it : should have the correct kind for ClusterRoleBinding
10
13
asserts :
11
14
- isAPIVersion :
12
15
of : rbac.authorization.k8s.io/v1
16
+ - it : " does not create a ClusterRoleBinding if clusterRole.create is false"
17
+ set :
18
+ clusterRole.create : false
19
+ serviceAccount.create : true
20
+ asserts :
21
+ - hasDocuments :
22
+ count : 0
23
+ - it : " does not create a ClusterRoleBinding if serviceAccount.create is false"
24
+ set :
25
+ clusterRole.create : true
26
+ serviceAccount.create : false
27
+ asserts :
28
+ - hasDocuments :
29
+ count : 0
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ serviceAccount:
42
42
# If not set and create is true, a name is generated using the fullname template
43
43
name : ' '
44
44
45
+ clusterRole :
46
+ # Specifies whether a clusterRole should be created with permissions to fetch k8s resources
47
+ create : false
48
+ name : ' '
49
+
45
50
# This is for setting Kubernetes Annotations to a Pod.
46
51
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
47
52
podAnnotations : {}
You can’t perform that action at this time.
0 commit comments