Skip to content

Commit a69ab2e

Browse files
committed
Check scope error before setting binding to improve legibility
1 parent 199fcce commit a69ab2e

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

exp/addons/internal/controllers/clusterresourceset_controller.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,19 @@ func (r *ClusterResourceSetReconciler) ApplyClusterResourceSet(ctx context.Conte
299299
}
300300

301301
resourceScope, err := reconcileScopeForResource(clusterResourceSet, resource, resourceSetBinding, unstructuredObj)
302-
if err == nil && !resourceScope.needsApply() {
302+
if err != nil {
303+
resourceSetBinding.SetBinding(addonsv1.ResourceBinding{
304+
ResourceRef: resource,
305+
Hash: "",
306+
Applied: false,
307+
LastAppliedTime: &metav1.Time{Time: time.Now().UTC()},
308+
})
309+
310+
errList = append(errList, err)
311+
continue
312+
}
313+
314+
if !resourceScope.needsApply() {
303315
continue
304316
}
305317

@@ -312,11 +324,6 @@ func (r *ClusterResourceSetReconciler) ApplyClusterResourceSet(ctx context.Conte
312324
LastAppliedTime: &metav1.Time{Time: time.Now().UTC()},
313325
})
314326

315-
if err != nil {
316-
errList = append(errList, err)
317-
continue
318-
}
319-
320327
// Apply all values in the key-value pair of the resource to the cluster.
321328
// As there can be multiple key-value pairs in a resource, each value may have multiple objects in it.
322329
isSuccessful := true

0 commit comments

Comments
 (0)