Emit Kubernetes Events - #155
Open
HarshwardhanPatil07 wants to merge 4 commits into
Open
Conversation
The controller may update BootcNode metadata while envtest simulates a daemon status update. Both operations advance resourceVersion, making a single Get followed by Status().Update susceptible to conflicts. Use client-go RetryOnConflict so the simulated daemon refetches the latest BootcNode before retrying its status update. Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Users currently need to inspect conditions and controller logs to understand image resolution, rollout progress, node transitions, and blocked drains. Emit Kubernetes Events for these meaningful observations without using Event delivery to drive reconciliation. Reuse the existing image resolution and drain state paths, persist node transition bookkeeping in a controller-owned annotation, and bound Event notes to the events.k8s.io 1 KiB limit. Grant the recorder create and patch access to both supported Event API groups. Related: bootc-dev#101 Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Exercise pool, node, and drain Event behavior with exact reason, action, relationship, and note assertions. Cover transition deduplication, annotation write failures, tag resolution, degraded status, drain scheduling, and UTF-8-safe note truncation. Use envtest Event objects filtered by regarding UID so retained Events from an earlier object with the same name cannot satisfy the integration assertions. Related: bootc-dev#101 Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Envtest does not exercise the deployed RBAC, Event broadcaster, daemon, or real reboot path. Extend the existing bink update and tag-resolution scenarios to assert the Events produced by a deployed operator. Filter Events by the regarding object UID and verify exact types, reasons, actions, notes, and related pool identity. Related: bootc-dev#101 Assisted-by: AI Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
HarshwardhanPatil07
force-pushed
the
issue-101-k8s-events
branch
from
September 2, 2026 09:09
b8f0464 to
75fbea9
Compare
Collaborator
Author
ptalgulk01
reviewed
Sep 2, 2026
Comment on lines
+676
to
+683
| for _, event := range eventList.Items { | ||
| if event.Regarding.Kind == kind && | ||
| event.Regarding.Name == name && | ||
| event.Regarding.UID == uid { | ||
| events = append(events, event) | ||
| } | ||
| } | ||
| return events, nil |
Collaborator
There was a problem hiding this comment.
we can have this as helper func something like
func FilterEventsByObject(items []eventsv1.Event, kind, name string, uid types.UID) []eventsv1.Event {
out := make([]eventsv1.Event, 0, len(items))
for _, e := range items {
if e.Regarding.Kind == kind && e.Regarding.Name == name && e.Regarding.UID == uid {
out = append(out, e)
}
}
return out
}
|
|
||
| switch idle.Reason { | ||
| case bootcv1alpha1.NodeReasonStaging: | ||
| return observation + ":" + node.Spec.DesiredImage, |
Collaborator
There was a problem hiding this comment.
we can have this store in var observation + ":" + node.Spec.DesiredImage
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.
Pool Events:
ImageUpdateAvailableRolloutStartedRolloutCompletedNode Events:
StagingStagedRebootingDrainFailedDrainTakingTooLongNode Events reference the BootcNode as the primary object and the owning BootcNodePool as the related object.
Testing
Completed: Manual Event verification on a bink cluster
make buildimg make deploy-bink make e2e V=1 RUN='TestUpdateReboot\|TestTagResolution'watch events in second terminal:
kubectl get events.events.k8s.io -A --watchcloses: #101