Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit e51e8ac

Browse files
committed
Allow to specify operator and lurcher image references via helm
1 parent 966bd2b commit e51e8ac

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

operator/controllers/execution/scan_controller.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,24 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
426426
},
427427
)
428428

429+
lurcherImage := os.Getenv("LURCHER_IMAGE")
430+
lurcherPullPolicyRaw := os.Getenv("LURCHER_PULL_POLICY")
431+
var lurcherPullPolicy corev1.PullPolicy
432+
switch lurcherPullPolicyRaw {
433+
case "Always":
434+
lurcherPullPolicy = corev1.PullAlways
435+
case "IfNotPresent":
436+
lurcherPullPolicy = corev1.PullIfNotPresent
437+
case "Never":
438+
lurcherPullPolicy = corev1.PullNever
439+
default:
440+
return nil, fmt.Errorf("Unkown imagePull Policy for lurcher: %s", lurcherPullPolicyRaw)
441+
}
442+
429443
lurcherSidecar := &corev1.Container{
430-
Name: "lurcher",
431-
Image: "scbexperimental/lurcher@sha256:10294aabb8c4f3d819c83b187d26b850b9168aaf75e8ea112043ebbbbc5d7ed6",
444+
Name: "lurcher",
445+
Image: lurcherImage,
446+
ImagePullPolicy: lurcherPullPolicy,
432447
Args: []string{
433448
"--container",
434449
job.Spec.Template.Spec.Containers[0].Name,
@@ -466,7 +481,6 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
466481
MountPath: "/home/securecodebox/",
467482
},
468483
},
469-
ImagePullPolicy: "IfNotPresent",
470484
}
471485

472486
job.Spec.Template.Spec.Containers = append(job.Spec.Template.Spec.Containers, *lurcherSidecar)

operator/templates/manager/manager.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ spec:
2020
- /manager
2121
args:
2222
- --enable-leader-election
23-
image: scbexperimental/operator:latest
23+
{{- if .Values.image.digest }}
24+
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}@{{ .Values.image.digest }}"
25+
{{- else }}
26+
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
27+
{{- end }}
28+
imagePullPolicy: {{ .Values.image.pullPolicy }}
2429
name: manager
2530
env:
2631
# TODO: integrate with cert manager and auto gen a cert for minio
@@ -42,6 +47,15 @@ spec:
4247
key: secretkey
4348
- name: S3_BUCKET
4449
value: {{ .Values.minio.defaultBucket.name }}
50+
{{- if .Values.image.digest }}
51+
- name: LURCHER_IMAGE
52+
value: "{{ .Values.lurcher.image.registry }}/{{ .Values.lurcher.image.repository }}@{{ .Values.lurcher.image.digest }}"
53+
{{- else }}
54+
- name: LURCHER_IMAGE
55+
value: "{{ .Values.lurcher.image.registry }}/{{ .Values.lurcher.image.repository }}:{{ .Values.lurcher.image.tag }}"
56+
{{- end }}
57+
- name: LURCHER_PULL_POLICY
58+
value: {{ .Values.lurcher.image.pullPolicy }}
4559
resources:
4660
limits:
4761
cpu: 100m

operator/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
image:
6+
registry: docker.io
7+
repository: scbexperimental/operator
8+
tag: latest
9+
digest: null
10+
pullPolicy: Always
11+
12+
lurcher:
13+
image:
14+
registry: docker.io
15+
repository: scbexperimental/lurcher
16+
tag: null
17+
digest: "sha256:0e9f18f85809fb8c042543657d340949db14e81fc727bf9fab4421befd317850"
18+
pullPolicy: IfNotPresent
19+
520
s3:
621
# TODO: Needs to be implemented
722
# by default uses a locally installed minio instance.

0 commit comments

Comments
 (0)