-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bitnami/mariadb] Don't overwrite generated secret values on chart upgrade #7403
Comments
Hi @mamiu, thanks for reporting this. You are indeed right, there is a bug in the It should be throwing an error, but it seems like the logic is not working properly and it is not happening. We'll continue investigating internally and provide an update whenever we have found a possible solution. |
Thanks @marcosbc! If you need help, let me know. |
@marcosbc: I've just checked it again and I can't find an issue in Cause the mariadb secret is created based on And the data of the secret are also exclusively based on the mariadb chart values. So I can't see why this issue should be caused by the |
The secrets template is not performing a {{- $rootPasswordValue := (randAlpha 16) | b64enc | quote }}
{{- $secret := (lookup "v1" "Secret" .Release.Namespace "db-keys") }}
{{- if $secret }}
{{- $rootPasswordValue = index $secret.data "root-password" }}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
name: db-keys
namespace: {{ .Release.Namespace }}
type: Opaque
data:
root-password: {{ $rootPasswordValue}} |
@sspreitzer Thanks mate, that's awesome! Exactly what I was thinking about. |
Hi, unfortunately we have no plans support However, we have mechanisms in place to avoid these issues via the upgrade logic. However, there is currently a bug in this logic and makes it not to throw an error if credentials were not specified. Because of that, the credentials would be recreated. The idea is for it to throw an error so it prevents you from upgrading altogether, if they were not specified. |
@marcosbc Ok, I see. Are you interested in me creating a pull request where such a feature is implemented in a single location (like the |
@marcosbc Can you please share with the public, why you decide against supporting the official |
Hi @sspreitzer, my understanding is that it was evaluated internally, but saw that it would cause a lock-in to Helm for any chart using it, meaning that it would not be possible to export them to other formats if needed. |
@marcosbc That's a valid point, but I think the lock-in to Helm is given anyway for almost every chart in this project. All charts are highly customized to helm syntax and conventions, that it's very unlikely to be replaced by any other technology (except if that technology aims to be helm compatible - but in that case I'm pretty sure the lookup function would be available as well). Additionally helm is also a CNCF Graduated Project and therefore on the same level as Kubernetes. Helm won't go anywhere soon. If I see that right this whole Bitnami charts project is meant to be helm specific or is there any other use case which I'm not aware of? BTW: The |
I have to follow @mamiu's conclusion. Also I do not see a sense in using |
Hi all, after a more extensive internal review, it seems the reason we did not support it yet is because it required Helm 3.2. In Helm 3.1, the Now that Helm 3.2 is more than a year old, it makes sense to bump the minimum Helm version requirement to 3.2 in order to support lookup in the entire catalog. I have updated our internal task so we can continue the work on the changes to support lookup in the entire catalog. However, please be aware that these changes will require some planning ahead, so this could take some time before it gets definitely implemented, unfortunately I'm unable to provide any ETA for that. |
Thanks a lot @marcosbc for your feedback! Looking forward to see this feature coming. But no rush. Totally understand that projects this size need careful handling. Do you want to keep this issue open to track the progress of it? |
For now, let's keep this issue open. I added the |
@marcosbc Any updates on this one? We still have to fight this bug manually every time we upgrade a chart. |
@mamiu we opened support for "lookup" some months ago. That's what we're doing in some charts such as PostgreSQL that use our helper "common.secrets.passwords.manage" that is based on the Helm "lookup" feature:
We should definitely adopt this in MariaDB too. Would you like to contribute with a PR? |
Thanks for your quick response @juan131! Sure, let me try. |
If not already mentioned and you are an ArgoCD user; Using See #5202 |
* [bitnami/mariadb] Don't overwrite existing secrets Don't overwrite already generated secret values on chart upgrade Issue #7403 (#7403) Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
* [bitnami/mariadb] Don't overwrite existing secrets Don't overwrite already generated secret values on chart upgrade Issue #7403 (#7403) Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: alukic <alukic@vmware.com>
* [bitnami/mariadb] Don't overwrite existing secrets Don't overwrite already generated secret values on chart upgrade Issue bitnami#7403 (bitnami#7403) Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> * Update bitnami/mariadb/templates/secrets.yaml Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Paul Miu <miu.manu@gmx.de> Co-authored-by: Miguel Ruiz <miruiz@vmware.com> Signed-off-by: Pavel Sokolov <comradepashka@gmail.com>
Is there any progress on this issue? I really need this for annotations on load balancer resources for things like the ngingx controller. So, this is an example of what I am attempting to do from the nginx application file:
As this template is going to be used in different environments (and there are several more similar annotations), we don't want to manually add all of the annotations to a git repository when those values can be easily stored in a configmap and used in any application where it is needed. If anyone has a possible workaround for this situation until the |
@codex70 The lookup function is 100% supported. If you want to have a change that is generic and useful to other users, create a PR. But the change you want looks highly specific to your use case, so just fork this repo and customize the chart you want to your needs. |
Hi @mamiu, thank you for such a quick response. I will double check my code, this possibly wasn't the best thread to add my question to, it was referenced from argoproj/argo-cd#5202, which is probably a more relevant place. |
Yeah, the issue you referenced looks like a better place for your request. |
Which chart:
Chart: mariadb
Version: latest
Describe the bug
The
mariadb-password
attribute in the charts secret is getting overwritten on every upgrade, if themariadb-password
was generated.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Wrap the lines L19, L26 and L34 into these template functions
"common.secrets.passwords.manage"
or"common.secrets.exists"
.Version of Helm and Kubernetes:
helm version
:kubectl version
:Additional context
This probably applies to other charts as well (e.g. mysql, etc.).
The text was updated successfully, but these errors were encountered: