The `templates/gitea` subdirectory did not group anything meaningful, since every template of this chart belongs to Gitea. It only duplicated the chart name in every path and forced the unit tests to spell out `templates/gitea/<name>.yaml`, while `_helpers.tpl` and `NOTES.txt` already lived directly in `templates`. All templates now live in `templates`, which matches the layout of the bundled sub-charts and the Helm defaults. The checksum helper in `templates/_secrets.tpl` built its include path from `$root.Template.BasePath` and therefore carried the subdirectory in a `printf` format string instead of a literal path. Without adjusting it the chart failed to render with "no template gitea/templates/gitea/secret_config.yaml associated with template gotpl". Co-authored-by: Copilot <copilot@github.com>
131 lines
3.7 KiB
YAML
131 lines
3.7 KiB
YAML
suite: deployment template (init container configuration)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/deployment.yaml
|
|
- templates/secret_admin.yaml
|
|
- templates/secret_config.yaml
|
|
- templates/secret_gpg.yaml
|
|
- templates/secret_init.yaml
|
|
- templates/secret_inlineConfig.yaml
|
|
- templates/secret_metrics.yaml
|
|
tests:
|
|
- it: appends the per-container env
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.initDirectories.env:
|
|
- name: INIT_DIRECTORIES
|
|
value: "1"
|
|
deployment.gitea.env:
|
|
- name: SHARED
|
|
value: "1"
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.initContainers[0].env
|
|
content:
|
|
name: INIT_DIRECTORIES
|
|
value: "1"
|
|
- contains:
|
|
path: spec.template.spec.initContainers[0].env
|
|
content:
|
|
name: SHARED
|
|
value: "1"
|
|
- notContains:
|
|
path: spec.template.spec.initContainers[1].env
|
|
content:
|
|
name: INIT_DIRECTORIES
|
|
value: "1"
|
|
|
|
- it: renders the per-container envFrom
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.initAppIni.envFrom:
|
|
- secretRef:
|
|
name: special-secret
|
|
asserts:
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[0].envFrom
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].envFrom
|
|
value:
|
|
- secretRef:
|
|
name: special-secret
|
|
|
|
- it: appends the per-container volumeMounts
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.initConfigureGitea.volumeMounts:
|
|
- name: my-configmap-volume
|
|
mountPath: /configmap
|
|
readOnly: true
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.initContainers[2].volumeMounts
|
|
content:
|
|
name: my-configmap-volume
|
|
mountPath: /configmap
|
|
readOnly: true
|
|
- notContains:
|
|
path: spec.template.spec.initContainers[0].volumeMounts
|
|
content:
|
|
name: my-configmap-volume
|
|
mountPath: /configmap
|
|
readOnly: true
|
|
|
|
- it: overrides the resources of a single init container
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.initDirectories.resources:
|
|
requests:
|
|
cpu: 500m
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].resources
|
|
value:
|
|
requests:
|
|
cpu: 500m
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].resources
|
|
value:
|
|
limits: {}
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
|
|
- it: overrides the security context of a single init container
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.gitea.securityContext:
|
|
runAsUser: 1000
|
|
deployment.initDirectories.securityContext:
|
|
runAsUser: 2000
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].securityContext.runAsUser
|
|
value: 2000
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].securityContext.runAsUser
|
|
value: 1000
|
|
|
|
- it: renders the envFrom of the gitea container
|
|
template: templates/deployment.yaml
|
|
set:
|
|
deployment.gitea.envFrom:
|
|
- configMapRef:
|
|
name: special-config
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.containers[0].envFrom
|
|
value:
|
|
- configMapRef:
|
|
name: special-config
|
|
|
|
- it: omits envFrom when unset
|
|
template: templates/deployment.yaml
|
|
asserts:
|
|
- notExists:
|
|
path: spec.template.spec.containers[0].envFrom
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[0].envFrom
|