Skip to content

Commit 97a1c71

Browse files
author
Campbell Pool
committed
feat(labels): add gateway.selectorLabels with component label
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.
1 parent 4b9c3c0 commit 97a1c71

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

charts/portkey-gateway/templates/_helpers.tpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,22 @@ app.kubernetes.io/instance: {{ .Release.Name }}
5252
{{- end }}
5353
{{- end }}
5454

55+
{{/*
56+
Gateway selector labels — adds component label for pod metadata and Service
57+
selectors. Deployment matchLabels uses portkeyenterprise.selectorLabels
58+
(without component) to avoid requiring Deployment recreation on upgrade.
59+
*/}}
60+
{{- define "gateway.selectorLabels" -}}
61+
{{ include "portkeyenterprise.selectorLabels" . }}
62+
app.kubernetes.io/component: gateway
63+
{{- end }}
64+
5565
{{/*
5666
Gateway labels
5767
*/}}
5868
{{- define "gateway.labels" -}}
5969
{{- include "portkeyenterprise.labels" . | nindent 4 }}
60-
{{- include "portkeyenterprise.selectorLabels" . | nindent 4 }}
70+
{{- include "gateway.selectorLabels" . | nindent 4 }}
6171
{{- end }}
6272

6373
{{/*

charts/portkey-gateway/templates/gateway/service.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
name: mcp
2424
{{- end }}
2525
selector:
26-
{{- include "portkeyenterprise.selectorLabels" . | nindent 4 }}
26+
{{- include "gateway.selectorLabels" . | nindent 4 }}
2727
---
2828
{{- if and .Values.mcpService.enabled (eq (include "mcp.enabled" .) "true") }}
2929
apiVersion: v1
@@ -47,5 +47,5 @@ spec:
4747
protocol: TCP
4848
name: mcp
4949
selector:
50-
{{- include "portkeyenterprise.selectorLabels" . | nindent 4 }}
50+
{{- include "gateway.selectorLabels" . | nindent 4 }}
5151
{{- end }}

0 commit comments

Comments
 (0)