Commit 5f1910f
authored
fix(controllers): remove conflicting status update in storeInstallationData (platform9#120)
When r.Status().Update() is called in storeInstallationData, it
overwrites the local scope.Config with the server's response. But also the
.Status update only updates the .status of the object.
Which means, any finalizers added to the object before this but yet to
be updated into the k8s data store, are over-written (effectively
reseting to what it was before the reconcile loop).
This causes the .Patch invocation in the defer-ed func (in .Reconcile)
to not see any new finalizers:
- both before and after, there are no changes to finalziers, leaving the
finalizer change unsaved
Additionally, Status().Update bumps the ResourceVersion, causing a conflict
in the defer-patch's patchStatus step when the resource is updated.
As a result, remove the Status().Update call and let the outer
reconcile's defer-patch handle both status and metadata updates
atomically.
Also fix test assertions:
- k8sinstallerconfig_controller_test.go: check for "uninstall" key in the
separate uninstallation secret, not the installation secret
- byomachine_controller_test.go: set UninstallationSecret in the test status
patch, as the reconciler requires both secrets when Ready=true1 parent 62eb7e9 commit 5f1910f
3 files changed
Lines changed: 22 additions & 8 deletions
File tree
- controllers/infrastructure
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
466 | 472 | | |
467 | 473 | | |
468 | 474 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
254 | 253 | | |
255 | 254 | | |
256 | 255 | | |
| |||
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
| 291 | + | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
296 | 305 | | |
297 | 306 | | |
298 | 307 | | |
| |||
0 commit comments