forked from sonatype/nexus-iq-server-ha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iq-server-deployment_test.yaml
701 lines (689 loc) · 25.2 KB
/
iq-server-deployment_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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
suite: iq-server-service
templates:
- iq-server-deployment.yaml
tests:
- it: renders with defaults
set:
iq_server:
tag: "1.148.0" # force version tag so tests do not have to be updated every time we update IQ server version
asserts:
- hasDocuments:
count: 1
- isKind:
of: Deployment
documentIndex: 0
- equal:
path: apiVersion
value: apps/v1
documentIndex: 0
- equal:
path: metadata.name
value: RELEASE-NAME-iq-server-deployment
documentIndex: 0
- equal:
path: spec
value:
replicas: 2
selector:
matchLabels:
name: RELEASE-NAME-iq-server
template:
metadata:
labels:
name: RELEASE-NAME-iq-server
spec:
serviceAccountName: default
containers:
- env:
- name: NXIQ_INITIAL_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-iq-server-initial-admin-password-secret
- name: NXIQ_DATABASE_HOSTNAME
valueFrom:
secretKeyRef:
key: hostname
name: RELEASE-NAME-iq-server-database-hostname-secret
- name: NXIQ_DATABASE_PORT
valueFrom:
secretKeyRef:
key: port
name: RELEASE-NAME-iq-server-database-port-secret
- name: NXIQ_DATABASE_NAME
valueFrom:
secretKeyRef:
key: name
name: RELEASE-NAME-iq-server-database-name-secret
- name: NXIQ_DATABASE_USERNAME
valueFrom:
secretKeyRef:
key: username
name: RELEASE-NAME-iq-server-database-username-secret
- name: NXIQ_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-iq-server-database-password-secret
- name: NXIQ_DATABASE_MIGRATION
value: "false"
image: sonatype/nexus-iq-server:1.148.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/sh
- -c
- |
curl -If http://localhost:8071/healthcheck/threadDeadlock
failureThreshold: 3
initialDelaySeconds: 180
periodSeconds: 20
timeoutSeconds: 3
name: RELEASE-NAME-iq-server-container
ports:
- containerPort: 8070
name: application-0
- containerPort: 8071
name: admin-0
readinessProbe:
exec:
command:
- /bin/sh
- -c
- |
curl -If http://localhost:8071/healthcheck/database &&
curl -If http://localhost:8071/healthcheck/clusterDirectory &&
curl -If http://localhost:8071/healthcheck/workDirectory
failureThreshold: 4
initialDelaySeconds: 45
periodSeconds: 15
timeoutSeconds: 5
resources:
requests:
limits:
volumeMounts:
- mountPath: /sonatype-work/clm-cluster
name: RELEASE-NAME-iq-server-pod-volume
- mountPath: "/opt/sonatype/nexus-iq-server/.ssh"
name: RELEASE-NAME-iq-server-pod-volume
subPath: .ssh
- mountPath: /etc/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-config-volume
- mountPath: /var/log/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-logs
- env:
- name: FLUENTD_CONF
value: fluentd.yaml
image: bitnami/fluentd:1.15.3-debian-11-r20
imagePullPolicy: IfNotPresent
name: RELEASE-NAME-fluentd-container
resources:
requests:
limits:
volumeMounts:
- mountPath: /opt/bitnami/fluentd/conf
name: RELEASE-NAME-fluentd-pod-config-volume
- mountPath: /var/log/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-logs
initContainers:
- command:
- /bin/sh
- -c
- chown -R 1000:1000 /sonatype-work/clm-cluster
image: busybox:1.28
name: RELEASE-NAME-set-iq-persistence-ownership
volumeMounts:
- mountPath: /sonatype-work/clm-cluster
name: RELEASE-NAME-iq-server-pod-volume
volumes:
- name: RELEASE-NAME-iq-server-pod-volume
persistentVolumeClaim:
claimName: iq-server-pvc
- configMap:
items:
- key: config
path: config.yml
name: RELEASE-NAME-iq-server-config-configmap
name: RELEASE-NAME-iq-server-pod-config-volume
- emptyDir: { }
name: RELEASE-NAME-iq-server-pod-logs
- configMap:
items:
- key: fluentd
path: fluentd.yaml
name: RELEASE-NAME-fluentd-sidecar-forwarder-configmap
name: RELEASE-NAME-fluentd-pod-config-volume
documentIndex: 0
- it: renders with overridden values
set:
iq_server:
resources:
requests:
cpu: 8
memory: "8Gi"
limits:
cpu: 10
memory: "10Gi"
javaOpts: "-Xms8g -Xmx32g"
serviceAccountName: "my-service-account"
imageRegistry: "docker-all.repo.sonatype.com"
image: "iq/snapshot"
imagePullPolicy: "Always"
tag: "1.142.0-SNAPSHOT"
persistence:
size: "2Gi"
hostPath:
path: "/mnt/iq"
podAnnotations:
key1: "value1"
license: "/iq.lic"
sshPrivateKey: "/private.key"
sshKnownHosts: "/known_hosts"
replicas: 1
initialAdminPassword: "admin!234"
readinessProbe:
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 3
failureThreshold: 2
livenessProbe:
initialDelaySeconds: 300
periodSeconds: 60
timeoutSeconds: 2
failureThreshold: 2
database:
hostname: "iq_host"
port: 54322
name: "iq_db"
username: "pg"
password: "pwd"
config:
sonatypeWork: "/iq/clm-server"
clusterDirectory: "/iq/clm-cluster"
licenseFile: "lic.lic"
server:
applicationContextPath: /
applicationConnectors:
- port: 8072
type: https
adminContextPath: /admin
adminConnectors:
- port: 8073
type: https
requestLog:
appenders:
- type: console
logFormat: "%clientHost %l %user [%date] \"%requestURL\" %statusCode \"%header{User-Agent}\""
- type: file
currentLogFilename: "/iq/log/iq-server/request.log"
logFormat: "%clientHost %l %user [%date] \"%requestURL\" %statusCode \"%header{User-Agent}\""
archivedLogFilenamePattern: "/iq/log/iq-server/request-%d.log.gz"
logging:
level: INFO
loggers:
"com.networknt.schema": ERROR
appenders:
- type: console
threshold: DEBUG
logFormat: "%d{'HH:mm:ss,SSSZ'} %level [%thread] %X{username} %logger - %msg%n"
createSampleData: false
pvOwnershipOverride: "chown -R 2000:2000 /different/path"
fluentd:
resources:
requests:
cpu: 2
memory: "500M"
limits:
cpu: 4
memory: "1Gi"
asserts:
- hasDocuments:
count: 1
- equal:
path: metadata.name
value: RELEASE-NAME-iq-server-deployment
documentIndex: 0
- equal:
path: spec
value:
replicas: 1
selector:
matchLabels:
name: RELEASE-NAME-iq-server
template:
metadata:
labels:
name: RELEASE-NAME-iq-server
annotations:
key1: value1
spec:
serviceAccountName: "my-service-account"
containers:
- env:
- name: NXIQ_LICENSE_FILE
value: /license/license_lic
- name: NXIQ_SSH_PRIVATE_KEY
value: "/opt/sonatype/nexus-iq-server/.ssh/id_rsa"
- name: NXIQ_SSH_KNOWN_HOSTS
value: "/opt/sonatype/nexus-iq-server/.ssh/known_hosts"
- name: NXIQ_INITIAL_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-iq-server-initial-admin-password-secret
- name: NXIQ_DATABASE_HOSTNAME
valueFrom:
secretKeyRef:
key: hostname
name: RELEASE-NAME-iq-server-database-hostname-secret
- name: NXIQ_DATABASE_PORT
valueFrom:
secretKeyRef:
key: port
name: RELEASE-NAME-iq-server-database-port-secret
- name: NXIQ_DATABASE_NAME
valueFrom:
secretKeyRef:
key: name
name: RELEASE-NAME-iq-server-database-name-secret
- name: NXIQ_DATABASE_USERNAME
valueFrom:
secretKeyRef:
key: username
name: RELEASE-NAME-iq-server-database-username-secret
- name: NXIQ_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-iq-server-database-password-secret
- name: NXIQ_DATABASE_MIGRATION
value: "false"
- name: JAVA_OPTS
value: "-Xms8g -Xmx32g"
image: docker-all.repo.sonatype.com/iq/snapshot:1.142.0-SNAPSHOT
imagePullPolicy: Always
livenessProbe:
exec:
command:
- /bin/sh
- -c
- |
curl -If https://localhost:8073/admin/healthcheck/threadDeadlock
failureThreshold: 2
initialDelaySeconds: 300
periodSeconds: 60
timeoutSeconds: 2
name: RELEASE-NAME-iq-server-container
ports:
- containerPort: 8072
name: application-0
- containerPort: 8073
name: admin-0
readinessProbe:
exec:
command:
- /bin/sh
- -c
- |
curl -If https://localhost:8073/admin/healthcheck/database &&
curl -If https://localhost:8073/admin/healthcheck/clusterDirectory &&
curl -If https://localhost:8073/admin/healthcheck/workDirectory
failureThreshold: 2
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 3
resources:
requests:
cpu: 8
memory: "8Gi"
limits:
cpu: 10
memory: "10Gi"
volumeMounts:
- mountPath: /iq/clm-cluster
name: RELEASE-NAME-iq-server-pod-volume
- mountPath: "/opt/sonatype/nexus-iq-server/.ssh"
name: RELEASE-NAME-iq-server-pod-volume
subPath: .ssh
- mountPath: /license
name: RELEASE-NAME-iq-server-pod-license-volume
readOnly: true
- mountPath: /etc/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-config-volume
- mountPath: /var/log/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-logs
- env:
- name: FLUENTD_CONF
value: fluentd.yaml
image: bitnami/fluentd:1.15.3-debian-11-r20
imagePullPolicy: IfNotPresent
name: RELEASE-NAME-fluentd-container
resources:
requests:
cpu: 2
memory: "500M"
limits:
cpu: 4
memory: "1Gi"
volumeMounts:
- mountPath: /opt/bitnami/fluentd/conf
name: RELEASE-NAME-fluentd-pod-config-volume
- mountPath: /var/log/nexus-iq-server
name: RELEASE-NAME-iq-server-pod-logs
initContainers:
- command:
- /bin/sh
- -c
- chown -R 2000:2000 /different/path
image: busybox:1.28
name: RELEASE-NAME-set-iq-persistence-ownership
volumeMounts:
- mountPath: /iq/clm-cluster
name: RELEASE-NAME-iq-server-pod-volume
volumes:
- name: RELEASE-NAME-iq-server-pod-volume
persistentVolumeClaim:
claimName: iq-server-pvc
- name: RELEASE-NAME-iq-server-pod-license-volume
secret:
secretName: RELEASE-NAME-iq-server-license-secret
- configMap:
items:
- key: config
path: config.yml
name: RELEASE-NAME-iq-server-config-configmap
name: RELEASE-NAME-iq-server-pod-config-volume
- emptyDir: { }
name: RELEASE-NAME-iq-server-pod-logs
- configMap:
items:
- key: fluentd
path: fluentd.yaml
name: RELEASE-NAME-fluentd-sidecar-forwarder-configmap
name: RELEASE-NAME-fluentd-pod-config-volume
documentIndex: 0
- it: renders iq version tag correctly by default
asserts:
- matchRegex:
path: spec.template.spec.containers[0].image
pattern: sonatype/nexus-iq-server:\d+\.\d+\.\d+
documentIndex: 0
- it: can set a license secret
set:
iq_server:
licenseSecret: "someLicenseSecret"
asserts:
- equal:
path: spec.template.spec.volumes[1].secret
value:
secretName: "someLicenseSecret"
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].volumeMounts[2].mountPath
value: "/license"
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].env[0].value
value: "/license/license_lic"
documentIndex: 0
- it: can set an ssh private key secret
set:
iq_server:
sshPrivateKeySecret: "someSecret"
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts[1]
value:
mountPath: /opt/sonatype/nexus-iq-server/.ssh
name: RELEASE-NAME-iq-server-pod-volume
subPath: .ssh
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].env[0].name
value: "NXIQ_SSH_PRIVATE_KEY"
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].env[0].value
value: "/opt/sonatype/nexus-iq-server/.ssh/id_rsa"
documentIndex: 0
- it: can set an ssh known hosts secret
set:
iq_server:
sshKnownHostsSecret: "someSecret"
asserts:
- equal:
path: spec.template.spec.containers[0].volumeMounts[1]
value:
mountPath: /opt/sonatype/nexus-iq-server/.ssh
name: RELEASE-NAME-iq-server-pod-volume
subPath: .ssh
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].env[0].name
value: "NXIQ_SSH_KNOWN_HOSTS"
documentIndex: 0
- equal:
path: spec.template.spec.containers[0].env[0].value
value: "/opt/sonatype/nexus-iq-server/.ssh/known_hosts"
documentIndex: 0
- it: can set a database password secret
set:
iq_server:
database:
passwordSecret: "someDatabasePasswordSecret"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: "someDatabasePasswordSecret"
key: "password"
documentIndex: 0
- it: can set an initial admin password secret
set:
iq_server:
initialAdminPasswordSecret: "someInitialAdminPasswordSecret"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_INITIAL_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: "someInitialAdminPasswordSecret"
key: "password"
documentIndex: 0
- it: can set aws secrets
set:
secret:
arn: "arn:aws:abc/xyz"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_INITIAL_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-aws-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /iq-secrets
name: RELEASE-NAME-iq-server-secrets-volume
readOnly: true
documentIndex: 0
- contains:
path: spec.template.spec.volumes
content:
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
fsType: ext4
secretProviderClass: RELEASE-NAME-aws-secret-provider
name: RELEASE-NAME-iq-server-secrets-volume
documentIndex: 0
- it: can set aws license secret
set:
secret:
license:
arn: "arn:aws:abc/license"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_LICENSE_FILE
value: "/iq-secrets/license_lic"
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /iq-secrets
name: RELEASE-NAME-iq-server-secrets-volume
readOnly: true
documentIndex: 0
- contains:
path: spec.template.spec.volumes
content:
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
fsType: ext4
secretProviderClass: RELEASE-NAME-aws-secret-provider
name: RELEASE-NAME-iq-server-secrets-volume
documentIndex: 0
- it: can set aws rds secrets
set:
secret:
rds:
arn: "arn:aws:abc/xyz"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_HOSTNAME
valueFrom:
secretKeyRef:
key: hostname
name: RELEASE-NAME-aws-rds-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_PORT
valueFrom:
secretKeyRef:
key: port
name: RELEASE-NAME-aws-rds-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_NAME
valueFrom:
secretKeyRef:
key: name
name: RELEASE-NAME-aws-rds-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_USERNAME
valueFrom:
secretKeyRef:
key: username
name: RELEASE-NAME-aws-rds-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: RELEASE-NAME-aws-rds-secret
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /iq-secrets
name: RELEASE-NAME-iq-server-secrets-volume
readOnly: true
documentIndex: 0
- contains:
path: spec.template.spec.volumes
content:
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
fsType: ext4
secretProviderClass: RELEASE-NAME-aws-secret-provider
name: RELEASE-NAME-iq-server-secrets-volume
documentIndex: 0
- it: can set aws ssh private key secret
set:
secret:
sshPrivateKey:
arn: "arn:aws:abc/xyz"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_SSH_PRIVATE_KEY
value: "/iq-secrets/id_rsa"
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /iq-secrets
name: RELEASE-NAME-iq-server-secrets-volume
readOnly: true
documentIndex: 0
- contains:
path: spec.template.spec.volumes
content:
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
fsType: ext4
secretProviderClass: RELEASE-NAME-aws-secret-provider
name: RELEASE-NAME-iq-server-secrets-volume
documentIndex: 0
- it: can set aws ssh known hosts secret
set:
secret:
sshKnownHosts:
arn: "arn:aws:abc/xyz"
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: NXIQ_SSH_KNOWN_HOSTS
value: "/iq-secrets/known_hosts"
documentIndex: 0
- contains:
path: spec.template.spec.containers[0].volumeMounts
content:
mountPath: /iq-secrets
name: RELEASE-NAME-iq-server-secrets-volume
readOnly: true
documentIndex: 0
- contains:
path: spec.template.spec.volumes
content:
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
fsType: ext4
secretProviderClass: RELEASE-NAME-aws-secret-provider
name: RELEASE-NAME-iq-server-secrets-volume
documentIndex: 0