chart icon indicating copy to clipboard operation
chart copied to clipboard

Use .Values.image.tag for app.kubernetes.io/version

Open hinricht opened this issue 1 year ago • 3 comments

When specifiying a different image.tag version, the resulting image definitions will use this tag, but the helm labels app.kubernetes.io/version values would still use the AppVersion from Chart.yaml.

Before:

$ helm template -f dev-values.yaml --set image.tag=1.2.3 . |grep -E '(4.2.8|1.2.3)'
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
              image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "v4.2.8"
          image: "ghcr.io/mastodon/mastodon:1.2.3"

With this PR:

 $ helm template -f dev-values.yaml --set image.tag=1.2.3 . |grep -E '(4.2.8|1.2.3)'
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
        checksum/config-secrets: "02dbb4d23850e2f2d1502951426916d5117c01338e80b5e5cea0bd474973859d"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
        checksum/config-secrets: "02dbb4d23850e2f2d1502951426916d5117c01338e80b5e5cea0bd474973859d"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
        checksum/config-secrets: "02dbb4d23850e2f2d1502951426916d5117c01338e80b5e5cea0bd474973859d"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
              image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
    app.kubernetes.io/version: "1.2.3"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
          image: "ghcr.io/mastodon/mastodon:1.2.3"
    app.kubernetes.io/version: "1.2.3"
          image: "ghcr.io/mastodon/mastodon:1.2.3"

hinricht avatar Jul 15 '24 13:07 hinricht

This is a good minor fix, aligned with Kubernetes recommendation, that should be merged.

jeremiahlee avatar Aug 05 '24 08:08 jeremiahlee

Anyone, please review

hinricht avatar Sep 10 '24 14:09 hinricht

https://github.com/mastodon/chart/actions/runs/10794459133/job/29938793409?pr=146:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: unknown object type "nil" in ServiceAccount.metadata.labels.app.kubernetes.io/version

Anyone knows why this CI job fails ?

hinricht avatar Sep 11 '24 08:09 hinricht

I cherry-picked this branch into my repo while deploying #161 to production and can confirm the change works as intended and has no issues. The version bump in Chart.yaml will create an easily resolvable conflict after this many months.

abbottmg avatar Feb 06 '25 22:02 abbottmg

PR #175 was just merged, which merges this as well, so closing this~

timetinytim avatar Mar 07 '25 14:03 timetinytim