Skip to content

Commit 7e76fb4

Browse files
somaz94dpage
authored andcommitted
Add Gateway API HTTPRoute support to the Helm chart (pgadmin-org#10095)
Add an opt-in Gateway API HTTPRoute template to the Helm chart as an alternative to the existing Ingress, addressing pgadmin-org#9942. It is disabled by default (httpRoute.enabled: false) so existing installs are unaffected. The template mirrors the existing ingress.yaml conventions: the pgadmin4.fullname backend, commonLabels/commonAnnotations propagation, and a hostname that falls back to ingress.hostname when httpRoute.hostnames is unset. parentRefs is required (a fail guard fires when it is empty), apiVersion defaults to gateway.networking.k8s.io/v1, and the default rule forwards "/" (PathPrefix) to the pgAdmin service. Custom hostnames and rules can be supplied for full control. The new values are documented in the chart README.
1 parent 0c6740f commit 7e76fb4

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

pkg/helm/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ The chart should dump its version and appVersion in the Chart.yaml file every re
4040
| `ingress.enabled` | Ingress resource creation | `false` |
4141
| `ingress.hostname` | Ingress resource hostname | `"pgadmin4.local"` |
4242
| `ingress.tlsSecret` | Ingress tls secret name | `""` |
43+
| `httpRoute.enabled` | Gateway API HTTPRoute resource creation | `false` |
44+
| `httpRoute.apiVersion` | HTTPRoute apiVersion (override for v1beta1 implementations) | `"gateway.networking.k8s.io/v1"` |
45+
| `httpRoute.parentRefs` | Gateway(s) the route attaches to (required when `httpRoute.enabled` is true) | `[]` |
46+
| `httpRoute.hostnames` | HTTPRoute hostnames (falls back to `ingress.hostname` when empty) | `[]` |
47+
| `httpRoute.annotations` | HTTPRoute annotations | `{}` |
48+
| `httpRoute.rules` | Custom routing rules (defaults to a single `/` PathPrefix rule to the service) | `[]` |
4349
| `strategy.type` | Deployment strategy type (RollingUpdate or Recreate) | Kubernetes default (RollingUpdate) |
4450
| `strategy.rollingUpdate.maxSurge` | Maximum number of pods that can be created over the desired replicas | Kubernetes default (25%) |
4551
| `strategy.rollingUpdate.maxUnavailable` | Maximum number of pods that can be unavailable during the update | Kubernetes default (25%) |

pkg/helm/templates/httproute.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- if .Values.httpRoute.enabled }}
2+
{{- if not .Values.httpRoute.parentRefs }}
3+
{{- fail "httpRoute.parentRefs must be set when httpRoute.enabled is true" }}
4+
{{- end }}
5+
apiVersion: {{ .Values.httpRoute.apiVersion | default "gateway.networking.k8s.io/v1" }}
6+
kind: HTTPRoute
7+
metadata:
8+
name: {{ template "pgadmin4.fullname" . }}
9+
{{- with .Values.commonLabels }}
10+
labels: {{ . | toYaml | nindent 4 }}
11+
{{- end }}
12+
{{- if or .Values.httpRoute.annotations .Values.commonAnnotations }}
13+
annotations: {{ merge .Values.httpRoute.annotations .Values.commonAnnotations | toYaml | nindent 4 }}
14+
{{- end }}
15+
spec:
16+
parentRefs: {{- toYaml .Values.httpRoute.parentRefs | nindent 4 }}
17+
{{- $hostnames := .Values.httpRoute.hostnames }}
18+
{{- if and (not $hostnames) .Values.ingress.hostname }}
19+
{{- $hostnames = list (tpl .Values.ingress.hostname .) }}
20+
{{- end }}
21+
{{- with $hostnames }}
22+
hostnames: {{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
rules:
25+
{{- if .Values.httpRoute.rules }}
26+
{{- toYaml .Values.httpRoute.rules | nindent 4 }}
27+
{{- else }}
28+
- matches:
29+
- path:
30+
type: PathPrefix
31+
value: /
32+
backendRefs:
33+
- name: {{ template "pgadmin4.fullname" . }}
34+
port: {{ .Values.service.port }}
35+
{{- end }}
36+
{{- end }}

pkg/helm/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,25 @@ ingress:
106106
annotations: {}
107107
# If set, enables TLS configuration in the Ingress resource.
108108
tlsSecret: ""
109+
httpRoute:
110+
# Enable a Gateway API HTTPRoute as an alternative to the Ingress above.
111+
enabled: false
112+
# apiVersion for the HTTPRoute resource. Override if your Gateway API
113+
# implementation still serves the resource under v1beta1.
114+
apiVersion: gateway.networking.k8s.io/v1
115+
# parentRefs is required when httpRoute.enabled is true. It references the
116+
# Gateway (and optionally a listener) that should route to pgAdmin.
117+
parentRefs: []
118+
# - name: my-gateway
119+
# namespace: gateway-system
120+
# sectionName: https
121+
# hostnames for the route. When empty, falls back to ingress.hostname.
122+
hostnames: []
123+
# - pgadmin4.example.com
124+
annotations: {}
125+
# Custom routing rules. When empty, a single rule forwards all traffic
126+
# ("/" PathPrefix) to the pgAdmin service.
127+
rules: []
109128
startupProbe:
110129
enabled: false
111130
httpGet:

0 commit comments

Comments
 (0)