Skip to content

Commit 214ac12

Browse files
committed
Change lurcher cert injection code to use unified cert config var
1 parent fb5d47d commit 214ac12

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,21 @@ 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-
fmt.Println("Reach the Volume creation")
279+
customCACertificate, isConfigured := os.LookupEnv("CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE")
280+
r.Log.Info("Configuring customCACerts for lurcher", "customCACertificate", customCACertificate, "isConfigured", isConfigured)
281+
if customCACertificate != "" {
282282
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes, corev1.Volume{
283283
Name: "ca-certificate",
284284
VolumeSource: corev1.VolumeSource{
285285
ConfigMap: &corev1.ConfigMapVolumeSource{
286286
LocalObjectReference: corev1.LocalObjectReference{
287-
Name: lurcherCustomCACertificate,
287+
Name: customCACertificate,
288288
},
289289
},
290290
},
291291
})
292292

293-
certificateName := os.Getenv("LURCHER_CUSTOM_CA_CERTIFICATE_NAME")
293+
certificateName := os.Getenv("CUSTOM_CA_CERTIFICATE_NAME")
294294
lurcherSidecar.VolumeMounts = append(lurcherSidecar.VolumeMounts, corev1.VolumeMount{
295295
Name: "ca-certificate",
296296
ReadOnly: true,

‎operator/templates/manager/manager.yaml‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ spec:
2020
- name: ca-certificate
2121
configMap:
2222
name: {{ .Values.customCACertificate.existingCertificate }}
23-
2423
{{- end }}
25-
2624
containers:
2725
- command:
2826
- /manager
@@ -97,11 +95,11 @@ spec:
9795
value: "{{ .Values.lurcher.image.repository }}:{{ .Values.lurcher.image.tag | default .Chart.Version }}"
9896
- name: LURCHER_PULL_POLICY
9997
value: {{ .Values.lurcher.image.pullPolicy }}
100-
{{- if .Values.lurcher.customCACertificate.existingCertificate }}
101-
- name: LURCHER_CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
102-
value: "{{ .Values.lurcher.customCACertificate.existingCertificate }}"
103-
- name: LURCHER_CUSTOM_CA_CERTIFICATE_NAME
104-
value: "{{ .Values.lurcher.customCACertificate.certificate }}"
98+
{{- if .Values.customCACertificate.existingCertificate }}
99+
- name: CUSTOM_CA_CERTIFICATE_EXISTING_CERTIFICATE
100+
value: {{ .Values.customCACertificate.existingCertificate | quote }}
101+
- name: CUSTOM_CA_CERTIFICATE_NAME
102+
value: {{ .Values.customCACertificate.certificate | quote }}
105103
{{ end }}
106104
resources:
107105
{{- toYaml .Values.resources | nindent 12 }}

0 commit comments

Comments
 (0)