Skip to content

Commit

Permalink
feat: create v1 Gateway and GatewayClass Version for Traefik v3
Browse files Browse the repository at this point in the history
  • Loading branch information
SantoDE authored Feb 16, 2024
1 parent c07d55c commit 85697f0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions traefik/templates/gateway.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{- if .Values.experimental.kubernetesGateway.enabled }}
---
{{- if semverCompare ">=3.0.0-rc1" (default $.Chart.AppVersion $.Values.image.tag)}}
apiVersion: gateway.networking.k8s.io/v1
{{- else }}
apiVersion: gateway.networking.k8s.io/v1alpha2
{{- end }}
kind: Gateway
metadata:
name: traefik-gateway
Expand Down
4 changes: 4 additions & 0 deletions traefik/templates/gatewayclass.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{- if .Values.experimental.kubernetesGateway.enabled }}
---
{{- if semverCompare ">=3.0.0-rc1" (default $.Chart.AppVersion $.Values.image.tag)}}
apiVersion: gateway.networking.k8s.io/v1
{{- else }}
apiVersion: gateway.networking.k8s.io/v1alpha2
{{- end }}
kind: GatewayClass
metadata:
name: traefik
Expand Down
14 changes: 14 additions & 0 deletions traefik/tests/gateway-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ tests:
kubernetesGateway:
enabled: true
asserts:
- containsDocument:
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1alpha2
- equal:
path: spec.gatewayClassName
value: "traefik"
Expand Down Expand Up @@ -41,6 +44,17 @@ tests:
- equal:
path: spec.listeners[1].allowedRoutes.namespaces.from
value: "All"
- it: should set expected apiVersion with v3 version
set:
image:
tag: 3.0.0-rc1
experimental:
kubernetesGateway:
enabled: true
asserts:
- containsDocument:
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
- it: should have one Gateway with the correct class and an http port as well as an https port
set:
experimental:
Expand Down
14 changes: 14 additions & 0 deletions traefik/tests/gatewayclass-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ tests:
kubernetesGateway:
enabled: true
asserts:
- containsDocument:
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1alpha2
- equal:
path: spec.controllerName
value: traefik.io/gateway-controller
- it: should set expected apiVersion with v3 version
set:
image:
tag: 3.0.0-rc1
experimental:
kubernetesGateway:
enabled: true
asserts:
- containsDocument:
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1

0 comments on commit 85697f0

Please sign in to comment.