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>
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
suite: deployment template
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/gitea/deployment.yaml
|
|
- templates/gitea/secret_config.yaml
|
|
tests:
|
|
- it: Render the deployment (default)
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/gitea/deployment.yaml
|
|
- lengthEqual:
|
|
path: spec.template.spec.initContainers
|
|
count: 3
|
|
template: templates/gitea/deployment.yaml
|
|
|
|
- it: Render the deployment (signing)
|
|
set:
|
|
signing.enabled: true
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/gitea/deployment.yaml
|
|
- lengthEqual:
|
|
path: spec.template.spec.initContainers
|
|
count: 4
|
|
template: templates/gitea/deployment.yaml
|
|
|
|
- it: Render the deployment (extraInitContainers)
|
|
set:
|
|
postExtraInitContainers:
|
|
- name: foo
|
|
image: docker.io/library/busybox:latest
|
|
preExtraInitContainers:
|
|
- name: bar
|
|
image: docker.io/library/busybox:latest
|
|
signing.enabled: true
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
template: templates/gitea/deployment.yaml
|
|
- lengthEqual:
|
|
path: spec.template.spec.initContainers
|
|
count: 6
|
|
template: templates/gitea/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.initContainers
|
|
content:
|
|
name: foo
|
|
image: docker.io/library/busybox:latest
|
|
template: templates/gitea/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.initContainers
|
|
content:
|
|
name: bar
|
|
image: docker.io/library/busybox:latest
|
|
template: templates/gitea/deployment.yaml
|