The files in templates/gitea/ used a mix of naming styles: lowercase concatenations (poddisruptionbudget.yaml, serviceaccount.yaml, servicemonitor.yaml, pvc.yaml), camelCase (httpService.yaml, sshService.yaml) and kind-suffixed names (gpg-secret.yaml, metrics-secret.yaml). It was therefore not obvious from a file name which Kubernetes resource it renders, and the naming contradicted the camelCase convention the Gateway API templates already follow. Files are now named after the kind they render, with a lowercase suffix distinguishing several resources of the same kind: config.yaml -> secret_config.yaml + secret_inlineConfig.yaml gpg-secret.yaml -> secret_gpg.yaml init.yaml -> secret_init.yaml metrics-secret.yaml -> secret_metrics.yaml httpService.yaml -> service_http.yaml sshService.yaml -> service_ssh.yaml poddisruptionbudget.yaml -> podDisruptionBudget.yaml pvc.yaml -> persistentVolumeClaim.yaml serviceaccount.yaml -> serviceAccount.yaml servicemonitor.yaml -> serviceMonitor.yaml config.yaml rendered two Secrets from a single file, which forced every unit test to address them via documentIndex. It is split so that each file renders exactly one resource. The rendered manifests are unchanged; only file names and the references to them were touched. This includes the checksum/config annotation in deployment.yaml and all helm unit test suites. The HA guard assertions had to move from deployment.yaml to secret_config.yaml: Helm sorts templates in reverse alphabetical order, so secret_config.yaml is now rendered before deployment.yaml and the fail() is reported for that file directly instead of bubbling up through the include chain of the Deployment. Users relying on the template paths (e.g. `helm template --show-only` or post-renderers) have to adjust to the new file names. Co-authored-by: Copilot <copilot@github.com>
159 lines
4.6 KiB
YAML
159 lines
4.6 KiB
YAML
suite: config template | server section (domain related)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
tests:
|
|
- it: "[default values] uses ingress host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nDOMAIN=git.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nSSH_DOMAIN=git.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=http://git.example.com
|
|
|
|
################################################
|
|
|
|
- it: "[no ingress hosts] uses gitea http service for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
ingress:
|
|
hosts: []
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nDOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nSSH_DOMAIN=gitea-unittests-http.testing.svc.cluster.local
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=http://gitea-unittests-http.testing.svc.cluster.local
|
|
|
|
################################################
|
|
|
|
- it: "[provided via values] uses that for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
gitea.config.server.DOMAIN: provided.example.com
|
|
ingress:
|
|
hosts:
|
|
- host: non-used.example.com
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nDOMAIN=provided.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nSSH_DOMAIN=provided.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=http://provided.example.com
|
|
|
|
################################################
|
|
|
|
- it: "[route enabled] uses route host for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
route:
|
|
enabled: true
|
|
host: route.example.com
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nDOMAIN=route.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nSSH_DOMAIN=route.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=http://route.example.com
|
|
|
|
################################################
|
|
|
|
- it: "[route tls termination] uses https for ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
route:
|
|
enabled: true
|
|
host: route.example.com
|
|
tls:
|
|
termination: edge
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=https://route.example.com
|
|
|
|
################################################
|
|
|
|
- it: "[HTTPRoute enabled] uses first hostname for DOMAIN|SSH_DOMAIN|ROOT_URL"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
ingress:
|
|
hosts: []
|
|
gatewayAPI:
|
|
enabled: true
|
|
core:
|
|
httpRoute:
|
|
enabled: true
|
|
hostnames:
|
|
- gw.example.com
|
|
parentRefs:
|
|
- name: shared-gateway
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nDOMAIN=gw.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nSSH_DOMAIN=gw.example.com
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=http://gw.example.com
|
|
|
|
################################################
|
|
|
|
- it: "[HTTPRoute tls] switches ROOT_URL to https"
|
|
template: templates/gitea/secret_inlineConfig.yaml
|
|
set:
|
|
ingress:
|
|
hosts: []
|
|
gatewayAPI:
|
|
enabled: true
|
|
core:
|
|
httpRoute:
|
|
enabled: true
|
|
tls: true
|
|
hostnames:
|
|
- gw.example.com
|
|
parentRefs:
|
|
- name: shared-gateway
|
|
asserts:
|
|
- documentIndex: 0
|
|
matchRegex:
|
|
path: stringData.server
|
|
pattern: \nROOT_URL=https://gw.example.com
|