-
Notifications
You must be signed in to change notification settings - Fork 120
feat(vector): add ability to provide a digest for haproxy #524
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,56 @@ If release name contains chart name it will be used as a full name. | |
| {{- printf "%s-haproxy" (include "vector.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Build a valid image reference from available fields: | ||
| - tag only: repo:tag | ||
| - sha/digest only: repo@sha256:… | ||
| - tag@digest: repo:tag@sha256:… | ||
| - nothing set: repo:latest | ||
| */}} | ||
| {{- define "haproxy.image" -}} | ||
| {{- $repo := .Values.haproxy.image.repository | default "haproxytech/haproxy-alpine" -}} | ||
| {{- $tagRaw := .Values.haproxy.image.tag | default "" -}} | ||
| {{- $shaRaw := (coalesce .Values.haproxy.image.sha .Values.haproxy.image.digest) | default "" -}} | ||
| {{- $tag := trim $tagRaw -}} | ||
|
|
||
| {{- /* Normalize SHA to ensure it has sha256: prefix for backward compatibility */ -}} | ||
| {{- $sha := "" -}} | ||
| {{- if $shaRaw -}} | ||
| {{- if hasPrefix "sha256:" $shaRaw -}} | ||
| {{- $sha = $shaRaw -}} | ||
| {{- else -}} | ||
| {{- $sha = printf "sha256:%s" $shaRaw -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- /* Case 1: digest field wins */ -}} | ||
| {{- if $sha -}} | ||
| {{- if $tag -}} | ||
| {{- printf "%s:%s@%s" $repo $tag $sha -}} | ||
| {{- else -}} | ||
| {{- printf "%s@%s" $repo $sha -}} | ||
| {{- end -}} | ||
|
|
||
| {{- /* Case 2: tag looks like a digest */ -}} | ||
| {{- else if hasPrefix "sha256:" $tag -}} | ||
| {{- printf "%s@%s" $repo $tag -}} | ||
|
|
||
| {{- /* Case 3: tag@digest combined syntax */ -}} | ||
| {{- else if contains "@sha256:" $tag -}} | ||
|
Comment on lines
+42
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When HAProxy users set Useful? React with 👍 / 👎. |
||
| {{- $parts := splitList "@" $tag -}} | ||
| {{- printf "%s:%s@%s" $repo (index $parts 0) (index $parts 1) -}} | ||
|
|
||
| {{- /* Case 4: normal tag */ -}} | ||
| {{- else if $tag -}} | ||
| {{- printf "%s:%s" $repo $tag -}} | ||
|
|
||
| {{- /* Case 5: no tag or digest set */ -}} | ||
| {{- else -}} | ||
| {{- printf "%s:%s" $repo "latest" -}} | ||
| {{- end }} | ||
|
LaurentGoderre marked this conversation as resolved.
|
||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.