Commit 68728a9
Fix ReconcileVersion re-creating OpenStackVersion during deletion
When an OpenStackControlPlane CR is deleted, the reconciler called
ReconcileVersion() before checking DeletionTimestamp. ReconcileVersion
unconditionally called CreateOrPatch on the OpenStackVersion CR,
which would re-create it even during deletion.
This caused issues in adoption CI: the pcp_cleanup role deleted the
OpenStackControlPlane but the controller re-created the OpenStackVersion
before fully shutting down. The leftover OpenStackVersion (named
'controlplane' from the source cloud) then caused the new
OpenStackControlPlane (named 'openstack') to be rejected by the
webhook with:
OpenStackControlPlane 'openstack' must have same name as the
existing 'controlplane' OpenStackVersion
Fix ReconcileVersion to properly handle the Get result:
- Return actual errors (not IsNotFound) instead of swallowing them
- Skip CreateOrPatch when the controlplane is being deleted
- Still return the existing version object so reconcileDelete can
remove its finalizer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 55df25d commit 68728a9
1 file changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
255 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
256 | 266 | | |
257 | 267 | | |
258 | 268 | | |
| |||
0 commit comments