allowed pass db credential through secret. #60

Closed
opened 2020-11-17 19:09:31 +00:00 by wener · 9 comments

Using gitops, deploy must go through git, but this chart require clear credential.

During the init, can mount the external secret as env or somthing to provice extra conf for app.ini.

Using gitops, deploy must go through git, but this chart require clear credential. During the init, can mount the external secret as env or somthing to provice extra conf for app.ini.
lunny added the
kind
proposal
label 2020-11-18 03:37:23 +00:00
Member

Do you want this option for the admin password only or for the database credentials as well?

Do you want this option for the admin password only or for the database credentials as well?
Contributor

I think this should be for all passwords / secrets.

Maybe the chart can optionally use key-value pairs from an existing secret?

I think this should be for all passwords / secrets. Maybe the chart can optionally use key-value pairs from an existing secret?
Contributor

Injecting database credentials via secrets is a requirement if you want to use gitea with the Kubernetes PostgreSQL operator.

Injecting database credentials via secrets is a requirement if you want to use gitea with the Kubernetes PostgreSQL operator.
Member

I currently have no idea how to do this properly :/

It is no problem at all to inject those secrets as env variables. However to set the database passwords we somehow need to get them into the app.ini.

First idea would be to check if secrets are available and set a placeholder in the generated app.ini and set it later in the init container via sed.

But im not really happy with this approach

I currently have no idea how to do this properly :/ It is no problem at all to inject those secrets as env variables. However to set the database passwords we somehow need to get them into the app.ini. First idea would be to check if secrets are available and set a placeholder in the generated app.ini and set it later in the init container via sed. But im not really happy with this approach

I am also interested in providing secrets to gitea using environment variables instead of setting them in plain format in app.ini. I did a bit of research and found out, since gitea image v1.14.1, there is the possibility to override everything in app.ini by passing ENVs by following the pattern "GITEA__SECTION_NAME__KEY_NAME". You can read more about this feature Managing Deployments With Environment Variables

So if I understand it correctly, we just need to extend the {{Values.statefulset.env}} to support not only simple "value" but also a "valueFrom" object. e.g:
...
env:
- name: GITEA_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: nameOfSecret
key: password

Thanks

I am also interested in providing secrets to gitea using environment variables instead of setting them in plain format in app.ini. I did a bit of research and found out, since gitea image v1.14.1, there is the possibility to override everything in app.ini by passing ENVs by following the pattern "GITEA__SECTION_NAME__KEY_NAME". You can read more about this feature [Managing Deployments With Environment Variables](https://docs.gitea.io/en-us/install-with-docker/#managing-deployments-with-environment-variables) So if I understand it correctly, we just need to extend the {{Values.statefulset.env}} to support not only simple "value" but also a "valueFrom" object. e.g: ... env: - name: GITEA_ADMIN_PASSWORD valueFrom: secretKeyRef: name: nameOfSecret key: password Thanks
Member

will check this, thanks for the hint :)

will check this, thanks for the hint :)
luhahn referenced this issue from a commit 2021-04-29 09:12:49 +00:00
Member

merged with #148

merged with #148
Author

@luhahn still don't get how can I pass db conf by secret, there is no gitea.database.existingSecret like admin

@luhahn still don't get how can I pass db conf by secret, there is no gitea.database.existingSecret like admin
wener reopened this issue 2021-08-01 17:13:09 +00:00
Author

ok, 1.14 support from env. like

- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=db:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
ok, 1.14 support from env. like ```yaml - GITEA__database__DB_TYPE=mysql - GITEA__database__HOST=db:3306 - GITEA__database__NAME=gitea - GITEA__database__USER=gitea - GITEA__database__PASSWD=gitea ```
wener closed this issue 2021-08-01 17:15:32 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/helm-chart#60
No description provided.