feat(labels): add gateway.selectorLabels with component label#171
feat(labels): add gateway.selectorLabels with component label#171camjay wants to merge 2 commits intoPortkey-AI:mainfrom
Conversation
Add gateway.selectorLabels helper with app.kubernetes.io/component: gateway, matching the existing dataservice.selectorLabels pattern. Applied to pod labels and Service selectors (both mutable). Deployment matchLabels left unchanged to avoid requiring recreation. Users who want it in matchLabels can use .Values.selectorLabels. Note: the Service selector now includes component: gateway. During upgrade from a previous version, old pods lack this label and won't receive traffic until new pods are ready. Use maxSurge: 100% or blue-green deploy to avoid downtime on first upgrade.
a1f053a to
97a1c71
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the portkey-gateway Helm chart labeling helpers so the gateway Service selector (and gateway pod labels) include app.kubernetes.io/component: gateway, aligning with the existing dataservice selector-label pattern while avoiding changes to the Deployment’s immutable matchLabels.
Changes:
- Add a new
gateway.selectorLabelshelper that composesportkeyenterprise.selectorLabelsand a fixedapp.kubernetes.io/component: gatewaylabel. - Update gateway Services to use
gateway.selectorLabelsinstead ofportkeyenterprise.selectorLabels. - Update
gateway.labelsto includegateway.selectorLabelsso gateway pods receive the new component label.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| charts/portkey-gateway/templates/gateway/service.yaml | Switch Service selectors (including MCP Service) to gateway.selectorLabels so Services select gateway pods via the component label. |
| charts/portkey-gateway/templates/_helpers.tpl | Introduce gateway.selectorLabels and wire it into gateway.labels so pod labels match the updated Service selectors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks for the PR and the thorough write-up on upgrade impact — it's clear you've thought this through carefully. That said, I'm going to hold off on merging this as-is. The core concern is that this changes the Service selector for all existing installs, which means every upgrade hits a traffic interruption regardless of whether the user needs the tighter selector. The mitigations (maxSurge, blue-green) put the burden on operators to work around a change they didn't ask for. The existing .Values.selectorLabels hook already lets users add app.kubernetes.io/component: gateway today if they need selector precision — no chart change required. If there's appetite for a more ergonomic path, I'd be open to a PR that adds a gateway.deployment.selectorLabels values key (mirroring what dataservice does), but defaulting to empty so existing installs are unaffected. That way users can opt in when they're ready rather than having it forced on upgrade. Appreciate the contribution — happy to discuss if you see a use case that .Values.selectorLabels doesn't cover. |
Adds a
gateway.selectorLabelshelper withapp.kubernetes.io/component: gateway, matching the existingdataservice.selectorLabelspattern. Applied to pod labels and Service selectors (both mutable).Deployment
matchLabelsleft unchanged to avoid requiring Deployment recreation. Users who want the component label inmatchLabelscan opt in via.Values.selectorLabels.Upgrade impact
The gateway Service selector gains
app.kubernetes.io/component: gateway. Old pods (from the previous chart version) don't have this label in their metadata. During a rolling update:component: gatewayMitigations:
strategy.rollingUpdate.maxSurge: 100%so new pods start before old ones terminateSubsequent upgrades are unaffected — all pods will have the label.
This trade-off mirrors what already happened with
dataservice.selectorLabels, which includesapp.kubernetes.io/componentin both Service selectors and Deployment matchLabels. The gateway version is intentionally less disruptive (Service only, not matchLabels).See also #173 which adds CI to validate chart templates on PRs.