Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to deploy image using sha256 digest, not floating label #135

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions charts/k8s-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,21 @@ applicationName: nginx

The only difference here is the `tag` of the `containerImage`.

If you wish to upgrade your `nginx` version to a specific `sha256:` image digest value (not image id), then you can do this by
using the sha256 value instead of the tag label as shown below:

```yaml
containerImage:
repository: nginx
tag: sha256:15b5f7f28672bbbf26f058928b16ecb465843845fafe5ea9a06b05a590709150

applicationName: nginx
```

This will deploy a specific image version, not a tag that could potentially float (like `latest`). This is very useful if doing
promotion pipelines where you want the values SBOM (Software Bill Of Materials) to represent a specific image version, not
a label that may no longer refer to the original image version.

Next, we will upgrade our release using the updated values. To do so, we will use the `helm upgrade` command:

```bash
Expand Down
8 changes: 8 additions & 0 deletions charts/k8s-service/templates/_deployment_spec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,21 @@ spec:
- name: {{ .Values.applicationName }}-canary
{{- $repo := required ".Values.canary.containerImage.repository is required" .Values.canary.containerImage.repository }}
{{- $tag := required ".Values.canary.containerImage.tag is required" .Values.canary.containerImage.tag }}
{{- if eq (substr 0 7 $tag) "sha256:" }}
image: "{{ $repo }}@{{ $tag }}"
{{- else }}
image: "{{ $repo }}:{{ $tag }}"
{{- end }}
imagePullPolicy: {{ .Values.canary.containerImage.pullPolicy | default "IfNotPresent" }}
{{- else }}
- name: {{ .Values.applicationName }}
{{- $repo := required ".Values.containerImage.repository is required" .Values.containerImage.repository }}
{{- $tag := required ".Values.containerImage.tag is required" .Values.containerImage.tag }}
{{- if eq (substr 0 7 $tag) "sha256:" }}
image: "{{ $repo }}@{{ $tag }}"
{{- else }}
image: "{{ $repo }}:{{ $tag }}"
{{- end }}
imagePullPolicy: {{ .Values.containerImage.pullPolicy | default "IfNotPresent" }}
{{- end }}
{{- if .Values.containerCommand }}
Expand Down