[Close #1119] fix(secrets): render inline config as data to prune removed sections

The inline-config Secret used `stringData`. The API server stores it as `data`, so a section removed from `gitea.config` was never pruned from the live Secret, and the init container kept writing it into `app.ini` on every start. With Gitea 28, a leftover `[webhook] ALLOWED_HOST_LIST` overrides `[security]`'s, which breaks webhooks to private hosts.

This renders the Secret as base64 `data` instead.

- `templates/secret_inlineConfig.yaml`: `stringData` → `data` (`b64enc`).
- Unit tests read `data.*` with `decodeBase64: true`; adds a regression test asserting there is no `stringData`.

Note: keys that are already stale from the `stringData` era survive the first upgrade to this version, because Helm's three-way merge never recorded them under `data`. Every removal after that is pruned.

`make unittests-helm`: 261 passed. `helm lint` and `yamllint` are clean.
Co-authored-by: perfectra1n <jonfuller2012@gmail.com>
Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/1110
Co-authored-by: perfectra1n <49838+perfectra1n@noreply.gitea.com>
This commit is contained in:
perfectra1n
2026-10-03 15:16:25 +00:00
committed by Markus Pesch
co-authored by perfectra1n
parent 92c761c9ba
commit 4631d42156
10 changed files with 102 additions and 48 deletions
+15 -4
View File
@@ -5,7 +5,7 @@ release:
templates:
- templates/secret_inlineConfig.yaml
tests:
- it: inline config stringData.server using TPL
- it: inline config data.server using TPL
set:
global.giteaHostName: "gitea.example.com"
ingress.enabled: true
@@ -21,13 +21,24 @@ tests:
pattern: .*-inline-config$
- documentIndex: 0
matchRegex:
path: stringData.server
path: data.server
decodeBase64: true
pattern: DOMAIN=gitea\.example\.com
- documentIndex: 0
matchRegex:
path: stringData.server
path: data.server
decodeBase64: true
pattern: ROOT_URL=https://gitea\.example\.com
- documentIndex: 0
matchRegex:
path: stringData.server
path: data.server
decodeBase64: true
pattern: SSH_DOMAIN=gitea\.example\.com
- it: renders data, not stringData, so removed sections are pruned on upgrade
asserts:
- documentIndex: 0
notExists:
path: stringData
- documentIndex: 0
exists:
path: data.server