Skip to content

[Feature Request] Add a setter for tag@digest to help pin image hashes in places that do not natively take a digest as input #960

@alanrichman

Description

@alanrichman

The Problem

Some Helm charts have values that allow you to specify the name, tag, and digest of an image separately, for example: https://github.com/kubernetes/ingress-nginx/blob/helm-chart-4.13.2/charts/ingress-nginx/values.yaml#L33

To automate pulling images for this chart from a private repository I could set my values like this:

image: mymirror.com/ingress-nginx/controller # {"$imagepolicy": "flux-system:ingress-nginx:name"}
tag: "v1.13.2" # {"$imagepolicy": "flux-system:ingress-nginx:tag"}
digest: sha256:1f7eaeb01933e719c8a9f4acd8181e555e582330c7d50f24484fb64d2ba9b2ef # {"$imagepolicy": "flux-system:ingress-nginx:digest"}
digestChroot: ""

Then in places like Deployments, Jobs, etc. that specify just an image I can use this:

image: mymirror.com/ingress-nginx/controller:v1.13.2@sha256:1f7eaeb01933e719c8a9f4acd8181e555e582330c7d50f24484fb64d2ba9b2ef # {"$imagepolicy": "flux-system:ingress-nginx"}

However there are many Helm charts whose values only allow you to specify the name and tag which makes it awkward to provide a digest using Flux image automation. Here are some examples of this behavior:

The best way I have found to get a digest in here is by way of post-build variable substitution.

# kustomization.yaml
postBuild:
  substitute:
    ingressNginxTag: v1.13.2 # {"$imagepolicy": "flux-system:ingress-nginx:tag"}
    ingressNginxDigest: sha256:1f7eaeb01933e719c8a9f4acd8181e555e582330c7d50f24484fb64d2ba9b2ef # {"$imagepolicy": "flux-system:ingress-nginx:digest"}
---
# helmrelease.yaml
image: mymirror.com/ingress-nginx/controller # {"$imagepolicy": "flux-system:ingress-nginx:name"}
tag: ${ingressNginxTag}@${ingressNginxDigest}

Possible Solution: Add a new tagAtDigest setter option

Use of this new setter would look like this:

image: mymirror.com/ingress-nginx/controller # {"$imagepolicy": "flux-system:ingress-nginx:name"}
tag: v1.13.2@sha256:1f7eaeb01933e719c8a9f4acd8181e555e582330c7d50f24484fb64d2ba9b2ef # {"$imagepolicy": "flux-system:ingress-nginx:tagAtDigest"}

I think that this could add a lot of value to the image automation controller since it would help organizations who want to pin digests for all sorts of reasons achieve this simply and without leaning on upstream product maintainers to make any changes to their charts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions