Skip to content

Report bundle deployment state as Kubernetes events - #5515

Open
0xavi0 wants to merge 2 commits into
rancher:mainfrom
0xavi0:bds-events
Open

Report bundle deployment state as Kubernetes events#5515
0xavi0 wants to merge 2 commits into
rancher:mainfrom
0xavi0:bds-events

Conversation

@0xavi0

@0xavi0 0xavi0 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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: #4455

Additional Information

Checklist

  • I have updated the documentation via a pull request in the fleet-product-docs repository.

@0xavi0 0xavi0 added this to the v2.16.0 milestone Aug 5, 2026
@0xavi0 0xavi0 self-assigned this Aug 5, 2026
@0xavi0 0xavi0 added this to Fleet Aug 5, 2026
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>
@0xavi0
0xavi0 marked this pull request as ready for review August 6, 2026 07:47
@0xavi0
0xavi0 requested a review from a team as a code owner August 6, 2026 07:47
Copilot AI lite review requested due to automatic review settings August 6, 2026 07:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bundleevents emitter 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 deploymentEvents chart/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.

Comment thread internal/cmd/controller/bundleevents/notifier.go
Comment thread internal/cmd/controller/bundleevents/notifier.go
@0xavi0
0xavi0 marked this pull request as draft August 6, 2026 08:11
Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
@0xavi0
0xavi0 marked this pull request as ready for review August 6, 2026 08:38
@0xavi0 0xavi0 moved this to 👀 In review in Fleet Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

2 participants