Skip to content

Commit a13bf10

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

File tree

4 files changed

+36
-10
lines changed

4 files changed

+36
-10
lines changed

charts/clair/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ maintainers:
1212
name: clair
1313
sources:
1414
- https://github.com/coreos/clair
15-
version: 0.1.10
15+
version: 0.1.11

charts/clair/templates/_helpers.tpl

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,30 @@ If release name contains chart name it will be used as a full name.
2424
{{- end -}}
2525
{{- end -}}
2626

27-
{{/*
28-
Create a default fully qualified postgresql name.
29-
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
30-
*/}}
31-
{{- define "postgresql.fullname" -}}
32-
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}}
27+
{{- define "common.clair.image" -}}
28+
{{- $registryName := .component.registry | default .global.containerRegistry -}}
29+
{{- $imageName := .extraImage | default .component.repository -}}
30+
{{- $imageTag := .extraImageTag | default .component.tag -}}
31+
{{- $imageDigest := .extraImageDigest | default .component.digest -}}
32+
{{- if $registryName }}
33+
{{- if and $imageTag $imageDigest }}
34+
{{- printf "%s/%s@%s" $registryName $imageName $imageDigest -}}
35+
{{- else if $imageTag }}
36+
{{- printf "%s/%s:%s" $registryName $imageName $imageTag -}}
37+
{{- else if $imageDigest }}
38+
{{- printf "%s/%s@%s" $registryName $imageName $imageDigest -}}
39+
{{- else }}
40+
{{- printf "%s/%s" $registryName $imageName -}}
41+
{{- end }}
42+
{{- else -}}
43+
{{- if and $imageTag $imageDigest }}
44+
{{- printf "%s@%s" $imageName $imageDigest -}}
45+
{{- else if $imageTag }}
46+
{{- printf "%s:%s" $imageName $imageTag -}}
47+
{{- else if $imageDigest }}
48+
{{- printf "%s@%s" $imageName $imageDigest -}}
49+
{{- else }}
50+
{{- printf "%s" $imageName -}}
51+
{{- end }}
52+
{{- end -}}
3353
{{- end -}}

charts/clair/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ spec:
3838
{{- end }}
3939
initContainers:
4040
- name: pg-ready-wait
41-
image: postgres:11.3
41+
image: {{ include "common.clair.image" (dict "component" $.Values.image "global" $.Values.global "extraImage" $.Values.image.initContainer.image "extraImageTag" $.Values.image.initContainer.tag ) }}
4242
command: [ "sh", "-c",
4343
"until pg_isready -h {{ .Values.config.postgresHost }} -p {{ .Values.config.postgresPort }};
4444
do echo waiting for database; sleep 1; done;"]
4545
containers:
4646
- name: {{ .Chart.Name }}
47-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
47+
image: {{ include "common.clair.image" (dict "component" $.Values.image "global" $.Values.global ) }}
4848
imagePullPolicy: {{ .Values.image.pullPolicy }}
4949
{{- if .Values.extraEnv }}
5050
env: {{ toYaml .Values.extraEnv | nindent 8 }}

charts/clair/values.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
global:
2+
containerRegistry: "quay.io/projectquay"
3+
14
config:
25
postgresHost: postgresql-postgresql.devtroncd
36
postgresPort: 5432
@@ -34,8 +37,11 @@ config:
3437
extraConfig: {}
3538
image:
3639
pullPolicy: IfNotPresent
37-
repository: quay.io/projectquay/clair
40+
repository: clair
3841
tag: 4.3.6
42+
initContainer:
43+
image: postgres
44+
tag: "11.3"
3945
ingress:
4046
annotations: null
4147
enabled: false

0 commit comments

Comments
 (0)