forked from grafana-community/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserviceaccount_test.yaml
More file actions
108 lines (100 loc) · 3.5 KB
/
serviceaccount_test.yaml
File metadata and controls
108 lines (100 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# $schema: https://raw.githubusercontent.com/helm-unittest/helm-unittest/refs/heads/main/schema/helm-testsuite.json
suite: backend service account
templates:
- backend/statefulset.yaml
- backend/serviceaccount.yaml
- backend/clusterrolebinding.yaml
- config.yaml
set:
deploymentMode: SimpleScalable
loki.useTestSchema: true
loki.storage.bucketNames.chunks: chunks
loki.storage.bucketNames.ruler: ruler
loki.storage.bucketNames.admin: admin
read.legacyReadTarget: false
tests:
- it: uses global service account name by default
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-loki
- template: backend/clusterrolebinding.yaml
equal:
path: subjects[0].name
value: RELEASE-NAME-loki
- template: backend/serviceaccount.yaml
hasDocuments:
count: 0
- it: uses backend generated service account name when backend account is created
set:
backend.serviceAccount.create: true
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-loki-backend
- template: backend/clusterrolebinding.yaml
equal:
path: subjects[0].name
value: RELEASE-NAME-loki-backend
- template: backend/serviceaccount.yaml
equal:
path: metadata.name
value: RELEASE-NAME-loki-backend
- it: uses backend serviceAccount.name override
set:
backend.serviceAccount.create: false
backend.serviceAccount.name: backend-custom-sa
serviceAccount.name: global-custom-sa
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.serviceAccountName
value: backend-custom-sa
- template: backend/clusterrolebinding.yaml
equal:
path: subjects[0].name
value: backend-custom-sa
- it: creates backend ServiceAccount with backend serviceAccount.name override
set:
backend.serviceAccount.create: true
backend.serviceAccount.name: backend-custom-sa
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.serviceAccountName
value: backend-custom-sa
- template: backend/clusterrolebinding.yaml
equal:
path: subjects[0].name
value: backend-custom-sa
- template: backend/serviceaccount.yaml
equal:
path: metadata.name
value: backend-custom-sa
- it: sets backend ServiceAccount automountServiceAccountToken when creating backend account
set:
backend.serviceAccount.create: true
backend.serviceAccount.automountServiceAccountToken: false
asserts:
- template: backend/serviceaccount.yaml
equal:
path: automountServiceAccountToken
value: false
- it: sets backend pod automountServiceAccountToken when backend value is explicitly true
set:
backend.automountServiceAccountToken: true
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.automountServiceAccountToken
value: true
- it: sets backend pod automountServiceAccountToken when backend value is explicitly false
set:
backend.automountServiceAccountToken: false
asserts:
- template: backend/statefulset.yaml
equal:
path: spec.template.spec.automountServiceAccountToken
value: false