Skip to content

Commit d2cd4a7

Browse files
committed
Fix SSA field owner mismatch in serverTo{Port,Volume}MapFunc
serverToPortMapFunc and serverToVolumeMapFunc patch the Progressing condition using GetSSAFieldOwner(controllerName) (e.g. "openstack.k-orc.cloud/portcontroller"), but the generic reconciler's UpdateStatus uses GetSSAFieldOwnerWithTxn(controllerName, SSATransactionStatus) (e.g. "openstack.k-orc.cloud/portcontroller/status"). Because both use ForceOwnership, the last writer wins. When the controller's own UpdateStatus (Progressing=False) runs after the mapFunc's patch (Progressing=True), the signal is lost and the resource is never re-fetched from OpenStack. Use the same SSA field owner as UpdateStatus so the two writes don't compete over field ownership. Closes: #842
1 parent 95c906a commit d2cd4a7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

internal/controllers/port/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func serverToPortMapFunc(ctx context.Context, k8sClient client.Client) handler.M
244244
),
245245
)
246246

247-
if err := k8sClient.Status().Patch(ctx, port, applyconfigs.Patch(types.ApplyPatchType, portApply), orcstrings.GetSSAFieldOwner(controllerName), client.ForceOwnership); err != nil {
247+
if err := k8sClient.Status().Patch(ctx, port, applyconfigs.Patch(types.ApplyPatchType, portApply), orcstrings.GetSSAFieldOwnerWithTxn(controllerName, orcstrings.SSATransactionStatus), client.ForceOwnership); err != nil {
248248
log.Error(err, "failed to update port progressing status",
249249
"port", client.ObjectKeyFromObject(port),
250250
"server", client.ObjectKeyFromObject(server))

internal/controllers/volume/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func serverToVolumeMapFunc(ctx context.Context, k8sClient client.Client) handler
201201
),
202202
)
203203

204-
if err := k8sClient.Status().Patch(ctx, volume, applyconfigs.Patch(types.ApplyPatchType, volumeApply), orcstrings.GetSSAFieldOwner(controllerName), client.ForceOwnership); err != nil {
204+
if err := k8sClient.Status().Patch(ctx, volume, applyconfigs.Patch(types.ApplyPatchType, volumeApply), orcstrings.GetSSAFieldOwnerWithTxn(controllerName, orcstrings.SSATransactionStatus), client.ForceOwnership); err != nil {
205205
log.Error(err, "failed to update volume progressing status",
206206
"volume", client.ObjectKeyFromObject(volume),
207207
"server", client.ObjectKeyFromObject(server))

0 commit comments

Comments
 (0)