Skip to content

Commit fda9029

Browse files
committed
Enable Custom CA Certificate For Lurcher
Signed-off-by: Yannik Fuhrmeister <yannik.fuhrmeister@iteratec.com>
1 parent 76575b3 commit fda9029

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎operator/controllers/execution/scans/scan_reconciler.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,24 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
276276
},
277277
}
278278

279+
lurcherCustomCaCertificate := os.Getenv("LURCHER_CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE")
280+
if lurcherCustomCaCertificate != "" {
281+
282+
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes, corev1.Volume{
283+
Name: "scan-results",
284+
VolumeSource: corev1.VolumeSource{
285+
ConfigMap: &corev1.ConfigMapVolumeSource{},
286+
},
287+
})
288+
certificateName := os.Getenv("LURCHER_CUSTOM_CA_CERTIFICATE_NAME")
289+
lurcherSidecar.VolumeMounts = append(lurcherSidecar.VolumeMounts, corev1.VolumeMount{
290+
Name: certificateName,
291+
ReadOnly: true,
292+
MountPath: "/etc/ssl/certs/" + certificateName,
293+
SubPath: certificateName,
294+
})
295+
}
296+
279297
job.Spec.Template.Spec.Containers = append(job.Spec.Template.Spec.Containers, *lurcherSidecar)
280298

281299
if err := ctrl.SetControllerReference(scan, job, r.Scheme); err != nil {

‎operator/templates/manager/manager.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ spec:
9797
value: "{{ .Values.lurcher.image.repository }}:{{ .Values.lurcher.image.tag | default .Chart.Version }}"
9898
- name: LURCHER_PULL_POLICY
9999
value: {{ .Values.lurcher.image.pullPolicy }}
100+
- name: LURCHER_CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
101+
value: "{{ .Values.lurcher.customCACertificate.existingCertificate }}"
102+
- name: LURCHER_CUSTOM_CA_CERTIFICATE_NAME
103+
value: "{{ .Values.lurcher.customCACertificate.certificate }}""
100104
resources:
101105
{{- toYaml .Values.resources | nindent 12 }}
102106
securityContext:

0 commit comments

Comments
 (0)