From 1cf0017302fdae8c66b44470868575de94602ded Mon Sep 17 00:00:00 2001 From: Leah Leshchinsky Date: Thu, 10 Aug 2023 13:59:09 -0400 Subject: [PATCH] Add TODO on clusterclaim_controller status handling Due to the introduction of status subresource awareness in the fake client, it has been uncovered that, in cases of an assignment conflicts between claims for a cluster, the AssignmentConflict condition was not being set (requiring a `Status().Update()` call rather than `Update()`). Update log message to reflect that spec (and not status) is being updated, and add TODO to investigate behavior in https://issues.redhat.com/browse/HIVE-2274 Signed-off-by: Leah Leshchinsky --- pkg/controller/clusterclaim/clusterclaim_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/controller/clusterclaim/clusterclaim_controller.go b/pkg/controller/clusterclaim/clusterclaim_controller.go index 7ff533d5083..13791378db0 100644 --- a/pkg/controller/clusterclaim/clusterclaim_controller.go +++ b/pkg/controller/clusterclaim/clusterclaim_controller.go @@ -498,6 +498,7 @@ func (r *ReconcileClusterClaim) reconcileForExistingAssignment(claim *hivev1.Clu func (r *ReconcileClusterClaim) reconcileForAssignmentConflict(claim *hivev1.ClusterClaim, logger log.FieldLogger) (reconcile.Result, error) { logger.Info("claim assigned a cluster that has already been claimed by another ClusterClaim") claim.Spec.Namespace = "" + // TODO: Update status handling https://issues.redhat.com/browse/HIVE-2274 claim.Status.Conditions = controllerutils.SetClusterClaimCondition( claim.Status.Conditions, hivev1.ClusterClaimPendingCondition, @@ -507,7 +508,7 @@ func (r *ReconcileClusterClaim) reconcileForAssignmentConflict(claim *hivev1.Clu controllerutils.UpdateConditionIfReasonOrMessageChange, ) if err := r.Update(context.Background(), claim); err != nil { - logger.WithError(err).Log(controllerutils.LogLevel(err), "could not update status of ClusterClaim") + logger.WithError(err).Log(controllerutils.LogLevel(err), "could not update spec of ClusterClaim") return reconcile.Result{}, err } return reconcile.Result{}, nil