From f21369c34db17a844ec2df03ef65010df9de785f Mon Sep 17 00:00:00 2001 From: olalekan odukoya Date: Wed, 25 Feb 2026 12:45:46 +0100 Subject: [PATCH] add GatewayAPI support --- README.md | 6 ++++ charts/server/templates/gateway.yaml | 21 +++++++++++++ charts/server/templates/httproute.yaml | 42 ++++++++++++++++++++++++++ charts/server/values.yaml | 21 +++++++++++++ values.yaml | 21 +++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 charts/server/templates/gateway.yaml create mode 100644 charts/server/templates/httproute.yaml diff --git a/README.md b/README.md index bdb8f00..48afe22 100755 --- a/README.md +++ b/README.md @@ -244,6 +244,12 @@ helm install convoy . | server.env.storage.s3.secretKey | string | `""` | Ignored in case of secret parameter with non-empty value | | server.env.storage.s3.session_token | string | `""` | | | server.env.storage.type | string | `""` | | +| server.gateway.annotations | object | `{}` | Annotations for the HTTPRoute | +| server.gateway.create | bool | `false` | Whether to create a Gateway resource | +| server.gateway.enabled | bool | `false` | Enable Gateway API for the server | +| server.gateway.hostnames | list | `["test.com"]` | Hostnames for the HTTPRoute | +| server.gateway.parentRefs | list | `[{"name":"convoy-gateway","namespace":"gateway-system"}]` | Parent refs for the HTTPRoute (e.g., the Gateway) | +| server.gateway.rules | list | `[{"matches":[{"path":{"type":"PathPrefix","value":"/"}}]}]` | Rules for the HTTPRoute | | server.image.pullPolicy | string | `"IfNotPresent"` | Pull policy for the server image | | server.image.repository | string | `"getconvoy/convoy"` | Repository to be used by the server. The latest tag is used by default | | server.ingress.annotations | object | `{}` | | diff --git a/charts/server/templates/gateway.yaml b/charts/server/templates/gateway.yaml new file mode 100644 index 0000000..da9834a --- /dev/null +++ b/charts/server/templates/gateway.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.gateway.enabled .Values.gateway.create -}} +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: {{ include "convoy-server.fullname" . }} + labels: + {{- include "convoy-server.labels" . | nindent 4 }} + {{- with .Values.gateway.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + gatewayClassName: {{ .Values.gateway.gatewayClassName | default "convoy-gateway-class" }} + listeners: + - name: http + port: 80 + protocol: HTTP + allowedRoutes: + namespaces: + from: Same +{{- end }} diff --git a/charts/server/templates/httproute.yaml b/charts/server/templates/httproute.yaml new file mode 100644 index 0000000..1bec659 --- /dev/null +++ b/charts/server/templates/httproute.yaml @@ -0,0 +1,42 @@ +{{- if .Values.gateway.enabled -}} +{{- if and .Values.ingress.enabled .Values.gateway.enabled -}} +{{- fail "Both ingress and gateway are enabled. Please enable only one." -}} +{{- end -}} +{{- $fullName := include "convoy-server.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: {{ $fullName }} + labels: + {{- include "convoy-server.labels" . | nindent 4 }} + {{- with .Values.gateway.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.gateway.parentRefs }} + parentRefs: + {{- toYaml .Values.gateway.parentRefs | nindent 4 }} + {{- end }} + {{- if .Values.gateway.hostnames }} + hostnames: + {{- range .Values.gateway.hostnames }} + - {{ . | quote }} + {{- end }} + {{- end }} + rules: + {{- range .Values.gateway.rules }} + - backendRefs: + - name: {{ $fullName }} + port: {{ $svcPort }} + {{- if .matches }} + matches: + {{- toYaml .matches | nindent 8 }} + {{- end }} + {{- if .filters }} + filters: + {{- toYaml .filters | nindent 8 }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/server/values.yaml b/charts/server/values.yaml index d185747..58856ec 100755 --- a/charts/server/values.yaml +++ b/charts/server/values.yaml @@ -177,6 +177,27 @@ ingress: - path: / pathType: Prefix +gateway: + # -- Enable Gateway API for the server + enabled: false + # -- Whether to create a Gateway resource + create: false + # -- Annotations for the HTTPRoute + annotations: {} + # -- Hostnames for the HTTPRoute + hostnames: + - test.com + # -- Parent refs for the HTTPRoute (e.g., the Gateway) + parentRefs: + - name: convoy-gateway + # namespace: gateway-system + # -- Rules for the HTTPRoute + rules: + - matches: + - path: + type: PathPrefix + value: / + autoscaling: enabled: true minReplicas: 1 diff --git a/values.yaml b/values.yaml index a434141..4ba2e46 100755 --- a/values.yaml +++ b/values.yaml @@ -406,6 +406,27 @@ server: - path: / pathType: Prefix + gateway: + # -- Enable Gateway API for the server + enabled: false + # -- Whether to create a Gateway resource + create: false + # -- Annotations for the HTTPRoute + annotations: {} + # -- Hostnames for the HTTPRoute + hostnames: + - test.com + # -- Parent refs for the HTTPRoute (e.g., the Gateway) + parentRefs: + - name: convoy-gateway + namespace: gateway-system + # -- Rules for the HTTPRoute + rules: + - matches: + - path: + type: PathPrefix + value: / + service: # -- Type of service for the server type: ClusterIP