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>
83 lines
2.1 KiB
YAML
83 lines
2.1 KiB
YAML
suite: ServiceAccount template (basic)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/gitea/serviceAccount.yaml
|
|
tests:
|
|
- it: skips rendering by default
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
- it: renders default ServiceAccount object with serviceAccount.create=true
|
|
set:
|
|
serviceAccount.create: true
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- containsDocument:
|
|
kind: ServiceAccount
|
|
apiVersion: v1
|
|
name: gitea-unittests
|
|
- equal:
|
|
path: automountServiceAccountToken
|
|
value: false
|
|
- notExists:
|
|
path: imagePullSecrets
|
|
- notExists:
|
|
path: metadata.annotations
|
|
- it: allows for adding custom labels
|
|
set:
|
|
serviceAccount:
|
|
create: true
|
|
labels:
|
|
custom: label
|
|
asserts:
|
|
- equal:
|
|
path: metadata.labels.custom
|
|
value: label
|
|
- it: allows for adding custom annotations
|
|
set:
|
|
serviceAccount:
|
|
create: true
|
|
annotations:
|
|
myCustom: annotation
|
|
asserts:
|
|
- equal:
|
|
path: metadata.annotations.myCustom
|
|
value: annotation
|
|
- it: allows to override the generated name
|
|
set:
|
|
serviceAccount:
|
|
create: true
|
|
name: provided-serviceaccount-name
|
|
asserts:
|
|
- equal:
|
|
path: metadata.name
|
|
value: provided-serviceaccount-name
|
|
- it: allows to mount the token
|
|
set:
|
|
serviceAccount:
|
|
create: true
|
|
automountServiceAccountToken: true
|
|
asserts:
|
|
- equal:
|
|
path: automountServiceAccountToken
|
|
value: true
|
|
- it: allows to reference image pull secrets
|
|
set:
|
|
serviceAccount:
|
|
create: true
|
|
imagePullSecrets:
|
|
- name: testing-image-pull-secret
|
|
- name: another-pull-secret
|
|
asserts:
|
|
- contains:
|
|
path: imagePullSecrets
|
|
content:
|
|
name: testing-image-pull-secret
|
|
- contains:
|
|
path: imagePullSecrets
|
|
content:
|
|
name: another-pull-secret
|