-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#17470 from ycliuhw/implement-WatchRevisionsTo…
…Prune juju#17470 This PR introduces a watcher that monitors when user secret revisions become obsolete or the auto-prune secret config is changed to `true`. Typically, non-latest secret revisions that no longer have any consumers will be marked as obsolete. These obsolete revisions are then automatically removed by the auto-prune workers for user secrets (if the auto-prune config is set to true). The reason why the WatchObsoleteRevisionsToPrune was implemented as a multi-watcher is that it can be triggered in two different scenarios: - a user secret revision changed to obsolete and the secret auto-prune config is turned on; - a user secret's auto-prune config changed from false to true; Depends on juju#17592 ## Checklist - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - [ ] ~[Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - [ ] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps ``` juju show-secret foo --revisions cpp9fq7mp25c7823t5sg: revision: 4 rotation: never owner: <model> name: foo created: 2024-06-19T08:33:44.742302307Z updated: 2024-06-19T08:33:53.684554916Z revisions: - revision: 1 created: 2024-06-19T08:33:44.742302307Z updated: 0001-01-01T00:00:00Z - revision: 2 created: 2024-06-19T08:33:51.156979444Z updated: 0001-01-01T00:00:00Z - revision: 3 created: 2024-06-19T08:33:52.320925473Z updated: 0001-01-01T00:00:00Z - revision: 4 created: 2024-06-19T08:33:53.684554916Z updated: 0001-01-01T00:00:00Z juju grant-secret foo snappass-test juju show-secret foo --revisions cpp9fq7mp25c7823t5sg: revision: 4 rotation: never owner: <model> name: foo created: 2024-06-19T08:33:44.742302307Z updated: 2024-06-19T08:33:53.684554916Z revisions: - revision: 1 created: 2024-06-19T08:33:44.742302307Z updated: 0001-01-01T00:00:00Z - revision: 2 created: 2024-06-19T08:33:51.156979444Z updated: 0001-01-01T00:00:00Z - revision: 3 created: 2024-06-19T08:33:52.320925473Z updated: 0001-01-01T00:00:00Z - revision: 4 created: 2024-06-19T08:33:53.684554916Z updated: 0001-01-01T00:00:00Z access: - target: application-snappass-test scope: model-45f2fbe8-f395-468b-8ab8-3bb6269e8b1c role: view juju exec --unit snappass-test/0 -- secret-get cpp9fq7mp25c7823t5sg token: "3" juju update-secret foo --auto-prune juju show-secret foo --revisions cpp9fq7mp25c7823t5sg: revision: 4 rotation: never owner: <model> name: foo created: 2024-06-19T08:33:44.742302307Z updated: 2024-06-19T08:34:53.390873807Z revisions: - revision: 4 created: 2024-06-19T08:33:53.684554916Z updated: 0001-01-01T00:00:00Z access: - target: application-snappass-test scope: model-45f2fbe8-f395-468b-8ab8-3bb6269e8b1c role: view juju update-secret foo token=4 juju show-secret foo --revisions cpp9fq7mp25c7823t5sg: revision: 5 rotation: never owner: <model> name: foo created: 2024-06-19T08:33:44.742302307Z updated: 2024-06-19T08:35:06.345225733Z revisions: - revision: 4 created: 2024-06-19T08:33:53.684554916Z updated: 0001-01-01T00:00:00Z - revision: 5 created: 2024-06-19T08:35:06.345225733Z updated: 0001-01-01T00:00:00Z access: - target: application-snappass-test scope: model-45f2fbe8-f395-468b-8ab8-3bb6269e8b1c role: view juju exec --unit snappass-test/0 -- secret-get cpp9fq7mp25c7823t5sg --refresh token: "4" juju show-secret foo --revisions cpp9fq7mp25c7823t5sg: revision: 5 rotation: never owner: <model> name: foo created: 2024-06-19T08:33:44.742302307Z updated: 2024-06-19T08:35:06.345225733Z revisions: - revision: 5 created: 2024-06-19T08:35:06.345225733Z updated: 0001-01-01T00:00:00Z access: - target: application-snappass-test scope: model-45f2fbe8-f395-468b-8ab8-3bb6269e8b1c role: view ``` ## Documentation changes No ## Links **Jira card:** - JUJU-6005 - JUJU-4723
- Loading branch information
Showing
25 changed files
with
764 additions
and
132 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
48 changes: 24 additions & 24 deletions
48
apiserver/facades/controller/usersecrets/mocks/service.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.