Revert "fix(helm): truncate the helm.sh/chart label to 63 bytes"

This reverts commit 4f7f706a63.

Version hygiene belongs to the pipeline that mints chart versions, not to the
chart. The build workflow now caps the version slug so litellm-<version> fits
the 63 byte label budget, which removes the overflow at the source rather than
silently truncating a value operators use to identify the build.

Drops the litellm.chart helper, restores the direct helm.sh/chart printf, and
removes tests/chart_label_tests.yaml. Both chart suites stay green:

  helm unittest -f 'tests/*.yaml' helm/litellm      # 20 passed
  helm unittest -f 'tests/*.yaml' helm/litellm-helm # 69 passed
This commit is contained in:
Yassin Kortam 2026-07-09 20:57:39 +03:00
parent 269ee7e876
commit baba77b5dc
2 changed files with 1 additions and 70 deletions

View file

@ -27,20 +27,11 @@ Common naming + label helpers shared by gateway, backend, and ui templates.
{{- printf "%s-ui" (include "litellm.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Chart label. Kubernetes caps a label value at 63 bytes, and .Chart.Version is
unbounded: CI branch builds version charts as 0.0.0-branch-<branch>-<sha>, which
overflows and makes the API server reject every labeled resource.
*/}}
{{- define "litellm.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "litellm.commonLabels" -}}
app.kubernetes.io/name: {{ include "litellm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "litellm.chart" . }}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" }}
{{- end -}}
{{/*

View file

@ -1,60 +0,0 @@
suite: test helm.sh/chart label stays within the 63 byte kubernetes limit
templates:
- gateway/deployment.yaml
- gateway/configmap.yaml
- backend/deployment.yaml
- ui/deployment.yaml
- migrations-job.yaml
values:
- ./values/required.yaml
tests:
- it: renders the plain chart label for a normal semver version
template: gateway/deployment.yaml
chart:
version: 0.1.0
asserts:
- equal:
path: metadata.labels["helm.sh/chart"]
value: litellm-0.1.0
# CI publishes branch builds as 0.0.0-branch-<branch>-<sha>. Untruncated, the
# label is 64 bytes and the API server rejects every labeled resource with
# "must be no more than 63 bytes", which wedges the whole release.
- it: truncates a long branch-build version to 63 bytes on the gateway
template: gateway/deployment.yaml
chart:
version: 0.0.0-branch-litellm-enterprise-request-metering-f0b217f
asserts:
- equal:
path: metadata.labels["helm.sh/chart"]
value: litellm-0.0.0-branch-litellm-enterprise-request-metering-f0b217
- it: truncates the long version on the migrations job that blocked the sync
template: migrations-job.yaml
chart:
version: 0.0.0-branch-litellm-enterprise-request-metering-f0b217f
asserts:
- equal:
path: metadata.labels["helm.sh/chart"]
value: litellm-0.0.0-branch-litellm-enterprise-request-metering-f0b217
- it: truncates the long version on backend and ui
templates:
- backend/deployment.yaml
- ui/deployment.yaml
chart:
version: 0.0.0-branch-litellm-enterprise-request-metering-f0b217f
asserts:
- equal:
path: metadata.labels["helm.sh/chart"]
value: litellm-0.0.0-branch-litellm-enterprise-request-metering-f0b217
# trunc can land on the separator; a label value may not end in a dash.
- it: never leaves a trailing dash after truncation
template: gateway/deployment.yaml
chart:
version: 0.0.0-branch-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bbb
asserts:
- matchRegex:
path: metadata.labels["helm.sh/chart"]
pattern: "[^-]$"