fix: propagate commonLabels to kgateway controller pod template #14507
Pull request overview
This PR fixes the kgateway Helm chart so that user-specified commonLabels also apply to the controller Deployment’s pod template labels (spec.template.metadata.labels), ensuring the labels reach the running controller pods while keeping selector labels unchanged (and therefore upgrade-safe).
Changes:
.Values.commonLabels into the controller pod template labels in install/helm/kgateway/templates/deployment.yaml.Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
| ---- | ----------- |
| install/helm/kgateway/templates/deployment.yaml | Propagates commonLabels into the controller pod template labels without affecting immutable selector labels. |
| test/helm/testdata/kgateway/additional-labels.golden | Updates expected rendered manifests to include the extra labels on the controller pod template. |
Approved these changes.
ymesika
puertomontt
Description
The Helm chart's
commonLabelsvalue is documented as applying to "all resources created by the Helm chart," and it is already merged into every resource's ownmetadata.labelsvia thekgateway.labelshelper (Deployment, Service, ServiceAccount, PodDisruptionBudget, etc.). However, the controller Deployment's pod template labels (spec.template.metadata.labels) were built only fromkgateway.selectorLabelsplus a hardcodedapp.kubernetes.io/component: controller, socommonLabelsnever reached the running controller pods.This change adds
commonLabelsto the pod template labels, keeping it separate fromselectorLabels(which also backs the immutablespec.selector.matchLabels, so it must stay stable across upgrades).Fixes #14503
Change type
/kind fix
Changelog
``
release-notecommonLabelsCustom labels set via the Helm chart's
value now propagate to the kgateway controller's pod template, in addition to the Deployment's own metadata.
`Additional notes
golden test intest/helm/testdata/kgateway/(REFRESH_GOLDEN=true go test -run TestHelmChartTemplate ./test/helm/...); it was the only golden file affected.and the fullgo test ./test/helm/...` suite.