From 92a09173f5c2a7e163692f70c22b92580c9d6f18 Mon Sep 17 00:00:00 2001 From: Bryan Cox Date: Wed, 18 Dec 2024 17:40:47 -0500 Subject: [PATCH] Get HCP before Valid Release Image status patch This commit gets the latest HCP into memory before we update the Valid Release Image status. Signed-off-by: Bryan Cox --- .../hostedcontrolplane/hostedcontrolplane_controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go index 4aae4b7625..87af26c928 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go +++ b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go @@ -949,6 +949,11 @@ func (r *HostedControlPlaneReconciler) update(ctx context.Context, hostedControl } } + // Get the latest HCP in memory before we patch the status + if err = r.Client.Get(ctx, client.ObjectKeyFromObject(hostedControlPlane), hostedControlPlane); err != nil { + return reconcile.Result{}, err + } + originalHostedControlPlane := hostedControlPlane.DeepCopy() missingImages := sets.New(releaseImageProvider.GetMissingImages()...).Insert(userReleaseImageProvider.GetMissingImages()...) if missingImages.Len() == 0 {