OCPBUGS-89689: (karpenter) use completed release image for unpinned NodeClaims during CP upgrade - #8957
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe controller now derives both release image and version from the most recent completed HostedCluster history entry, with updated fallback handling when no completed entry exists or status version is missing. 🚥 Pre-merge checks | ✅ 9 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (9 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
karpenter-operator/controllers/karpenterignition/karpenterignition_controller.go (1)
343-376: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueNil
CompletionTimetie-break could silently pick a stale entry.If a
CompletedUpdateentry with a nilCompletionTimeis followed by another completed entry with a non-nil one, theentry.CompletionTime != nil && latest.CompletionTime != nilguard skips promotion, so the entry actually carrying a timestamp never replaces the nil one. In practice this is unlikely to occur since the cluster-version-operator always backfillsCompletionTimebefore marking an entryCompleted, but it's a low-cost hardening given this exact code path is what prevents premature drift detection.🛡️ Optional hardening
if latest == nil { latest = entry continue } - if entry.CompletionTime != nil && latest.CompletionTime != nil && entry.CompletionTime.After(latest.CompletionTime.Time) { - latest = entry - } + switch { + case entry.CompletionTime == nil: + // keep latest; nothing to compare against + case latest.CompletionTime == nil: + latest = entry + case entry.CompletionTime.After(latest.CompletionTime.Time): + latest = entry + }🤖 Prompt for 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. In `@karpenter-operator/controllers/karpenterignition/karpenterignition_controller.go` around lines 343 - 376, The current `currentClusterReleaseImage` selection logic can keep a stale `CompletedUpdate` when `latest.CompletionTime` is nil and a later completed entry has a timestamp, because the comparison only promotes when both times are non-nil. Update the `currentClusterReleaseImage` loop to treat a non-nil `CompletionTime` as newer than a nil one, while still selecting the most recent completed history entry in `hostedCluster.Status.Version.History` and preserving the existing fallback to `hostedCluster.Spec.Release.Image` and `Desired.Version`.
🤖 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.
Nitpick comments:
In
`@karpenter-operator/controllers/karpenterignition/karpenterignition_controller.go`:
- Around line 343-376: The current `currentClusterReleaseImage` selection logic
can keep a stale `CompletedUpdate` when `latest.CompletionTime` is nil and a
later completed entry has a timestamp, because the comparison only promotes when
both times are non-nil. Update the `currentClusterReleaseImage` loop to treat a
non-nil `CompletionTime` as newer than a nil one, while still selecting the most
recent completed history entry in `hostedCluster.Status.Version.History` and
preserving the existing fallback to `hostedCluster.Spec.Release.Image` and
`Desired.Version`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: b770e5aa-9ce8-4bdb-bc27-8ff0e439ef63
📒 Files selected for processing (2)
karpenter-operator/controllers/karpenterignition/karpenterignition_controller.gokarpenter-operator/controllers/karpenterignition/karpenterignition_controller_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8957 +/- ##
==========================================
- Coverage 44.77% 44.77% -0.01%
==========================================
Files 775 775
Lines 97210 97214 +4
==========================================
- Hits 43528 43527 -1
- Misses 50681 50685 +4
- Partials 3001 3002 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
/test e2e-aws-autonode |
|
I think we are going to need to change how the e2e works. Right now, the e2e assumes the NodeClaim will Drift immediately after upgrading the HC release image version.. We need to only check after the CP upgrade completes since that's what the PR does now. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/e2e/karpenter_control_plane_upgrade_test.go (1)
96-98: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueSequential drift wait could add up for multiple NodeClaims.
Each
waitForNodeClaimDriftedcall has its own timeout (5 min, per the helper), and the loop now runs sequentially instead of the previous goroutine-based concurrent wait. Withreplicas := 1today this is a single iteration, but if this test is later scaled to more replicas, total wait time grows linearly. Consider parallelizing with an errgroup if NodeClaim counts increase.
[optional_refactor]🤖 Prompt for 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. In `@test/e2e/karpenter_control_plane_upgrade_test.go` around lines 96 - 98, The drift wait in the NodeClaim loop is now sequential, which will scale timeout linearly if more than one NodeClaim is present. Update the waiting logic around waitForNodeClaimDrifted to run concurrently again, ideally using an errgroup or similar pattern, so each NodeClaim can be awaited in parallel while preserving error handling in the test.
🤖 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.
Nitpick comments:
In `@test/e2e/karpenter_control_plane_upgrade_test.go`:
- Around line 96-98: The drift wait in the NodeClaim loop is now sequential,
which will scale timeout linearly if more than one NodeClaim is present. Update
the waiting logic around waitForNodeClaimDrifted to run concurrently again,
ideally using an errgroup or similar pattern, so each NodeClaim can be awaited
in parallel while preserving error handling in the test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 43c0d2fa-8256-4406-af0c-80fee723685d
📒 Files selected for processing (1)
test/e2e/karpenter_control_plane_upgrade_test.go
|
/test e2e-aws-autonode |
|
thanks! /lgtm /assign @enxebre |
|
Scheduling tests matching the |
Test Resultse2e-aws
Failed TestsTotal failed tests: 9
... and 4 more failed tests e2e-aks
|
|
/test e2e-aks-4-22 |
e5d3974 to
b78f317
Compare
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
nit: can we put all this logic in it's own function?
b78f317 to
11207b1
Compare
|
/pipeline-required |
11207b1 to
e0eb7c5
Compare
|
@judexzhu: This pull request references Jira Issue OCPBUGS-89689, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. 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. |
|
/jira refresh |
|
@bryan-cox: This pull request references Jira Issue OCPBUGS-89689, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
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. |
|
@judexzhu: all tests passed! 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. |
|
@judexzhu: Jira Issue Verification Checks: Jira Issue OCPBUGS-89689 Jira Issue OCPBUGS-89689 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 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. |
|
Fix included in release 5.0.0-0.nightly-2026-08-04-172547 |
Address bryan-cox review comments on PR openshift#8957: - Remove VersionStatus nil guard that blocked pinned NodeClaims - Replace Spec.Release.Image fallback with Partial entry fallback (prevents premature drift when Spec flips to new version on upgrade) - Requeue on empty History, scoped to unpinned NodeClasses only - Rename currentClusterReleaseImage to currentClusterRelease - Harden CompletionTime nil tie-break (switch statement) - Add cancelOnDrift to assertNodeClaimsNotDrifted for early e2e abort - Add test cases: Spec!=Partial upgrade, multi-upgrade, nil CompletionTime Bug: https://issues.redhat.com/browse/OCPBUGS-89689 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release images differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. This commit also includes changes from openshift#8957 which got reverted by openshift#9233. The above changes were included to prevent unintentional drift during a control plane upgrade. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release images differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. This commit also includes changes from openshift#8957 which got reverted by openshift#9233. The above changes were included to prevent unintentional drift during a control plane upgrade. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release images differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. This commit also includes changes from openshift#8957 which got reverted by openshift#9233. The above changes were included to prevent unintentional drift during a control plane upgrade. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Address bryan-cox review comments on PR openshift#8957: - Remove VersionStatus nil guard that blocked pinned NodeClaims - Replace Spec.Release.Image fallback with Partial entry fallback (prevents premature drift when Spec flips to new version on upgrade) - Requeue on empty History, scoped to unpinned NodeClasses only - Rename currentClusterReleaseImage to currentClusterRelease - Harden CompletionTime nil tie-break (switch statement) - Add cancelOnDrift to assertNodeClaimsNotDrifted for early e2e abort - Add test cases: Spec!=Partial upgrade, multi-upgrade, nil CompletionTime Bug: https://issues.redhat.com/browse/OCPBUGS-89689 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address bryan-cox review comments on PR openshift#8957: - Remove VersionStatus nil guard that blocked pinned NodeClaims - Replace Spec.Release.Image fallback with Partial entry fallback (prevents premature drift when Spec flips to new version on upgrade) - Requeue on empty History, scoped to unpinned NodeClasses only - Rename currentClusterReleaseImage to currentClusterRelease - Harden CompletionTime nil tie-break (switch statement) - Add cancelOnDrift to assertNodeClaimsNotDrifted for early e2e abort - Add test cases: Spec!=Partial upgrade, multi-upgrade, nil CompletionTime Bug: https://issues.redhat.com/browse/OCPBUGS-89689 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Gate Karpenter node drift behind control plane upgrade completion. The ec2nodeclass controller now holds AMI/UserData propagation to the EC2NodeClass while the desired release image differs from the last completed version. This prevents nodes from rolling against a partially-upgraded control plane. The above changes were included to prevent unintentional drift during a control plane upgrade. This commit also includes changes from openshift#8957, which got reverted by openshift#9233. Co-authored-by: Jude Zhu <judzhu@redhat.com> Signed-off-by: Max Cao <macao@redhat.com>
Summary
hcp.Spec.ReleaseImageflips to the desired version immediately. The KarpenterIgnition controller was reading this for unpinned NodeClaims, causing premature drift detection and worker replacement before CP upgrade completed.currentClusterVersion()withcurrentClusterReleaseImage()that returns both release image and version from the most recently completed history entry.spec.version) are unaffected.Test plan
TestCurrentClusterReleaseImage— 8 cases including upgrade-in-progress scenario (Partial + Completed history entries)TestReconcile,TestReconcileVersionResolution,TestResolveVersion,TestReconcileKubeletConfigMap— all pass with updated fixturesgo vetcleanFixes: OCPBUGS-89689
🤖 Generated with Claude Code
Summary by CodeRabbit
Summary
Bug Fixes
Tests