blob: 31e04f0e2cc0a003228a4e4b469b5cc0285e5855 (
plain)
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
---
suite: test job behavior
templates:
- job.yaml
tests:
- it: "should render with default value (global)"
asserts:
- isKind:
of: Job
- matchRegex:
path: metadata.name
pattern: -mariadb-init-config-job$
- equal:
path: metadata.namespace
value: NAMESPACE
- matchRegex:
path: metadata.labels.app
pattern: mariadb-init
- matchRegex:
path: spec.template.metadata.labels.app
pattern: mariadb-init
- matchRegex:
path: spec.template.metadata.name
pattern: mariadb-init
- isNull:
path: spec.template.spec.nodeSelector
- isNull:
path: spec.template.spec.affinity
- it: "should render with default value (init container)"
asserts:
- matchRegex:
path: spec.template.spec.initContainers[0].name
pattern: mariadb-init-readiness
- contains:
path: spec.template.spec.initContainers[0].args
content: mariadb-galera
- equal:
path: spec.template.spec.initContainers[0].image
value: nexus3.onap.org:10001/onap/oom/readiness:6.0.2
- equal:
path: spec.template.spec.initContainers[0].imagePullPolicy
value: IfNotPresent
- it: "should render with default value (container)"
asserts:
- matchRegex:
path: spec.template.spec.containers[0].name
pattern: mariadb-init
- equal:
path: spec.template.spec.containers[0].image
value: nexus3.onap.org:10001/mariadb:10.1.38
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_HOST
value: mariadb-galera
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_PORT
value: "3306"
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-galera-mariadb-galera
key: db-root-password
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-init-secret
key: db-user-password
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
name: mariadb-conf
mountPath: /db_init/
readOnly: true
- equal:
path: spec.template.spec.containers[0].resources.limits.cpu
value: 100m
- equal:
path: spec.template.spec.containers[0].resources.limits.memory
value: 500Mbi
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 10m
- equal:
path: spec.template.spec.containers[0].resources.requests.memory
value: 10Mbi
- it: "should render with default value (volumes)"
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: mariadb-conf
configMap:
name: RELEASE-NAME-mariadb-init
- it: "should render with nameOverride set"
set:
nameOverride: myJob
asserts:
- matchRegex:
path: metadata.name
pattern: -myJob-config-job$
- matchRegex:
path: metadata.labels.app
pattern: myJob
- matchRegex:
path: spec.template.metadata.labels.app
pattern: myJob
- matchRegex:
path: spec.template.metadata.name
pattern: myJob
- matchRegex:
path: spec.template.spec.initContainers[0].name
pattern: myJob-readiness
- matchRegex:
path: spec.template.spec.containers[0].name
pattern: myJob
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
# replicating name from mariadb galera cluster, kind of hardcoded...
name: RELEASE-NAME-myJob-secret
key: db-user-password
- contains:
path: spec.template.spec.volumes
content:
name: mariadb-conf
configMap:
name: RELEASE-NAME-myJob
- it: "should render with configmap set"
set:
config:
config_map: myCM
asserts:
- contains:
path: spec.template.spec.volumes
content:
name: mariadb-conf
configMap:
name: RELEASE-NAME-myCM
- it: "should render with mariadbGalera changes"
set:
global:
mariadbGalera:
nameOverride: myMaria
servicePort: 545
asserts:
- contains:
path: spec.template.spec.initContainers[0].args
content: myMaria
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_HOST
value: myMaria
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_PORT
value: "545"
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-galera-myMaria
key: db-root-password
- it: "should render with full mariadbGalera changes"
set:
global:
mariadbGalera:
nameOverride: myMaria
servicePort: 545
userRootSecret: galera-secret
userRootSecretKey: root-password
asserts:
- contains:
path: spec.template.spec.initContainers[0].args
content: myMaria
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_HOST
value: myMaria
- contains:
path: spec.template.spec.containers[0].env
content:
name: DB_PORT
value: "545"
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: galera-secret
key: root-password
- it: "should set the right nodeSelector"
set:
nodeSelector:
disktype: ssd
asserts:
- equal:
path: spec.template.spec.nodeSelector.disktype
value: ssd
- it: "should set the right affinity"
set:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/e2e-az-name
operator: In
values:
- e2e-az1
- e2e-az2
asserts:
- equal:
path: spec.template.spec.affinity
value:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/e2e-az-name
operator: In
values:
- e2e-az1
- e2e-az2
- it: "should use large flavor"
set:
flavor: large
asserts:
- equal:
path: spec.template.spec.containers[0].resources.limits.cpu
value: 200m
- equal:
path: spec.template.spec.containers[0].resources.limits.memory
value: 500Mbi
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 20m
- equal:
path: spec.template.spec.containers[0].resources.requests.memory
value: 20Mbi
- it: "should use unlimited flavor"
set:
flavor: unlimited
asserts:
- isEmpty:
path: spec.template.spec.containers[0].resources
- it: "shoud render with other databases"
set:
config:
mysqlAdditionalDatabases:
dbOne:
user: one
password: pwd1
dbTwo:
user: two
password: pwd2
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-init-secret
key: db-user-password
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_PASSWORD_DBONE
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-init-secret
key: db-dbOne-user-password
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSQL_PASSWORD_DBTWO
valueFrom:
secretKeyRef:
name: RELEASE-NAME-mariadb-init-secret
key: db-dbTwo-user-password
|