feat: Gateway API support, in lieu of Ingress
This commit is contained in:
@@ -471,3 +471,12 @@ https
|
|||||||
{{- define "gitea.metrics-secret-name" -}}
|
{{- define "gitea.metrics-secret-name" -}}
|
||||||
{{ default (printf "%s-metrics-secret" (include "gitea.fullname" .)) }}
|
{{ default (printf "%s-metrics-secret" (include "gitea.fullname" .)) }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Validate that Ingress and Gateway HTTPRoute are not enabled at the same time
|
||||||
|
*/}}
|
||||||
|
{{- define "gitea.validate-ingress-gateway-conflict" -}}
|
||||||
|
{{- if and ((.Values.ingress).enabled) (((.Values.gateway).httpRoute).enabled) -}}
|
||||||
|
{{- fail "You cannot enable both Ingress and HTTPRoute at the same time" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
{{- include "gitea.validate-ingress-gateway-conflict" . }}
|
||||||
|
{{- if .Values.gateway.httpRoute.enabled -}}
|
||||||
|
{{- $fullName := include "gitea.fullname" . -}}
|
||||||
|
{{- $httpPort := .Values.service.http.port -}}
|
||||||
|
apiVersion: gateway.networking.k8s.io/v1
|
||||||
|
kind: HTTPRoute
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "gitea.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.gateway.httpRoute.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
hostnames:
|
||||||
|
{{- range .Values.gateway.httpRoute.hostnames }}
|
||||||
|
- {{ tpl . $ | quote }}
|
||||||
|
{{- end }}
|
||||||
|
parentRefs:
|
||||||
|
{{- range .Values.gateway.httpRoute.parentRefs }}
|
||||||
|
- name: {{ .name | quote }}
|
||||||
|
{{- if .namespace }}
|
||||||
|
namespace: {{ .namespace | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .kind }}
|
||||||
|
kind: {{ .kind | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .group }}
|
||||||
|
group: {{ .group | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .sectionName }}
|
||||||
|
sectionName: {{ .sectionName | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .port }}
|
||||||
|
port: {{ .port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- if .Values.gateway.httpRoute.paths }}
|
||||||
|
{{- range .Values.gateway.httpRoute.paths }}
|
||||||
|
{{- if kindIs "string" . }}
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: {{ default "PathPrefix" $.Values.gateway.httpRoute.pathType }}
|
||||||
|
value: {{ . }}
|
||||||
|
backendRefs:
|
||||||
|
- group: ""
|
||||||
|
kind: Service
|
||||||
|
name: {{ $fullName }}-http
|
||||||
|
namespace: {{ $.Values.namespace | default $.Release.Namespace }}
|
||||||
|
port: {{ $httpPort }}
|
||||||
|
{{- else }}
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: {{ .pathType | default "PathPrefix" }}
|
||||||
|
value: {{ .path | default "/" }}
|
||||||
|
backendRefs:
|
||||||
|
- group: ""
|
||||||
|
kind: Service
|
||||||
|
name: {{ $fullName }}-http
|
||||||
|
namespace: {{ $.Values.namespace | default $.Release.Namespace }}
|
||||||
|
port: {{ $httpPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
- matches:
|
||||||
|
- path:
|
||||||
|
type: PathPrefix
|
||||||
|
value: "/"
|
||||||
|
backendRefs:
|
||||||
|
- group: ""
|
||||||
|
kind: Service
|
||||||
|
name: {{ $fullName }}-http
|
||||||
|
namespace: {{ .Values.namespace | default .Release.Namespace }}
|
||||||
|
port: {{ $httpPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{{- include "gitea.validate-ingress-gateway-conflict" . }}
|
||||||
{{- if .Values.ingress.enabled -}}
|
{{- if .Values.ingress.enabled -}}
|
||||||
{{- $fullName := include "gitea.fullname" . -}}
|
{{- $fullName := include "gitea.fullname" . -}}
|
||||||
{{- $httpPort := .Values.service.http.port -}}
|
{{- $httpPort := .Values.service.http.port -}}
|
||||||
|
|||||||
+21
@@ -177,6 +177,27 @@ ingress:
|
|||||||
# hosts:
|
# hosts:
|
||||||
# - git.example.com
|
# - git.example.com
|
||||||
|
|
||||||
|
## @section Gateway
|
||||||
|
## @param gateway.httpRoute.annotations HTTPRoute annotations
|
||||||
|
## @param gateway.httpRoute.hostnames HTTPRoute hostnames
|
||||||
|
## @param gateway.httpRoute.parentRefs HTTPRoute parentRefs
|
||||||
|
## @param gateway.httpRoute.pathType HTTPRoute path match type (PathPrefix, Exact, RegularExpression)
|
||||||
|
## @param gateway.httpRoute.paths[0].path Default HTTPRoute path
|
||||||
|
gateway:
|
||||||
|
httpRoute:
|
||||||
|
enabled: false
|
||||||
|
annotations: {}
|
||||||
|
hostnames:
|
||||||
|
- git.example.com
|
||||||
|
parentRefs:
|
||||||
|
- name: traefik
|
||||||
|
sectionName: https
|
||||||
|
kind: Gateway
|
||||||
|
pathType: PathPrefix
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
|
||||||
|
|
||||||
## @section deployment
|
## @section deployment
|
||||||
#
|
#
|
||||||
## @param resources Kubernetes resources
|
## @param resources Kubernetes resources
|
||||||
|
|||||||
Reference in New Issue
Block a user