The names of the Secrets rendered by the chart were built inline in each template and, for two of them, in ad-hoc chart-wide helpers. The same name therefore existed in several places (Deployment volumes, ServiceMonitor credentials, the Secret templates themselves), which made every rename a multi-file change and allowed the references to drift apart unnoticed - the Helm unit tests render one template at a time and cannot detect a mismatching secretName. All Secret names are now defined once in templates/gitea/_secrets.tpl: gitea.secret.config.name -> <fullname>-config gitea.secret.gpg.name -> <fullname>-gpg-key (or signing.existingSecret) gitea.secret.init.name -> <fullname>-init gitea.secret.inlineConfig.name -> <fullname>-inline-config gitea.secret.metrics.name -> <fullname>-metrics gitea.gpg-key-secret-name and gitea.metrics-secret-name are removed from _helpers.tpl accordingly. A checksum/inlineConfig pod annotation is added as well. After the inline configuration had been split out of secret_config.yaml, changes to it were no longer covered by any checksum annotation and did not trigger a rollout of the Deployment. Finally the metadata attributes of the Secret templates are sorted alphabetically as required by the chart conventions. BREAKING CHANGE: two Secrets are renamed. The config Secret changes from <fullname> to <fullname>-config and the metrics Secret from <fullname>-metrics-secret to <fullname>-metrics. Helm replaces both on upgrade; references to them from outside the chart have to be adjusted. Co-authored-by: Copilot <copilot@github.com>
84 lines
2.8 KiB
YAML
84 lines
2.8 KiB
YAML
suite: deployment template (extraEnvSourceFile)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/gitea/deployment.yaml
|
|
- templates/gitea/secret_config.yaml
|
|
- templates/gitea/secret_inlineConfig.yaml
|
|
tests:
|
|
- it: uses direct execution when extraEnvSourceFile is not set
|
|
template: templates/gitea/deployment.yaml
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].command
|
|
value: ["/usr/sbinx/config_environment.sh"]
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[1].args
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/usr/sbinx/configure_gitea.sh"]
|
|
- notExists:
|
|
path: spec.template.spec.initContainers[2].args
|
|
|
|
- it: sources env file in init-app-ini when extraEnvSourceFile is set
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: config_environment\.sh
|
|
|
|
- it: sources env file in configure-gitea when extraEnvSourceFile is set
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: configure_gitea\.sh
|
|
|
|
- it: sources env file in configure-gpg when extraEnvSourceFile is set with signing enabled
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
signing:
|
|
enabled: true
|
|
existingSecret: "custom-gpg-secret"
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[2].command
|
|
value: ["/bin/bash", "-c"]
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: source /vault/secrets/gitea
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[2].args[0]
|
|
pattern: configure_gpg_environment\.sh
|
|
|
|
- it: includes file existence check in source command
|
|
template: templates/gitea/deployment.yaml
|
|
set:
|
|
gitea:
|
|
extraEnvSourceFile: /vault/secrets/gitea
|
|
asserts:
|
|
- matchRegex:
|
|
path: spec.template.spec.initContainers[1].args[0]
|
|
pattern: "test -f /vault/secrets/gitea"
|