-
Notifications
You must be signed in to change notification settings - Fork 27
[DPE-8395] Remove old revision of secret #1195
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
Merged
+13
−0
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7c87c90
Remove old revision of secret
marceloneppel d5aac00
Remove secrets' old revision on upgrade
marceloneppel 521d108
Remove all previous secret revisions
marceloneppel d393710
Merge remote-tracking branch 'origin/main' into remove-secret-old-rev…
marceloneppel 0e29e0e
Handle https://github.com/juju/juju/issues/20782
marceloneppel 0e23c96
Revert "Handle https://github.com/juju/juju/issues/20782"
marceloneppel 1ff60fa
Reapply "Handle https://github.com/juju/juju/issues/20782"
marceloneppel a6c36bb
Handle https://github.com/juju/juju/issues/20794
marceloneppel 63a5f44
Consider all secrets created by the charm
marceloneppel cbfe719
Check for secrets support
marceloneppel fec93f2
Remove upgrade logic
marceloneppel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was testing an implementation like this with my own charms, I ran into an issue with juju 3.6.9. We have a bugfix prepared that should make this implementation ok, but we might want to be defensive in how we write our charm.
juju/juju#20796 is the bug fix and
juju/juju#20794 is the issue.
Specifically, the issue is that older versions of juju, when a secret is fully-removed, will trigger secret-remove with the old revisions of the secret. However, that secret no longer exists, so that will cause the hook to fail, because it tries to delete something that doesn't exist.
I do see that you have some code to try and handle some of that:
However, in my testing, because Juju tries to make the removal of a secret revision transaction consistent, it doesn't actually do anything until the hook completes, at which point, the charm has no way of resolving it (hence the above bug).
The fix that I did in my test charm was:
I'm not a huge fan of the workaround. (Not least of which, it means that your application now becomes an observer of the charm content, so it will also get
secret-changed
events. I suppose you might be able to use--peek
? I'm not sure if that sets you as an observer.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much, @jameinel, for your comments in this PR. I'm now handling the issue from your above comment through the check added on a6c36bb.