HYPERFLEET-630 - fix: consolidate duplicate resource operation logs#84
HYPERFLEET-630 - fix: consolidate duplicate resource operation logs#84xueli181114 wants to merge 1 commit intoopenshift-hyperfleet:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (3)
WalkthroughThe pull request updates manifest apply behavior to treat a resource creation failure with an "already exists" error as a concurrent-create race: the apply result is changed to Sequence Diagram(s)sequenceDiagram
participant Caller
participant k8sclient
participant K8sAPI
participant Logger
Caller->>k8sclient: ApplyManifest(manifest, existing=nil)
k8sclient->>K8sAPI: CreateResource(manifest)
alt API returns Created
K8sAPI-->>k8sclient: Created (no error)
k8sclient-->>Caller: ApplyResult(OperationCreate)
else API returns AlreadyExists error
K8sAPI-->>k8sclient: Error: AlreadyExists
k8sclient->>Logger: Debug("concurrent create detected")
k8sclient-->>Caller: ApplyResult(OperationSkip, reason="already exists (concurrent create)")
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
| result.Operation = manifest.OperationSkip | ||
| result.Reason = "already exists (concurrent create)" | ||
| applyErr = nil | ||
| } | ||
|
|
There was a problem hiding this comment.
Missing test coverage for this change
There was a problem hiding this comment.
Added test coverage in apply_test.go. TestApplyManifest_CreateAlreadyExists verifies the concurrent create race condition: first ApplyManifest creates the resource, second ApplyManifest with existing=nil hits AlreadyExists and returns OperationSkip with reason "already exists (concurrent create)". Also added tests for create success, same-generation skip, and nil manifest validation.
1dbb531 to
ba4011f
Compare
Remove redundant pre/post operation logs from k8s_client and maestro_client CRUD methods. The executor layer provides a single authoritative INFO log per resource operation. The apply-layer decision log (operation + reason) is retained at DEBUG level. Handle "already exists" errors from concurrent creates gracefully by treating them as a successful skip instead of an ERROR.
ba4011f to
b24c590
Compare
Summary
k8s_clientandmaestro_clientCRUD methods (25 log lines removed)Test plan
make test-allpasses (lint + unit + integration tests)Relates to: HYPERFLEET-630
Summary by CodeRabbit
Bug Fixes
Chores
Tests