Skip to content

Commit

Permalink
Merge pull request #137 from MediaMarktSaturn/mhaxp-image.tag
Browse files Browse the repository at this point in the history
Add .values.image.hash to application helm chart
  • Loading branch information
heubeck authored Jul 22, 2024
2 parents f132593 + 41fe65f commit ce1f701
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 11 deletions.
11 changes: 11 additions & 0 deletions chart-tests/application/ci/test-image-sha-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resources:
requests:
cpu: 10m
memory: 50Mi
limits:
cpu: 100m
memory: 100Mi

image:
digest: sha256:b187aed68cc8c75f475efe8aebcc61fc7ca0c5adc2d2c5b8318997c3edc8d32f
tag:
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ autoscaling:

image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
pullPolicy: IfNotPresent

# ImagePolicy and check period for automated updates
Expand Down
4 changes: 2 additions & 2 deletions chart-tests/application/ci/test-sidecar-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sidecars:
- name: sidekick
image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
env:
ECHO_VALUE: yehaaa
QUARKUS_HTTP_PORT: 9090
Expand All @@ -31,7 +31,7 @@ sidecars:
- name: kickback
image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
env:
ECHO_VALUE: wohooo
QUARKUS_HTTP_PORT: 7070
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sidecars:
- name: sidekick
image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
env:
ECHO_VALUE: yehaaa
QUARKUS_HTTP_PORT: 9090
Expand All @@ -34,7 +34,7 @@ sidecars:
- name: kickback
image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
env:
ECHO_VALUE: wohooo
QUARKUS_HTTP_PORT: 7070
Expand Down
2 changes: 1 addition & 1 deletion charts/application/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ maintainers:
- name: MediaMarktSaturn
url: https://github.com/MediaMarktSaturn
appVersion: 1.0.0
version: 1.20.1
version: 1.21.0
3 changes: 2 additions & 1 deletion charts/application/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Generic application chart with common requirements of a typical workload.
| readinessProbe.failureThreshold | int | `3` | |
| readinessProbe.timeoutSeconds | int | `5` | |
| image.repository | string | `"quay.io/heubeck/examiner"` | |
| image.tag | string | `"1.12.21"` | |
| image.tag | string | `"1.13.1"` | |
| image.digest | string | `nil` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.tagSemverRange | string | `nil` | |
| image.tagNumerical | string | `nil` | |
Expand Down
12 changes: 12 additions & 0 deletions charts/application/templates/_podTemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ spec:
initContainers: {{ if not .Values.initContainers -}}[]{{- end -}}
{{- range $i := .Values.initContainers }}
- name: {{ $i.name }}
{{- if .image.digest }}
image: "{{ .image.repository }}@{{ .image.digest }}"
{{- else }}
image: "{{ .image.repository }}:{{ .image.tag }}"
{{- end }}
imagePullPolicy: {{ or $i.image.pullPolicy $.Values.initDefaults.image.pullPolicy }}
command: {{ if not $i.command }}[]{{ end }}
{{- range $i.command }}
Expand Down Expand Up @@ -107,7 +111,11 @@ spec:
containers:
{{- range $s := .Values.sidecars }}
- name: {{ $s.name }}
{{- if .image.digest }}
image: "{{ .image.repository }}@{{ .image.digest }}"
{{- else }}
image: "{{ .image.repository }}:{{ .image.tag }}"
{{- end }}
imagePullPolicy: {{ or $s.image.pullPolicy $.Values.sidecarDefaults.image.pullPolicy }}
args: {{ if not $s.args }}[]{{ end }}
{{- range $s.args }}
Expand Down Expand Up @@ -195,7 +203,11 @@ spec:
securityContext:
{{- toYaml .Values.container.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.image.digest }}
image: "{{ .Values.image.repository }}@{{ .Values.image.digest }}"
{{- else }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: {{ if not .Values.container.args }}[]{{ end }}
{{- range .Values.container.args }}
Expand Down
2 changes: 1 addition & 1 deletion charts/application/templates/flux-image-policy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.image.tagUpdateInterval (or .Values.image.tagSemverRange (has .Values.image.tagNumerical (list "asc" "desc")) (has .Values.image.tagAlphabetical (list "asc" "desc")) ) }}
{{- if and .Values.image.tagUpdateInterval (or .Values.image.tagSemverRange (has .Values.image.tagNumerical (list "asc" "desc")) (has .Values.image.tagAlphabetical (list "asc" "desc")) ) (not .Values.image.digest ) }}
{{- if .Capabilities.APIVersions.Has "image.toolkit.fluxcd.io/v1beta2" }}
apiVersion: image.toolkit.fluxcd.io/v1beta2
{{- else }}
Expand Down
2 changes: 1 addition & 1 deletion charts/application/templates/flux-image-repository.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.image.tagUpdateInterval (or .Values.image.tagSemverRange .Values.image.tagNumerical .Values.image.tagAlphabetical ) }}
{{- if and .Values.image.tagUpdateInterval (or .Values.image.tagSemverRange .Values.image.tagNumerical .Values.image.tagAlphabetical ) (not .Values.image.digest) }}
{{- if .Capabilities.APIVersions.Has "image.toolkit.fluxcd.io/v1beta2" }}
apiVersion: image.toolkit.fluxcd.io/v1beta2
{{- else }}
Expand Down
7 changes: 5 additions & 2 deletions charts/application/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ readinessProbe:

image:
repository: quay.io/heubeck/examiner
tag: 1.12.21
tag: 1.13.1
# When image.digest is set the image.tag, imagepolicy and imagerepository is ignored
# e.g. "sha256:b187aed68cc8c75f475efe8aebcc61fc7ca0c5adc2d2c5b8318997c3edc8d32f"
digest:
pullPolicy: IfNotPresent

# ImagePolicy options:
Expand Down Expand Up @@ -303,7 +306,7 @@ sidecars: []
# - name: sqlproxy
# image:
# repository: quay.io/heubeck/examiner
# tag: 1.12.21
# tag: 1.13.1
# args: []
# env: {}
# configEnvFrom: []
Expand Down

0 comments on commit ce1f701

Please sign in to comment.