2 Commits

Author SHA1 Message Date
williamp 0758422402 add unit tests for gateway api 2026-07-04 12:20:55 -04:00
williamp f5421dd332 add new values to README 2026-07-04 12:14:44 -04:00
6 changed files with 180 additions and 4 deletions
+16 -3
View File
@@ -948,7 +948,7 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `global.imagePullSecrets` | global image pull secrets override; can be extended by `imagePullSecrets` | `[]` | | `global.imagePullSecrets` | global image pull secrets override; can be extended by `imagePullSecrets` | `[]` |
| `global.storageClass` | global storage class override | `""` | | `global.storageClass` | global storage class override | `""` |
| `global.hostAliases` | global hostAliases which will be added to the pod's hosts files | `[]` | | `global.hostAliases` | global hostAliases which will be added to the pod's hosts files | `[]` |
| `namespace` | An explicit namespace to deploy Gitea into. Defaults to the release namespace if not specified | `""` | | `namespace` | An explicit namespace to deploy gitea into. Defaults to the release namespace if not specified | `""` |
| `replicaCount` | number of replicas for the deployment | `1` | | `replicaCount` | number of replicas for the deployment | `1` |
### strategy ### strategy
@@ -1026,6 +1026,19 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `ingress.hosts[0].paths[0].path` | Default Ingress path | `/` | | `ingress.hosts[0].paths[0].path` | Default Ingress path | `/` |
| `ingress.tls` | Ingress tls settings | `[]` | | `ingress.tls` | Ingress tls settings | `[]` |
### Gateway
| Name | Description | Value |
| --------------------------------------------- | ---------------------------------------------------------------- | --------------------- |
| `gateway.httpRoute.enabled` | Enable HTTPRoute | `false` |
| `gateway.httpRoute.annotations` | HTTPRoute annotations | `{}` |
| `gateway.httpRoute.hostnames` | HTTPRoute hostnames | `["git.example.com"]` |
| `gateway.httpRoute.parentRefs[0].name` | HTTPRoute Gateway name | `traefik` |
| `gateway.httpRoute.parentRefs[0].sectionName` | HTTPRoute Gateway section name | `https` |
| `gateway.httpRoute.parentRefs[0].kind` | HTTPRoute Gateway kind | `Gateway` |
| `gateway.httpRoute.pathType` | HTTPRoute path match type (PathPrefix, Exact, RegularExpression) | `PathPrefix` |
| `gateway.httpRoute.paths[0].path` | Default HTTPRoute path | `/` |
### deployment ### deployment
| Name | Description | Value | | Name | Description | Value |
@@ -1070,8 +1083,8 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `persistence.subPath` | Subdirectory of the volume to mount at | `nil` | | `persistence.subPath` | Subdirectory of the volume to mount at | `nil` |
| `persistence.volumeName` | Name of persistent volume in PVC | `""` | | `persistence.volumeName` | Name of persistent volume in PVC | `""` |
| `extraContainers` | Additional sidecar containers to run in the pod | `[]` | | `extraContainers` | Additional sidecar containers to run in the pod | `[]` |
| `preExtraInitContainers` | Additional init containers to run in the pod before Gitea runs it owns init containers. | `[]` | | `preExtraInitContainers` | Additional init containers to run in the pod before gitea runs it owns init containers. | `[]` |
| `postExtraInitContainers` | Additional init containers to run in the pod after Gitea runs it owns init containers. | `[]` | | `postExtraInitContainers` | Additional init containers to run in the pod after gitea runs it owns init containers. | `[]` |
| `extraVolumes` | Additional volumes to mount to the Gitea deployment | `[]` | | `extraVolumes` | Additional volumes to mount to the Gitea deployment | `[]` |
| `extraContainerVolumeMounts` | Mounts that are only mapped into the Gitea runtime/main container, to e.g. override custom templates. | `[]` | | `extraContainerVolumeMounts` | Mounts that are only mapped into the Gitea runtime/main container, to e.g. override custom templates. | `[]` |
| `extraInitVolumeMounts` | Mounts that are only mapped into the init-containers. Can be used for additional preconfiguration. | `[]` | | `extraInitVolumeMounts` | Mounts that are only mapped into the init-containers. Can be used for additional preconfiguration. | `[]` |
+74
View File
@@ -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"
@@ -0,0 +1,19 @@
suite: Test httproute with implicit path defaults
templates:
- templates/gitea/httproute.yaml
tests:
- it: should use default path and pathType when no paths are specified
set:
gateway.httpRoute.enabled: true
gateway.httpRoute.paths: []
asserts:
- hasDocuments:
count: 1
- isKind:
of: HTTPRoute
- equal:
path: spec.rules[0].matches[0].path.type
value: "PathPrefix"
- equal:
path: spec.rules[0].matches[0].path.value
value: "/"
@@ -0,0 +1,56 @@
suite: Test httproute with structured paths
templates:
- templates/gitea/httproute.yaml
tests:
- it: should work with a plain string path
set:
gateway.httpRoute.enabled: true
gateway.httpRoute.paths:
- /
asserts:
- hasDocuments:
count: 1
- isKind:
of: HTTPRoute
- equal:
path: spec.rules[0].matches[0].path.type
value: "PathPrefix"
- equal:
path: spec.rules[0].matches[0].path.value
value: "/"
- it: should work with structured path definitions and per-path pathType
set:
gateway.httpRoute.enabled: true
gateway.httpRoute.paths:
- path: /
- path: /foo
pathType: Exact
asserts:
- hasDocuments:
count: 1
- isKind:
of: HTTPRoute
- 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[1].matches[0].path.type
value: "Exact"
- equal:
path: spec.rules[1].matches[0].path.value
value: "/foo"
- it: should allow overriding the default pathType
set:
gateway.httpRoute.enabled: true
gateway.httpRoute.pathType: Exact
gateway.httpRoute.paths:
- /
asserts:
- equal:
path: spec.rules[0].matches[0].path.type
value: "Exact"
@@ -12,3 +12,14 @@ tests:
asserts: asserts:
- failedTemplate: - failedTemplate:
errorMessage: valkey and valkey-cluster cannot be enabled at the same time. Please only choose one. errorMessage: valkey and valkey-cluster cannot be enabled at the same time. Please only choose one.
- it: fails when trying to enable ingress and gateway httpRoute at the same time
set:
ingress:
enabled: true
gateway:
httpRoute:
enabled: true
asserts:
- failedTemplate:
errorMessage: You cannot enable both Ingress and HTTPRoute at the same time
+4 -1
View File
@@ -178,9 +178,12 @@ ingress:
# - git.example.com # - git.example.com
## @section Gateway ## @section Gateway
## @param gateway.httpRoute.enabled Enable HTTPRoute
## @param gateway.httpRoute.annotations HTTPRoute annotations ## @param gateway.httpRoute.annotations HTTPRoute annotations
## @param gateway.httpRoute.hostnames HTTPRoute hostnames ## @param gateway.httpRoute.hostnames HTTPRoute hostnames
## @param gateway.httpRoute.parentRefs HTTPRoute parentRefs ## @param gateway.httpRoute.parentRefs[0].name HTTPRoute Gateway name
## @param gateway.httpRoute.parentRefs[0].sectionName HTTPRoute Gateway section name
## @param gateway.httpRoute.parentRefs[0].kind HTTPRoute Gateway kind
## @param gateway.httpRoute.pathType HTTPRoute path match type (PathPrefix, Exact, RegularExpression) ## @param gateway.httpRoute.pathType HTTPRoute path match type (PathPrefix, Exact, RegularExpression)
## @param gateway.httpRoute.paths[0].path Default HTTPRoute path ## @param gateway.httpRoute.paths[0].path Default HTTPRoute path
gateway: gateway: