OCPEDGE-2118: Record Kubernetes events for etcd transition lifecycle#1653
OCPEDGE-2118: Record Kubernetes events for etcd transition lifecycle#1653lucaconsalvi wants to merge 3 commits into
Conversation
Add event recording to the TNF setup runner and etcd transition code so the full CEO-to-pacemaker handoff is observable via `kubectl get events -n openshift-etcd`. Nine events are emitted across the transition lifecycle: - runner.go: auth, cluster, fencing, etcd resource, constraints - etcd.go: transition started, waiting, static pod removed, completed Events use the direct K8s API (not library-go Recorder) since the setup runner is a short-lived Job. Failures are logged but never block the transition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
@lucaconsalvi: This pull request references OCPEDGE-2118 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
WalkthroughTNF setup and etcd transition flows now emit Kubernetes ChangesTNF transition events
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant RunTnfSetup
participant RecordSetupEvent
participant KubernetesEventsAPI
participant RemoveStaticContainer
participant waitForStaticContainerRemoved
RunTnfSetup->>RecordSetupEvent: record setup milestones
RecordSetupEvent->>KubernetesEventsAPI: create Normal events
RunTnfSetup->>RemoveStaticContainer: pass kubeClient during handover
RemoveStaticContainer->>RecordSetupEvent: record transition start
RemoveStaticContainer->>waitForStaticContainerRemoved: wait for static etcd removal
waitForStaticContainerRemoved->>RecordSetupEvent: record removal milestone
RemoveStaticContainer->>RecordSetupEvent: record transition completion
RecordSetupEvent->>KubernetesEventsAPI: create Normal events
Suggested reviewers: 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/tnf/pkg/tools/events.go`:
- Around line 3-28: Update RecordSetupEvent so the reason component used in the
event metadata.name is converted to lowercase before constructing the name.
Preserve the existing event naming format and reason value used elsewhere in the
event.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 11fb1836-7157-46ed-9989-87c3820a66e7
📒 Files selected for processing (5)
hack/test-transition-events.shpkg/tnf/pkg/etcd/etcd.gopkg/tnf/pkg/etcd/etcd_test.gopkg/tnf/pkg/tools/events.gopkg/tnf/setup/runner.go
The event reason (e.g. EtcdTransitionAuthCompleted) was used directly in metadata.name which should be a valid lowercase DNS subdomain. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fonta-rh
left a comment
There was a problem hiding this comment.
Ahhh, I'm amazed, I have nothing to nitpick. This does what it should minimally, good test coverage! Good work!
|
/lgtm |
|
Scheduling required tests: |
E2E Verification on Live TNF ClusterCluster: Deployed via cluster-bot ( Method: Verified all 9 transition events are emitted during the CEO-to-Pacemaker etcd handoff using ResultsAll 9 events recorded successfully in
/verified by @lucaconsalvi |
|
@lucaconsalvi: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
|
@lucaconsalvi: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/retest |
|
/approve |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fonta-rh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Add event recording to the TNF setup runner and etcd transition code so the full CEO-to-pacemaker handoff is observable via
kubectl get events -n openshift-etcd.Nine events are emitted across the transition lifecycle:
Events use the direct K8s API (not library-go Recorder) since the setup runner is a short-lived Job. Failures are logged but never block the transition.
Summary by CodeRabbit
Normalevents to surface TNF setup milestones and the etcd static-container transition lifecycle, including key configuration steps and the static etcd removal phase.