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
Add support for Pebble change-update notice #17118
Merged
Merged
Conversation
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
benhoyt
added a commit
to benhoyt/juju
that referenced
this pull request
Apr 3, 2024
This bumps up the Pebble version to 1.10, which includes the change-update work (this was going to be done in juju#17118 anyway) and the security fixes to the API (canonical/pebble@a5f6f06).
jujubot
added a commit
that referenced
this pull request
Apr 3, 2024
#17140 This bumps up the Pebble version to 1.10, which includes the change-update work (this was going to be done in #17118 anyway) and the security fixes to the API, including the fix for CVE-2024-3250 (canonical/pebble@a5f6f06). Full Pebble diff: canonical/pebble@v1.9.1...v1.10.2
This is basically just adding the notice type in the right places, with the effect that we'll now respond to Pebble change-update notices by sending a pebble-change-updated event to the charm. This PR also updates "sidecar" integration tests and the pebble-notices test charm with a change-update notice test. For reference, Pebble Notices support (for the "custom" notice type) was originally introduced in PR juju#16428.
wallyworld
approved these changes
Apr 4, 2024
hpidcock
approved these changes
Apr 8, 2024
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.
LGTM
/merge |
benhoyt
added a commit
to canonical/operator
that referenced
this pull request
Apr 9, 2024
…1170) This adds support for the new `pebble-change-updated` event (Juju PR juju/juju#17118), adding a new `PebbleChangeUpdatedEvent` type and `{container_name}_pebble_change_updated` event you can observe. The event has a `get_change()` method to easily fetch the associated `pebble.Change` object. It also adds `Harness.pebble_notify` support for the `pebble.NoticeType.CHANGE_UPDATE` notice type. To use that, you say: ```python notice_id = harness.pebble_notify('<container>', '<change-id>', type=pebble.NoticeType.CHANGE_UPDATE) ```
Merged
jujubot
added a commit
that referenced
this pull request
Apr 12, 2024
#17191 This reverts PR #17118 ([4afda98](4afda98)), as the interaction between `pebble exec` and hooks turned out to be a big problem. For example, [prometheus-k8s calls `_update_cert`](https://github.com/canonical/prometheus-k8s-operator/blob/6eea5cc49bce622c089c54a7be0f891e67966c5c/src/charm.py#L169) in the charm's `__init__` (at the start of every hook) which runs `container.exec(["update-ca-certificates"], ...)`. But `pebble exec` records a change for the execution, which records 3 notices, one for every change-update (Hold, Doing, Done). This creates an impossible 3^n fanout of Juju hooks, bogging the system down and preventing other hooks from running. For now, revert the support for the `change-update` notice and `change-updated` event. Longer term (probably in 3.6), we clearly need some more design work to handle this kind of thing better. Some braindump thoughts: * Should Juju exclude change-update notices with kind==exec? * Or should charmers need to opt in to change-update notice and specify the `kind`s they want? (`exec` will almost never be interesting). * Perhaps Pebble shouldn't record a change for `exec` at all. * Juju should probably batch up change-update notices into a single hook? (Or maybe even all notices, but with `custom-notice` that ship has already sailed.) * Separately, is it a good idea for a charm to call exec in charm `__init__`?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This wires up the
change-update
notice type in the right places, with the effect that we'll now respond to Pebble change-update notices by sending apebble-change-updated
event to the charm.For reference, Pebble Notices support (for the "custom" notice type) was originally introduced in PR #16428.
Checklist
doc.go added or updated in changed packagesQA steps
Manual QA steps below (similar to the integration test):
Documentation changes
Ben to add Juju SDK documentation for this (CHARMTECH-35).
Links
Original spec: JU048.