Commit 5d7d789
OCPBUGS-81476: Fix race condition in PinnedImages GC test
This commit fixes a race condition in the "All Nodes in a custom Pool
should have the PinnedImages even after Garbage Collection" test that
caused nodes to get stuck in degraded state with missing MachineConfig.
The Problem:
The test was using defers in the wrong order, causing cleanup to happen
like this:
1. Delete KubeletConfig
2. Delete PinnedImageSet (triggers rendered-custom deletion)
3. Unlabel node (triggers transition to worker pool)
4. Wait for worker config
When step 3 triggered the transition, the node would reboot to apply
the worker config. However, because the rendered-custom config was
already deleted in step 2, the node would come back up with a reference
to a non-existent config on disk and get stuck in degraded state:
currentConfig: rendered-custom-d356ed29481f2de2bb31c6443e1d29ca
desiredConfig: rendered-worker-82faad7319f9e10715adbfd98a4b67ba
state: Degraded
reason: "machineconfig 'rendered-custom-d356ed29481f2de2bb31c6443e1d29ca' not found"
The Fix:
Changed cleanup order to:
1. Unlabel node (triggers transition)
2. Wait for worker config transition to complete
3. Delete KubeletConfig
4. Delete PinnedImageSet
This ensures the node successfully transitions back to the worker pool
BEFORE we delete any configs, eliminating the race condition.
Changes:
- Removed defers for unlabelNode, waitTillNodeReadyWithConfig,
deletePIS, and deleteKC
- Added explicit cleanup after GCPISTest completes that performs
operations in the correct order
- Added logging to track cleanup progress
- Removed defer deleteKC from GCPISTest function
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent c77ff4a commit 5d7d789
1 file changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
| |||
129 | 127 | | |
130 | 128 | | |
131 | 129 | | |
132 | | - | |
133 | 130 | | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
138 | 152 | | |
139 | 153 | | |
140 | 154 | | |
| |||
384 | 398 | | |
385 | 399 | | |
386 | 400 | | |
387 | | - | |
388 | 401 | | |
389 | 402 | | |
390 | 403 | | |
| |||
0 commit comments