Skip to content

Commit b604720

Browse files
committed
Add component lib test cases for custom CA configmap
1 parent 90d19ff commit b604720

4 files changed

Lines changed: 121 additions & 2 deletions

File tree

tests/component-lib-tests.jsonnet

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ local inv = kap.inventory();
77
local test_cases = inv.parameters.test_cases;
88

99
local create_schedule(tc, spec) =
10+
local pspec = if std.objectHas(spec, 'prune_spec') then
11+
k8up.PruneSpec(
12+
spec.prune_spec.schedule,
13+
spec.prune_spec.keep_daily,
14+
spec.prune_spec.keep_last
15+
)
16+
else
17+
{};
18+
local cspec = if std.objectHas(spec, 'check_schedule') then
19+
k8up.CheckSpec(spec.check_schedule)
20+
else
21+
{};
1022
k8up.Schedule(
1123
tc,
1224
std.get(spec, 'schedule', '23 * * * *'),
@@ -16,6 +28,6 @@ local create_schedule(tc, spec) =
1628
s3secret=std.get(spec, 's3secret'),
1729
create_bucket=false,
1830
caConfigMap=std.get(spec, 'caConfigMap'),
19-
).schedule;
31+
).schedule + pspec + cspec;
2032

2133
std.mapWithKey(create_schedule, test_cases)

tests/component-lib.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ parameters:
1515
s3_endpoint: https://s3.example.com
1616

1717
test_cases:
18-
default:
18+
default: &d
1919
schedule: "10 3 * * *"
2020
bucket: default-bucket
2121
backupkey:
@@ -25,3 +25,16 @@ parameters:
2525
name: s3-secret
2626
accesskeyname: username
2727
secretkeyname: password
28+
custom-ca:
29+
<<: *d
30+
bucket: custom-ca-bucket
31+
caConfigMap: custom-ca
32+
custom-ca-with-extra:
33+
<<: *d
34+
bucket: custom-ca-bucket
35+
caConfigMap: custom-ca
36+
prune_spec:
37+
schedule: "10 */4 * * *"
38+
keep_last: 20
39+
keep_daily: 30
40+
check_schedule: "30 3 * * *"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: k8up.io/v1
2+
kind: Schedule
3+
metadata:
4+
name: custom-ca-with-extra
5+
spec:
6+
backend:
7+
repoPasswordSecretRef:
8+
key: password
9+
name: backup-secret
10+
s3:
11+
accessKeyIDSecretRef:
12+
key: username
13+
name: s3-secret
14+
bucket: custom-ca-bucket
15+
endpoint: https://s3.example.com
16+
secretAccessKeySecretRef:
17+
key: password
18+
name: s3-secret
19+
tlsOptions:
20+
caCert: /mnt/ca/ca.crt
21+
volumeMounts:
22+
- mountPath: /mnt/ca/
23+
name: ca
24+
backup:
25+
keepJobs: 3
26+
promURL: http://platform-prometheus-pushgateway.syn-synsights.svc:9091
27+
schedule: 10 3 * * *
28+
volumes:
29+
- configMap:
30+
name: custom-ca
31+
name: ca
32+
check:
33+
promURL: http://platform-prometheus-pushgateway.syn-synsights.svc:9091
34+
schedule: 30 3 * * *
35+
volumes:
36+
- configMap:
37+
name: custom-ca
38+
name: ca
39+
prune:
40+
retention:
41+
keepDaily: 30
42+
keepLast: 20
43+
schedule: 10 */4 * * *
44+
volumes:
45+
- configMap:
46+
name: custom-ca
47+
name: ca
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: k8up.io/v1
2+
kind: Schedule
3+
metadata:
4+
name: custom-ca
5+
spec:
6+
backend:
7+
repoPasswordSecretRef:
8+
key: password
9+
name: backup-secret
10+
s3:
11+
accessKeyIDSecretRef:
12+
key: username
13+
name: s3-secret
14+
bucket: custom-ca-bucket
15+
endpoint: https://s3.example.com
16+
secretAccessKeySecretRef:
17+
key: password
18+
name: s3-secret
19+
tlsOptions:
20+
caCert: /mnt/ca/ca.crt
21+
volumeMounts:
22+
- mountPath: /mnt/ca/
23+
name: ca
24+
backup:
25+
keepJobs: 3
26+
promURL: http://platform-prometheus-pushgateway.syn-synsights.svc:9091
27+
schedule: 10 3 * * *
28+
volumes:
29+
- configMap:
30+
name: custom-ca
31+
name: ca
32+
check:
33+
promURL: http://platform-prometheus-pushgateway.syn-synsights.svc:9091
34+
schedule: 30 3 * * *
35+
volumes:
36+
- configMap:
37+
name: custom-ca
38+
name: ca
39+
prune:
40+
retention:
41+
keepDaily: 30
42+
keepLast: 5
43+
schedule: 30 2 * * *
44+
volumes:
45+
- configMap:
46+
name: custom-ca
47+
name: ca

0 commit comments

Comments
 (0)