Report bundle deployment state as Kubernetes events - #5515
Open
0xavi0 wants to merge 2 commits into
Open
Conversation
Fleet exposes deployment failures only in bundle status, which is easy to miss. This adds events on the bundle when its deployments fail, and when they all become ready again, so `kubectl describe bundle` and any event- based tooling can see them. Events are created directly rather than through client-go's recorder: the recorder keeps the note of the first event in a series, which would drop notes describing different failures of the same bundle. Deduplication happens on a fingerprint of the failure causes and how many deployments are affected instead, so a burst collapses into one accurate event, and comparing against the last persisted status keeps that true across controller restarts. Configurable via the `deploymentEvents` block in the fleet chart: debounce, minimum interval per object, recovery reporting, how many causes an event names, and optional per-bundle-deployment events (off by default). Reporting is on by default and can be turned off entirely. Refers to: rancher#4455 Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Kubernetes Events reporting for bundle deployment failures (and optional recovery/per-deployment reporting) so failures are visible via kubectl describe and event tooling, with burst debouncing and deduplication to avoid event floods.
Changes:
- Introduces
bundleeventsemitter to generate aggregated Bundle events (and optional per-BundleDeployment events) with debounce/min-interval behavior. - Wires bundle/bundledeployment reconcilers and controller operator to observe persisted status transitions and emit/forget events appropriately.
- Adds
deploymentEventschart/config support and improves duration sanitization to handle nested duration fields.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/durations/durations.go | Adds default debounce/min-interval durations for bundle deployment events. |
| internal/config/config.go | Adds deploymentEvents config block and sanitizes nested duration keys. |
| internal/config/config_test.go | Tests nested duration sanitization behavior for deploymentEvents. |
| internal/cmd/controller/reconciler/bundledeployment_controller.go | Notifies event emitter after persisted BundleDeployment status; forgets on deletion. |
| internal/cmd/controller/reconciler/bundle_controller.go | Notifies event emitter after persisted Bundle status summary; forgets on deletion. |
| internal/cmd/controller/reconciler/bundle_controller_test.go | Adds notifier stub to ensure persisted summaries are observed on early-return paths. |
| internal/cmd/controller/operator.go | Instantiates and registers the bundleevents runnable; injects into reconcilers. |
| internal/cmd/controller/bundleevents/options.go | Defines emitter options and config mapping defaults. |
| internal/cmd/controller/bundleevents/options_test.go | Validates options parsing from rendered config JSON and defaults/disable behavior. |
| internal/cmd/controller/bundleevents/notifier.go | Implements the event emitter (queueing, deduping, retries, eviction/TTL). |
| internal/cmd/controller/bundleevents/notifier_test.go | Tests burst aggregation, dedup, recovery reporting, rate limiting, retries, eviction, etc. |
| internal/cmd/controller/bundleevents/note.go | Builds bounded event notes and fingerprints from bundle/deployment status. |
| internal/cmd/controller/bundleevents/note_test.go | Tests note formatting, limits, cause bucketing, and UTF-8 truncation. |
| charts/fleet/values.yaml | Documents and exposes deploymentEvents configuration values. |
| charts/fleet/values.schema.json | Adds schema for deploymentEvents and allows empty-string durations as “unset”. |
| charts/fleet/templates/rbac.yaml | Grants permission to create events.k8s.io Events. |
| charts/fleet/templates/configmap.yaml | Renders deploymentEvents into the controller configmap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0xavi0
marked this pull request as draft
August 6, 2026 08:11
Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
0xavi0
marked this pull request as ready for review
August 6, 2026 08:38
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
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.
Fleet exposes deployment failures only in bundle status, which is easy to miss. This adds events on the bundle when its deployments fail, and when they all become ready again, so
kubectl describe bundleand any event- based tooling can see them.Events are created directly rather than through client-go's recorder: the recorder keeps the note of the first event in a series, which would drop notes describing different failures of the same bundle. Deduplication happens on a fingerprint of the failure causes and how many deployments are affected instead, so a burst collapses into one accurate event, and comparing against the last persisted status keeps that true across controller restarts.
Configurable via the
deploymentEventsblock in the fleet chart: debounce, minimum interval per object, recovery reporting, how many causes an event names, and optional per-bundle-deployment events (off by default). Reporting is on by default and can be turned off entirely.Refers to: #4455
Additional Information
Checklist