feat: Gateway API support, in lieu of Ingress
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
suite: Test httproute.yaml
|
||||
templates:
|
||||
- templates/gitea/httproute.yaml
|
||||
tests:
|
||||
- it: should enable httproute when gateway.httpRoute.enabled is true
|
||||
set:
|
||||
gateway.httpRoute.enabled: true
|
||||
gateway.httpRoute.annotations:
|
||||
some-annotation: some-value
|
||||
gateway.httpRoute.hostnames:
|
||||
- example.com
|
||||
gateway.httpRoute.parentRefs:
|
||||
- name: traefik
|
||||
sectionName: https
|
||||
kind: Gateway
|
||||
gateway.httpRoute.paths:
|
||||
- path: /
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- isKind:
|
||||
of: HTTPRoute
|
||||
- isAPIVersion:
|
||||
of: gateway.networking.k8s.io/v1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-gitea
|
||||
- equal:
|
||||
path: metadata.annotations["some-annotation"]
|
||||
value: some-value
|
||||
- equal:
|
||||
path: spec.hostnames[0]
|
||||
value: "example.com"
|
||||
- equal:
|
||||
path: spec.parentRefs[0].name
|
||||
value: "traefik"
|
||||
- equal:
|
||||
path: spec.parentRefs[0].kind
|
||||
value: "Gateway"
|
||||
- equal:
|
||||
path: spec.parentRefs[0].sectionName
|
||||
value: "https"
|
||||
- equal:
|
||||
path: spec.rules[0].matches[0].path.type
|
||||
value: "PathPrefix"
|
||||
- equal:
|
||||
path: spec.rules[0].matches[0].path.value
|
||||
value: "/"
|
||||
- equal:
|
||||
path: spec.rules[0].backendRefs[0].name
|
||||
value: "RELEASE-NAME-gitea-http"
|
||||
- equal:
|
||||
path: spec.rules[0].backendRefs[0].port
|
||||
value: 3000
|
||||
|
||||
- it: should not create httproute when gateway.httpRoute.enabled is false
|
||||
set:
|
||||
gateway.httpRoute.enabled: false
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 0
|
||||
|
||||
- it: hostname using TPL
|
||||
set:
|
||||
global.giteaHostName: "gitea.example.com"
|
||||
gateway.httpRoute.enabled: true
|
||||
gateway.httpRoute.hostnames:
|
||||
- "{{ .Values.global.giteaHostName }}"
|
||||
asserts:
|
||||
- isKind:
|
||||
of: HTTPRoute
|
||||
- equal:
|
||||
path: spec.hostnames[0]
|
||||
value: "gitea.example.com"
|
||||
Reference in New Issue
Block a user