-
Notifications
You must be signed in to change notification settings - Fork 122
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
Support user secrets: "secret" config type and Harness support #1166
Comments
So to trigger this behavior, I updated my charm's config to have: +++ b/config.yaml
@@ -1 +1,5 @@
-options: {}
+options:
+ mysec:
+ type: secret
+ default: nil
+ description: "tell me your secrets" It turns out that it only fails because I set the 'default:' key, which makes the Testing infrastructure call _config_set with the defaults, and then it validates the type. |
and certainly the test suite will need to be able to set it :) |
This seems to be undocumented functionality (config.yaml, charmcraft.yaml, manage application, how to use secrets, release notes, secret reference). Is there documentation somewhere else? |
I know the Juju spec for it:
https://docs.google.com/document/d/1gb-l-YTZtHyZk8UktEXVz5gFwyTJB163IMNA-4EmXnQ/edit?usp=sharing
It was implemented back in Juju 3.3. It is entirely plausible that the rest
of the documentation is not complete.
I did put together a use case driving it here:
canonical/istio-operators#380 (comment)
John
=:->
…On Tue, Mar 26, 2024 at 4:30 PM Tony Meyer ***@***.***> wrote:
This seems to be undocumented functionality (config.yaml
<https://juju.is/docs/sdk/config-yaml>, charmcraft.yaml
<https://juju.is/docs/sdk/charmcraft-yaml#heading--config>, manage
application
<https://juju.is/docs/juju/manage-applications#heading--configure-an-application>,
how to use secrets <https://juju.is/docs/sdk/add-a-secret-to-a-charm>, release
notes <https://juju.is/docs/juju/roadmap>, secret reference
<https://juju.is/docs/juju/secret>). Is there documentation somewhere
else?
—
Reply to this email directly, view it on GitHub
<#1166 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRQ7LRGUMRMX3WGGBWZNDY2HLF5AVCNFSM6AAAAABFI5E23CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRRGQYDQNBQG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
We're going to get John's PR into ops 2.12 as an immediate unblocker, but we feel that there's more work to be done here. It's likely that we need a new We're expecting that we'll be able to do the more complete fix in 22.04. Also: the Juju team are working on updating the documentation. We should double-check that at least the |
I see the Jira ticket for this issue is assigned to me, so today I did some research today and tried It seems user secrets added by this command belong to the Model, as shown by And it seems Harness can add secrets with owner set as the app or unit. I suppose we can add a method Did I get the whole picture? Also it would be nice to merge Tony's charmcraft PR so that we can pack and test it. |
Yeah, that sounds right, but maybe we can briefly go over this with Ian at the Juju standup today. Thinking about it now, |
Per Juju recommendation, let's also consider renaming Presumably |
secret
Hi @benhoyt regarding tests, what would be the recommended way of testing user secrets (adding, granting access, etc.) in an integration test environment? I see that we have |
ops.testing (Harness) is for unit tests, not integration tests. At the moment, writing unit tests for user secrets with ops.testing is not well supported, but when this ticket is closed (probably next pulse) that will be fixed. For integration tests, you should use pytest-operator and python-libjuju (which have the |
Thanks for clearing this out, I didn't know python-libjuju already had this. |
To handle user secrets, with Juju (3.4(?) you can now have a config with a schema type of "secret". Juju will then ensure that it can hold a secret URL.
However, if I try to create a charm that uses this, when running the test suite I get:
I tested this with:
The text was updated successfully, but these errors were encountered: