Skip to content

Commit 742f9a7

Browse files
authored
Add HTTPRoute (Gateway API) support to API server in Helm Chart (#67675)
* Add HTTPRoute (Gateway API) support to API server in Helm Chart * Fix HTTPRoute helm tests by vendoring Gateway API CRD schema * Remove deprecated httpRoute.enabled toggle and fix static checks
1 parent 0ec51a9 commit 742f9a7

8 files changed

Lines changed: 5986 additions & 1 deletion

File tree

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ repos:
391391
^.*init_git_sync\.template\.yaml$|
392392
^chart/(?:templates|files)/.*\.yaml$|
393393
^chart/tests/chart_utils/keda.sh_scaledobjects\.yaml$|
394+
^chart/tests/chart_utils/gateway.networking.k8s.io_httproutes\.yaml$|
394395
.*/v1.*\.yaml$|
395396
^.*openapi.*\.yaml$|
396397
^\.pre-commit-config\.yaml$|

‎chart/docs/production-guide.rst‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,30 @@ You can create and configure ``Ingress`` objects. See the :ref:`Ingress chart pa
390390
For more information on ``Ingress``, see the
391391
`Kubernetes Ingress documentation <https://kubernetes.io/docs/concepts/services-networking/ingress/>`_.
392392

393+
Gateway API (HTTPRoute)
394+
^^^^^^^^^^^^^^^^^^^^^^^
395+
396+
As an alternative to ``Ingress``, the chart can create a
397+
`Kubernetes Gateway API <https://gateway-api.sigs.k8s.io/>`_ ``HTTPRoute`` for the API server.
398+
This requires the Gateway API CRDs to be installed in the cluster and a ``Gateway`` to already exist —
399+
the chart only creates the ``HTTPRoute`` and attaches it to the Gateway via ``parentRefs``.
400+
401+
.. code-block:: yaml
402+
:caption: values.yaml
403+
404+
httpRoute:
405+
apiServer:
406+
enabled: true
407+
parentRefs:
408+
- name: main-gateway
409+
namespace: gateway-system
410+
sectionName: https
411+
hostnames:
412+
- airflow.example.com
413+
414+
For fine-grained routing, supply ``httpRoute.apiServer.rules`` directly — the entry mirrors the
415+
upstream ``HTTPRouteRule`` schema and overrides the default rule generated from ``path`` + ``pathType``.
416+
393417
LoadBalancer Service
394418
^^^^^^^^^^^^^^^^^^^^
395419

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/}}
19+
20+
##################################
21+
## Airflow API Server HTTPRoute
22+
##################################
23+
{{- if and .Values.apiServer.enabled .Values.httpRoute.apiServer.enabled }}
24+
{{- $fullname := include "airflow.fullname" . }}
25+
apiVersion: gateway.networking.k8s.io/v1
26+
kind: HTTPRoute
27+
metadata:
28+
name: {{ $fullname }}-api-server-httproute
29+
labels:
30+
tier: airflow
31+
component: airflow-api-server-httproute
32+
release: {{ .Release.Name }}
33+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
34+
heritage: {{ .Release.Service }}
35+
{{- if or .Values.labels .Values.apiServer.labels .Values.httpRoute.apiServer.labels }}
36+
{{- mustMerge .Values.httpRoute.apiServer.labels .Values.apiServer.labels .Values.labels | toYaml | nindent 4 }}
37+
{{- end }}
38+
{{- with .Values.httpRoute.apiServer.annotations }}
39+
annotations: {{- toYaml . | nindent 4 }}
40+
{{- end }}
41+
spec:
42+
parentRefs: {{- toYaml .Values.httpRoute.apiServer.parentRefs | nindent 4 }}
43+
{{- with .Values.httpRoute.apiServer.hostnames }}
44+
hostnames:
45+
{{- range . }}
46+
- {{ tpl . $ | quote }}
47+
{{- end }}
48+
{{- end }}
49+
rules:
50+
{{- if .Values.httpRoute.apiServer.rules }}
51+
{{- toYaml .Values.httpRoute.apiServer.rules | nindent 4 }}
52+
{{- else }}
53+
- matches:
54+
- path:
55+
type: {{ .Values.httpRoute.apiServer.pathType }}
56+
value: {{ .Values.httpRoute.apiServer.path | quote }}
57+
backendRefs:
58+
- name: {{ $fullname }}-api-server
59+
port: {{ .Values.ports.apiServer }}
60+
{{- end }}
61+
{{- end }}

0 commit comments

Comments
 (0)