You've already forked helm-gitea
e673346bb8
### Description of the change
Gitea supports providing DB and Redis/ValKey secrets via env variables, current chart requires DB and Redis/ ValKey credentials reading from k8s secret as per below values.yaml snippet. This approach requires secret to be created beforehand.
```
- name: GITEA__database__USER
valueFrom:
secretKeyRef:
name: gitea-ha
key: db_user
- name: GITEA__database__PASSWD
valueFrom:
secretKeyRef:
name: gitea-ha
key: db_password
```
Other approach is to provide the credentials in values.yaml which isnt secure.
A bash variable file can be created by using vault injector like this, which then can be sourced while running `config_environment.sh` in `init-app-ini`
```
GITEA__database__NAME=gitea
GITEA__database__USER=gitea_user
```
Support to read env variables from file
Reference: https://developer.hashicorp.com/vault/docs/deploy/kubernetes/injector/examples#environment-variable-example
### Benefits
Support to read env variables from file created by vault injector for DB and redis/ valkey credentials
Support to set gitea admin user and credentials via env variables from file created by vault injector
### Possible drawbacks
N/A
### ⚠ BREAKING
No breaking changes
### Checklist
- [X] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)
---------
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/993
Co-authored-by: deepakdeore2004 <deepakdeore2004@noreply.gitea.com>
Co-committed-by: deepakdeore2004 <deepakdeore2004@noreply.gitea.com>
83 lines
2.8 KiB
YAML
83 lines
2.8 KiB
YAML
suite: deployment template (extraEnvSourceFile)
|
|
release:
|
|
name: gitea-unittests
|
|
namespace: testing
|
|
templates:
|
|
- templates/gitea/deployment.yaml
|
|
- templates/gitea/config.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"
|