forked from StackStorm/stackstorm-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_test.yaml
231 lines (217 loc) · 5.99 KB
/
env_test.yaml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
suite: Environment Vars
templates:
# primary template files
- deployments.yaml
- jobs.yaml
# included templates must also be listed
- configmaps_overrides.yaml
- configmaps_packs.yaml
- configmaps_rbac.yaml
- configmaps_st2-conf.yaml
- configmaps_st2-urls.yaml
- configmaps_st2web.yaml
- secrets_datastore_crypto_key.yaml
- secrets_ssh.yaml
- secrets_st2apikeys.yaml
- secrets_st2auth.yaml
- secrets_st2chatops.yaml
tests:
- it: Deployments default to no env (except st2client)
template: deployments.yaml
set:
st2: { packs: { sensors: [] } } # ensure only 1 sensor
st2chatops:
enabled: true
asserts:
- hasDocuments:
count: 14
- equal:
path: spec.template.spec.containers[0].env
value:
- name: ST2CLIENT
value: "1"
documentIndex: 12
- notExists: &is_null_env
path: spec.template.spec.containers[0].env
documentIndex: 0
- notExists: *is_null_env
documentIndex: 1
- notExists: *is_null_env
documentIndex: 2
- notExists: *is_null_env
documentIndex: 3
- notExists: *is_null_env
documentIndex: 4
- notExists: *is_null_env
documentIndex: 5
- notExists: *is_null_env
documentIndex: 6
- notExists: *is_null_env
documentIndex: 7
- notExists: *is_null_env
documentIndex: 8
- notExists: *is_null_env
documentIndex: 9
- notExists: *is_null_env
documentIndex: 10
- notExists: *is_null_env
documentIndex: 11
- notExists: *is_null_env
documentIndex: 13
- it: Jobs default to no env
template: jobs.yaml
set:
st2:
rbac: { enabled: true } # enable rbac job
jobs:
extra_hooks: &extra_hooks_jobs
- name: upgrade-warning
hook: pre-upgrade, pre-rollback
hook_weight: -5
command: ["st2", "run", "--tail", "custom_pack.warn_about_upgrade"]
asserts:
- hasDocuments:
count: 5
- notExists: *is_null_env
- it: Deployments accept custom env
template: deployments.yaml
set:
st2auth:
env: &env
FOO: bar
st2api:
env: *env
st2stream:
env: *env
st2web:
env: *env
st2rulesengine:
env: *env
st2timersengine:
env: *env
st2workflowengine:
env: *env
st2scheduler:
env: *env
st2notifier:
env: *env
st2sensorcontainer:
env: *env
st2: { packs: { sensors: [] } } # ensure only 1 sensor
st2actionrunner:
env: *env
st2garbagecollector:
env: *env
st2client:
env: *env
st2chatops:
enabled: false
asserts:
- hasDocuments:
count: 13 # st2chatops env handled as secrets
- contains: &contains_env
path: spec.template.spec.containers[0].env
content:
name: FOO
value: bar
- it: Jobs accept custom env
template: jobs.yaml
set:
st2:
rbac: { enabled: true } # enable rbac job
jobs:
env: *env
extra_hooks: *extra_hooks_jobs
asserts:
- hasDocuments:
count: 5
- contains: *contains_env
- it: Deployments envFrom defaults include st2-urls configMap and st2chatops secretRef
template: deployments.yaml
set:
st2: { packs: { sensors: [] } } # ensure only 1 sensor
st2chatops:
enabled: true
release:
name: st2ha
asserts:
- hasDocuments:
count: 14
- contains: &contains_st2_urls
path: spec.template.spec.containers[0].envFrom
content:
configMapRef:
name: st2ha-st2-urls
# this is how st2chatops.env loads vars
- contains:
path: spec.template.spec.containers[0].envFrom
content:
secretRef: # not a configMap
name: st2ha-st2chatops
documentIndex: 13
- it: Jobs envFrom defaults
template: jobs.yaml
set:
st2:
rbac: { enabled: true } # enable rbac job
jobs:
extra_hooks: *extra_hooks_jobs
release:
name: st2ha
asserts:
- hasDocuments:
count: 5
- contains: *contains_st2_urls
documentIndex: 1
- contains: *contains_st2_urls
documentIndex: 2
- notExists: &is_null_envFrom
path: spec.template.spec.containers[0].envFrom
documentIndex: 0
- notExists: *is_null_envFrom
documentIndex: 3
- it: Deployments support envFromSecrets (st2actionrunner, st2sensorcontainer, and st2client)
template: deployments.yaml
set:
st2: { packs: { sensors: [] } } # ensure only 1 sensor
st2actionrunner:
envFromSecrets: &envFromSecrets
- my-external-secret-1
- my-external-secret-2
st2sensorcontainer:
envFromSecrets: *envFromSecrets
st2client:
envFromSecrets: *envFromSecrets
asserts:
- contains: &contains_external_secret1
path: spec.template.spec.containers[0].envFrom
content:
secretRef:
name: my-external-secret-1
documentIndex: 9
- contains: *contains_external_secret1
documentIndex: 10
- contains: *contains_external_secret1
documentIndex: 12
- contains: &contains_external_secret2
path: spec.template.spec.containers[0].envFrom
content:
secretRef:
name: my-external-secret-2
documentIndex: 9
- contains: *contains_external_secret2
documentIndex: 10
- contains: *contains_external_secret2
documentIndex: 12
- it: Jobs support envFromSecrets
template: jobs.yaml
set:
st2:
rbac: { enabled: true } # enable rbac job
jobs:
envFromSecrets: *envFromSecrets
extra_hooks: *extra_hooks_jobs
asserts:
- contains: *contains_external_secret1
- contains: *contains_external_secret2