@@ -945,7 +945,7 @@ func createSpaceRequestForDTC(ctx context.Context, k8sClient client.Client, dtc
945
945
}
946
946
947
947
// updateStatusConditionOfDeploymentTargetClaim calls SetCondition() with DeploymentTargetClaim conditions
948
- func updateStatusConditionOfDeploymentTargetClaim (ctx context.Context , client client.Client ,
948
+ func updateStatusConditionOfDeploymentTargetClaim (ctx context.Context , k8sClient client.Client ,
949
949
message string , deploymentTargetClaim * applicationv1alpha1.DeploymentTargetClaim , conditionType string ,
950
950
status metav1.ConditionStatus , reason string , log logr.Logger ) error {
951
951
@@ -956,12 +956,17 @@ func updateStatusConditionOfDeploymentTargetClaim(ctx context.Context, client cl
956
956
Reason : reason ,
957
957
}
958
958
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
+
959
964
changed , newConditions := insertOrUpdateConditionsInSlice (newCondition , deploymentTargetClaim .Status .Conditions )
960
965
961
966
if changed {
962
967
deploymentTargetClaim .Status .Conditions = newConditions
963
968
964
- if err := client .Status ().Update (ctx , deploymentTargetClaim ); err != nil {
969
+ if err := k8sClient .Status ().Update (ctx , deploymentTargetClaim ); err != nil {
965
970
log .Error (err , "unable to update deploymentTargetClaim status condition." )
966
971
return err
967
972
}
0 commit comments