Failure when using image digest #398

Closed
opened 2023-01-30 08:44:30 +00:00 by justusbunsi · 3 comments
justusbunsi commented 2023-01-30 08:44:30 +00:00 (Migrated from gitea.com)

Having a customized values.yaml like

image:
  tag: "1.18-dev@sha256:9dc1e3fe0707081e9568852c11c37b64e01e12bdc0440d964d274e4d74c9e9d4"

will result in templated resources with labels for version and app.kubernetes.io/version being too long for Kubernetes (more than 63 characters). The tag value is directly used within a helper template function and affects all resources this Chart generates.

Currently, it seems impossible to use a specific image digest with the Chart.

I propose either a new image.digest or image.fullOverride option to prevent overfloating label lengths, or trimming the value to a maximum of 63 characters.

Having a customized values.yaml like ```yaml image: tag: "1.18-dev@sha256:9dc1e3fe0707081e9568852c11c37b64e01e12bdc0440d964d274e4d74c9e9d4" ``` will result in templated resources with labels for `version` and `app.kubernetes.io/version` being too long for Kubernetes (more than 63 characters). The `tag` value is directly used within a [helper template function](https://gitea.com/gitea/helm-chart/src/commit/da4120809fcadd8d240b3054ed3f916c1c2efac4/templates/_helpers.tpl#L77) and affects all resources this Chart generates. Currently, it seems impossible to use a specific image digest with the Chart. I propose either a new `image.digest` or `image.fullOverride` option to prevent overfloating label lengths, or trimming the value to a maximum of 63 characters.
pat-s commented 2023-01-30 09:51:37 +00:00 (Migrated from gitea.com)

trimming the value to a maximum of 63 characters.

If that does it, I'd vote for that.

Out of curiosity: is that a common thing you do in your environments? I've never seen the digest being used in the tag field. The only reason that comes to my mind is when you overwrite a tag during development, push a new image and want to use an older image with the same respective tag that has no active tag anymore in the registry.

> trimming the value to a maximum of 63 characters. If that does it, I'd vote for that. Out of curiosity: is that a common thing you do in your environments? I've never seen the digest being used in the tag field. The only reason that comes to my mind is when you overwrite a tag during development, push a new image and want to use an older image with the same respective tag that has no active tag anymore in the registry.
justusbunsi commented 2023-01-30 11:38:41 +00:00 (Migrated from gitea.com)

I usually pin the image to a specific digest, especially when images are mutable. To me it's a matter of reproducability of my environment. But in this particular case I wanted to check something that was published with this specific digest.

Having the setting trimmed would probably lead to a weird label value. I personally would prefer providing a dedicated digest field (empty by default). Doing so would allow to specify the digest itself as a separate label on the resources. As long as it's less than 63 chars without the tag value. xD

We also could use regex to remove the digest from that value when using it as label.

I usually pin the image to a specific digest, especially when images are mutable. To me it's a matter of reproducability of my environment. But in this particular case I wanted to check something that was published with this specific digest. Having the setting trimmed would probably lead to a weird label value. I personally would prefer providing a dedicated digest field (empty by default). Doing so would allow to specify the digest itself as a separate label on the resources. As long as it's less than 63 chars without the tag value. xD We also could use regex to remove the digest from that value when using it as label.
jouve commented 2023-02-26 14:02:30 +00:00 (Migrated from gitea.com)

bitnami's common.images.image macro is pretty neat for this with the optional digest (example )

image:
  registry: docker.io
  repository: bitnami/gitea
  tag: 1.18.5-debian-11-r0
  digest: ""
bitnami's [common.images.image](https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_images.tpl#L6) macro is pretty neat for this with the optional digest ([example](https://github.com/bitnami/charts/blob/main/bitnami/gitea/values.yaml#L59) ) ``` image: registry: docker.io repository: bitnami/gitea tag: 1.18.5-debian-11-r0 digest: "" ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lunny/helm-chart#398
No description provided.