@@ -24,7 +24,7 @@ local secret_key_ref(s3secret) =
2424 key: s3secret.secretkeyname,
2525 };
2626
27- local Backend(backupkey, bucket, s3secret, create_bucket=true, tls_options =null) =
27+ local Backend(backupkey, bucket, s3secret, create_bucket=true, caConfigMap =null) =
2828 local bsecret =
2929 if s3secret == null && bucket != null then
3030 {
@@ -63,8 +63,17 @@ local Backend(backupkey, bucket, s3secret, create_bucket=true, tls_options=null)
6363 accessKeyIDSecretRef: access_key_ref(bsecret),
6464 secretAccessKeySecretRef: secret_key_ref(bsecret),
6565 },
66- [if tls_options != null then 'tlsOptions']: tls_options,
67- },
66+ } + if caConfigMap != null then {
67+ tlsOptions: {
68+ caCert: '/mnt/ca/ca.crt',
69+ },
70+ volumeMounts: [
71+ {
72+ name: 'ca',
73+ mountPath: '/mnt/ca/',
74+ },
75+ ],
76+ } else {},
6877 };
6978
7079/**
@@ -143,8 +152,8 @@ local PruneSpec(schedule, keepDaily, keepLast) =
143152 * \returns an object with keys 'bucket' and 'job'. 'bucket' can be `null`, if
144153 * the global bucket or an externally-managed bucket is used.
145154 */
146- local Job(name, keep_jobs=3, backupkey=null, bucket=null, s3secret=null, create_bucket=true, tls_options =null) =
147- local backend = Backend(backupkey, bucket, s3secret, create_bucket, tls_options );
155+ local Job(name, keep_jobs=3, backupkey=null, bucket=null, s3secret=null, create_bucket=true, caConfigMap =null) =
156+ local backend = Backend(backupkey, bucket, s3secret, create_bucket, caConfigMap );
148157 local thejob = {
149158 apiVersion: 'k8up.io/v1',
150159 kind: 'Backup',
@@ -169,12 +178,12 @@ local Job(name, keep_jobs=3, backupkey=null, bucket=null, s3secret=null, create_
169178 *
170179 * See the documentation for \ref Job for definitions of the other arguments.
171180 */
172- local Schedule(name, schedule, keep_jobs=3, backupkey=null, bucket=null, s3secret=null, create_bucket=true, tls_options =null) =
181+ local Schedule(name, schedule, keep_jobs=3, backupkey=null, bucket=null, s3secret=null, create_bucket=true, caConfigMap =null) =
173182 // prune backups daily, keep last 5 and 30 daily backups
174183 local pspec = PruneSpec('30 2 * * *', 30, 5);
175184 // check backup repo dalily
176185 local cspec = CheckSpec('30 3 * * *');
177- local backend = Backend(backupkey, bucket, s3secret, create_bucket, tls_options );
186+ local backend = Backend(backupkey, bucket, s3secret, create_bucket, caConfigMap );
178187 local theschedule =
179188 {
180189 apiVersion: 'k8up.io/v1',
@@ -189,6 +198,14 @@ local Schedule(name, schedule, keep_jobs=3, backupkey=null, bucket=null, s3secre
189198 k8up_params.prometheus_push_gateway,
190199 keepJobs: keep_jobs,
191200 schedule: schedule,
201+ [if caConfigMap != null then 'volumes']: [
202+ {
203+ name: 'ca',
204+ secret: {
205+ secretName: caConfigMap,
206+ },
207+ },
208+ ],
192209 },
193210 },
194211 } + pspec + cspec;
0 commit comments