-
Notifications
You must be signed in to change notification settings - Fork 12
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
mysql lib can only set a single secret #367
Comments
Actually, I guess this is really from canonical/data-platform-libs#117 and #348 is just when it made it into this Charm? I perhaps should have opened this against the data-platform-libs repo, sorry - I was just working through figuring out what happened with mysql-operator first, and didn't think to raise it against the lib. Fwiw, it seems like the _generate_secret_label used in data-platform-libs is ok, because it adds in a "group" name. But the default Let me know if you want me to re-open the issue there instead. |
@tonyandrewmeyer thank you for the report! @juditnovak can you share your vision here. Thank you! |
@tonyandrewmeyer @taurus-forever Please correct me if I got anything wrong -- I may have confusion regarding the context. By policy, most Data Platform charms have 2 secrets: We have set up our libraries accordingly. This is not a bug but a policy. If I get it right, in your tests you are aiming to break out of this frame -- i.e. aiming to do something that's purposefully not supported. Am I getting it right? PS: Since we do have one single charm (Opensearch) that has more secrets than listed above, we are likely to provide a generic solution in the future that would be available for all charms, supporting more than one secret. (However the number of secrets still may be restrained for charms that insist on a single secret). |
Firstly, I'm sorry for pinging about this on Matrix and then vanishing for a week 😞. I had thought that this would be something that I'd be focusing on and then a bunch of unexpected work turned up and I ran out of time to come back to it until now. I made a mistake here - apologies for that too! I thought that this was the reason that the mysql-operator and mysql-k8s-operator tests failed with ops 2.6+, but that's not the case. (I did manage to figure out what was needed and opened a data-platforms-libs PR and a mysql-operator PR, and the combination of those solve the issues). It does seem a little odd the way that the label generation is done when there's only a pair (app, unit) of secrets, and where postgresql has secrets grouped. But I understand now that this is deliberate, so that's fine (and also that it's not causing issues, as I wrongly thought). As an aside, the @canonical/charm-tech team would appreciate learning more about the data-platform-libs |
I don't think I can close this - if that doesn't happen automatically, could someone please do that? Sorry & thanks! |
Steps to reproduce
This charm demonstrates the issue:
Note that you need to have the
main
version of thedata_platform_libs
, not one from acharmcraft fetch
.Expected behavior
With the above charm, the first INFO logging line should look something like:
label1: something, label2: something-else, secrets: {'something': <...>}
And there should be a second one like:
label1: something, label2: something-else, secrets: {'something': <...>, 'something-else': <...>}
Actual behavior
With the above charm, the logging output is:
The issue is that the
generate_secret_label
method indata_secrets.py
takes the charm and the scope as arguments, and uses the charm's app name and the scope to form the label. The app name is obviously the same across the app, and the scope is eitherapp
orunit
. This means that if you try to get a label for an app secret, you'll always get exactly the same string. This effectively means that theSecretCache
system as used bymysql.py
will only store a single app secret, because it believes that any secret is already in the cache after one is.Versions
Operating system: Ubuntu 23.10
Juju CLI: 3.1.6-genericlinux-amd64
(Note that the code never gets to Juju in the problematic area).
Juju agent: 3.1.5
Charm revision: N/A
LXD: N/A
Log output
Juju debug log:
Copied above.
Additional context
This was introduced in #348. You can also see failing unit tests if you bump your
ops
requirement to 2.6.0 or higher (I haven't looked at exactly what changes there, but presumably some of the code starts exercising more of the secret support in ops).The text was updated successfully, but these errors were encountered: