diff --git a/operations/helm/charts/grafana-agent/CHANGELOG.md b/operations/helm/charts/grafana-agent/CHANGELOG.md index f87918d883ce..6b82c54edf9d 100644 --- a/operations/helm/charts/grafana-agent/CHANGELOG.md +++ b/operations/helm/charts/grafana-agent/CHANGELOG.md @@ -10,6 +10,11 @@ internal API changes are not present. Unreleased ---------- +### Enhancements + +- Ensure that `app.kubernetes.io/version` label accounts for any + image tag overrides supplied to the chart Values. (@tristanburgess) + 0.27.2 (2023-11-07) ---------- diff --git a/operations/helm/charts/grafana-agent/templates/_helpers.tpl b/operations/helm/charts/grafana-agent/templates/_helpers.tpl index b9336e976d62..342a330a8aa6 100644 --- a/operations/helm/charts/grafana-agent/templates/_helpers.tpl +++ b/operations/helm/charts/grafana-agent/templates/_helpers.tpl @@ -55,9 +55,9 @@ helm.sh/chart: {{ include "grafana-agent.chart" . }} app.kubernetes.io/version: "vX.Y.Z" app.kubernetes.io/managed-by: {{ .Release.Service }} {{- else }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} +{{/* substr trims delimeter prefix char from grafana-agent.imageId output + e.g. ':' for tags and '@' for digests. */}} +app.kubernetes.io/version: {{ substr 1 -1 (include "grafana-agent.imageId" .) }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{- end }}