-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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/postgresql] No warning about missing password value during upgrade when chart is a subchart #6121
Comments
#4364 Seems somewhat related but doesn't look like it's describing the exact same issue. |
Hi, |
I appreciate that this is a possible workaround, but it hardly seems ideal. I can't see any documentation in the chart's README indicating that this is a requirement. Moreover, I expect that most people consuming a chart would expect it to behave the same when used as a subchart as when used directly. Is there a particular reason why the validation can't be moved into a template file that renders in all scenarios, and must stay in |
To make the problem explicit: at present, anybody who uses this as a subchart and doesn't realise there is a requirement to put specific macros in their What's worse, the requirement effectively propagates to all consuming charts - if there are nested subcharts, all charts that have postgresql somewhere in their subchart hierarchy must modify their Unless I'm missing something, I'd consider this a fairly unequivocal bug, given the risk of data loss. |
Hi @hWorblehat Thanks for your feedback. As @rafariossaa mentioned, these validations are addressed in the main chart (as we did in Keycloak) since the NOTES.txt of the subcharts are ignored.
To be honest, we did not explore that possibility but I think it does make sense. We simply add them into the NOTES.txt for historical reasons. @javsalgar @carrodher what do you think about this?
That's not correct. The data in PostgreSQL remains unmodified regardless you indicate the credentials during the chart upgrade or not. The actual problem is that the application is unable to authenticate with the PostgreSQL server. If this happens, users can do a "helm rollback" to the previous release revision and everything should continue working as before.
Please note that this is a mechanism we introduced to avoid users to misuse the chart, but users still have the responsibility to carefully read the documentation and use charts accordingly. We also have Troubleshooting guides that address this specific topic: As an alternative, we also support managing these credentials externally to the chart making use of the |
Hi @juan131, Thanks for responding and clarifying a few things.
Yep, my mistake here. I'm not that hot on how PostgreSQL works, and I'd thought that it was possibly encrypting its data at rest using the password. I've done some reading and it looks like I was clearly wrong here. However, if the password is lost (excepting your rollback solution, discussed below), it's a certain amount of manual faff to recover access, which looks like it would require manually editing some of the data on the PV (e.g. here).
True, I'd forgotten you can do this. However there's still a problem: the issue only manifests itself when the pod trying to access the data is rescheduled. Performing a Helm upgrade doesn't guarantee that will happen. So, it may not be clear that the Helm upgrade was what caused the issue at first (this is what happened to me - pod was rescheduled months later when upgrading the cluster). Also, if the the Helm release is updated more times than Helm's max history (10 by default) before the pod is rescheduled, then the password really will be lost. While this may be unlikely, it's not impossible. Consider this scenario: you upgrade your Helm release twice. The first time doesn't cause pods to be rescheduled, but the second does. Here, it would look like the second upgrade had broken things, when in fact it was the first. I can see an administrator spending a really long time trying to get to the bottom of that...
Agreed, RTFM, and thanks for pointing me at the documentation. However, I came across this issue not as a user of this chart, but as a user of another chart that used postgresql as a subchart. Arguably, this is the fault of the subchart developer, who maybe didn't RTFM, but:
Agreed, there are lots of ways to use this chart "correctly", both directly and as a subchart. I'm now employing one of them in my deployment (:+1: ). But, there's one way, which happens to be the "easiest" option, that is quite dangerous. On the surface of things to me, it looks like that danger could quite easily be mitigated by moving a small amount of code between template files, so I raised this bug as I thought that might be a good idea to explore. So, on the basis of all of the above, I'm still of the opinion that either:
|
I agree it is for historical reasons. I think it makes sense to explore that possibility and figure out the best option to do it. It make take some time from us because we would need to adapt it to all of our charts. |
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback. |
Hi, |
Hello, I had the same problem on my helm chart and was able to fix it with something like this:
Can we avoid regenerating secrets when the PostgreSQL chart is upgraded? Thanks. |
Hi, thanks for letting us know. We are investigating different alternatives to improve the current approach to handle random passwords and upgrades. One of the concerns of using We will update this thread with more information once decided a proper solution. |
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback. |
Exactly! Thanks. |
I've just been bitten by this. Any solution on the pipe? |
Recent versions of the PostgreSQL chart use Helm's "lookup" functionality to auto-detect existing secret keys. What version are you using @mickours ? In any case, the alternatives that you have to solve the issue if you faced it are documented in the Troubleshooting guide below: |
Thanks, this is coming from the |
Hi @mickours The ideal thing in this case would be to update the chart deps on that chart, but that's out of our scope. I hope that the alternatives documented in the Troubleshooting guide will be useful to workaround the issue. |
Unfortunately, this issue was created a long time ago and although there is an internal task to fix it, it was not prioritized as something to address in the short/mid term. It's not a technical reason but something related to the capacity since we're a small team. Being said that, contributions via PRs are more than welcome in both repositories (containers and charts). Just in case you would like to contribute. During this time, there are several releases of this asset and it's possible the issue has gone as part of other changes. If that's not the case and you are still experiencing this issue, please feel free to reopen it and we will re-evaluate it. |
Which chart:
Tested with postgresql 8.10.14, but I believe it's also present in more recent versions.
Describe the bug
When this chart is used as a subchart that doesn't explicitly have the
postgresPassword
value set, there is no error report on upgrade. As a result, access to the data on the persistent volume is lost the next time the pod is rescheduled.To Reproduce
Steps to reproduce the behavior:
postgresPassword
value (e.g. Requarks/wiki).postgresPassword
:postgres-password
secret differs from the environment variable in the postgres pod:Expected behavior
In step 3 above, the upgrade should fail with an error requesting the password be explicitly specified.
Version of Helm and Kubernetes:
helm version
:kubectl version
:Additional context
This error doesn't occur when using the chart directly, as there's a macro in
NOTES.txt
that checks for the password. However, by default Helm doesn't render subchart notes so this macro never gets invoked. A simple fix would be to move the invocation of this macro into another template file to ensure it is always invoked.The text was updated successfully, but these errors were encountered: