Skip to content

Commit 0914d0a

Browse files
Jayendra Parsaijgwest
authored andcommitted
Error reporting in DeploymentTarget/DeploymentTargetClaim.
1 parent bcf4e26 commit 0914d0a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

appstudio-controller/controllers/appstudio.redhat.com/deploymenttargetclaim_controller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ func createSpaceRequestForDTC(ctx context.Context, k8sClient client.Client, dtc
945945
}
946946

947947
// updateStatusConditionOfDeploymentTargetClaim calls SetCondition() with DeploymentTargetClaim conditions
948-
func updateStatusConditionOfDeploymentTargetClaim(ctx context.Context, client client.Client,
948+
func updateStatusConditionOfDeploymentTargetClaim(ctx context.Context, k8sClient client.Client,
949949
message string, deploymentTargetClaim *applicationv1alpha1.DeploymentTargetClaim, conditionType string,
950950
status metav1.ConditionStatus, reason string, log logr.Logger) error {
951951

@@ -956,12 +956,17 @@ func updateStatusConditionOfDeploymentTargetClaim(ctx context.Context, client cl
956956
Reason: reason,
957957
}
958958

959+
if err := k8sClient.Get(ctx, client.ObjectKeyFromObject(deploymentTargetClaim), deploymentTargetClaim); err != nil {
960+
log.Error(err, "unable to fetch deploymentTargetClaim.")
961+
return nil
962+
}
963+
959964
changed, newConditions := insertOrUpdateConditionsInSlice(newCondition, deploymentTargetClaim.Status.Conditions)
960965

961966
if changed {
962967
deploymentTargetClaim.Status.Conditions = newConditions
963968

964-
if err := client.Status().Update(ctx, deploymentTargetClaim); err != nil {
969+
if err := k8sClient.Status().Update(ctx, deploymentTargetClaim); err != nil {
965970
log.Error(err, "unable to update deploymentTargetClaim status condition.")
966971
return err
967972
}

0 commit comments

Comments
 (0)