Skip to content

Commit 27709bc

Browse files
author
Ubuntu
committed
modified the chart to support global-image-repo
1 parent cc89ffa commit 27709bc

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

charts/security/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ keywords:
1010
- image scanning
1111
- source code scanning
1212
type: application
13-
maintaintainers:
13+
maintainers:
1414
- name: Pawan Kumar
1515
1616
sources:
1717
- https://github.com/devtron-labs/charts
18-
version: 0.1.5
18+
version: 0.1.6
1919
appVersion: "0.1.1"
2020
dependencies:
2121
- name: clair
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{/*
2+
Return full image
3+
{{ include "common.image" ( dict "component" .Values.path.to.the.component "global" .Values.global .extraImage .extraImageTag .extraImageDigest ) }}
4+
*/}}
5+
{{- define "common.image" -}}
6+
{{- $registryName := .component.registry | default .global.containerRegistry -}}
7+
{{- $imageName := .extraImage | default .component.image -}}
8+
{{- $imageTag := .extraImageTag | default .component.tag -}}
9+
{{- $imageDigest := .extraImageDigest | default .component.digest -}}
10+
{{- if $registryName }}
11+
{{- if and $imageTag $imageDigest }}
12+
{{- printf "%s/%s@%s" $registryName $imageName $imageDigest -}}
13+
{{- else if $imageTag }}
14+
{{- printf "%s/%s:%s" $registryName $imageName $imageTag -}}
15+
{{- else if $imageDigest }}
16+
{{- printf "%s/%s@%s" $registryName $imageName $imageDigest -}}
17+
{{- else }}
18+
{{- printf "%s/%s" $registryName $imageName -}}
19+
{{- end }}
20+
{{- else -}}
21+
{{- if and $imageTag $imageDigest }}
22+
{{- printf "%s@%s" $imageName $imageDigest -}}
23+
{{- else if $imageTag }}
24+
{{- printf "%s:%s" $imageName $imageTag -}}
25+
{{- else if $imageDigest }}
26+
{{- printf "%s@%s" $imageName $imageDigest -}}
27+
{{- else }}
28+
{{- printf "%s" $imageName -}}
29+
{{- end }}
30+
{{- end -}}
31+
{{- end -}}

charts/security/templates/image-scanner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ spec:
9999
{{- end }}
100100
containers:
101101
- name: image-scanner
102-
image: {{ .image }}
102+
image: {{ include "common.image" (dict "component" $.Values.imageScanner "global" $.Values.global ) }}
103103
imagePullPolicy: {{ .imagePullPolicy }}
104104
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
105105
securityContext:

charts/security/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
global:
2+
containerRegistry: "quay.io/devtron"
13
imageScanner:
24
configs:
35
CLAIR_ADDR: clair.devtroncd:6060
@@ -13,7 +15,7 @@ imageScanner:
1315
dbconfig:
1416
secretName: postgresql-postgresql
1517
keyName: postgresql-password
16-
image: "quay.io/devtron/image-scanner:b278f42b-334-11119"
18+
image: "image-scanner:b278f42b-334-11119"
1719
imagePullPolicy: IfNotPresent
1820
labels: {}
1921
replicaCount: 1

0 commit comments

Comments
 (0)