Skip to content

Commit

Permalink
Edit clusterintalls reconcile to properly set cd conditions
Browse files Browse the repository at this point in the history
The updated controller-runtime version requirement to explicitly set
status sub-resource uncovered an issue in
reconcileExistingInstallingClusterInstall in which the cd conditions
were not being updated.

Create a DeepCopy of the `conditions` variable, which was previously just
a pointer to cd.Status.Conditions. Pass this variable (instead of
cd.Status.Conditions) to controllerutils.SetClusterDeploymentCondition
so as not to mutate cd.Status.Conditions, but rather to append the new
conditions to the `conditions` variable.

Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
  • Loading branch information
lleshchi committed Aug 15, 2023
1 parent 8964471 commit 3901572
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/clusterdeployment/clusterinstalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (r *ReconcileClusterDeployment) reconcileExistingInstallingClusterInstall(c
statusModified = true
}

conditions := cd.Status.Conditions
conditions := cd.DeepCopy().Status.Conditions

// copy the required conditions
requiredConditions := []hivev1.ClusterInstallConditionType{
Expand Down Expand Up @@ -192,8 +192,8 @@ func (r *ReconcileClusterDeployment) reconcileExistingInstallingClusterInstall(c
// we are done provisioning
cd.Spec.Installed = true
cd.Status.InstalledTimestamp = &clusterInstallCompleted.LastTransitionTime
cd.Status.Conditions = controllerutils.SetClusterDeploymentCondition(
cd.Status.Conditions,
conditions = controllerutils.SetClusterDeploymentCondition(
conditions,
hivev1.ProvisionedCondition,
corev1.ConditionTrue,
hivev1.ProvisionedReasonProvisioned,
Expand Down

0 comments on commit 3901572

Please sign in to comment.