add logic in _helpers.tpl when using sha256 of image#32
add logic in _helpers.tpl when using sha256 of image#32chris7532 wants to merge 2 commits intokafbat:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for SHA256 image digests in the Kafka-UI Helm chart's image name template helper function. The change enables users to reference container images by their SHA256 digest instead of by tag, which provides immutable image references.
- Adds conditional logic to detect SHA256 digests in the image tag value
- Modifies the image name formatting to omit the colon separator when using SHA256 digests
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {{- else }} | ||
| {{- printf "%s:%s" $repository $tag -}} | ||
| {{- end }} |
There was a problem hiding this comment.
The SHA256 digest handling logic is inconsistent. When no registry is specified, the code still uses the colon separator, which will produce an invalid image reference if the tag contains a SHA256 digest. The same conditional logic that was added for the registry case (lines 79-83) should also be applied here to handle SHA256 digests correctly.
| {{- else }} | |
| {{- printf "%s:%s" $repository $tag -}} | |
| {{- end }} | |
| {{- else }} | |
| {{- if contains "@sha256" $tag }} | |
| {{- printf "%s%s" $repository $tag -}} | |
| {{- else }} | |
| {{- printf "%s:%s" $repository $tag -}} | |
| {{- end }} | |
| {{- end }} |
| @@ -76,7 +76,11 @@ This allows us to check if the registry of the image is specified or not. | |||
| {{- $repository := .Values.image.repository -}} | |||
| {{- $tag := .Values.image.tag | default .Chart.AppVersion -}} | |||
There was a problem hiding this comment.
The variable name '$tag' is misleading because it can now contain either a tag (with ':' separator) or a digest (with '@sha256:' prefix). Consider renaming it to something more generic like '$tagOrDigest' or '$imageIdentifier' to better reflect its dual purpose and improve code clarity.
No description provided.