@@ -18,6 +18,7 @@ package clusterresourceset
18
18
19
19
import (
20
20
"context"
21
+ "fmt"
21
22
22
23
"github.com/pkg/errors"
23
24
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -58,7 +59,7 @@ func reconcileScopeForResource(
58
59
return nil , err
59
60
}
60
61
61
- return newResourceReconcileScope (crs , resourceRef , resourceSetBinding , normalizedData , objs ), nil
62
+ return newResourceReconcileScope (crs , resourceRef , resourceSetBinding , normalizedData , objs )
62
63
}
63
64
64
65
func newResourceReconcileScope (
@@ -67,7 +68,7 @@ func newResourceReconcileScope(
67
68
resourceSetBinding * addonsv1.ResourceSetBinding ,
68
69
normalizedData [][]byte ,
69
70
objs []unstructured.Unstructured ,
70
- ) resourceReconcileScope {
71
+ ) ( resourceReconcileScope , error ) {
71
72
base := baseResourceReconcileScope {
72
73
clusterResourceSet : clusterResourceSet ,
73
74
resourceRef : resourceRef ,
@@ -79,11 +80,11 @@ func newResourceReconcileScope(
79
80
80
81
switch addonsv1 .ClusterResourceSetStrategy (clusterResourceSet .Spec .Strategy ) {
81
82
case addonsv1 .ClusterResourceSetStrategyApplyOnce :
82
- return & reconcileApplyOnceScope {base }
83
+ return & reconcileApplyOnceScope {base }, nil
83
84
case addonsv1 .ClusterResourceSetStrategyReconcile :
84
- return & reconcileStrategyScope {base }
85
+ return & reconcileStrategyScope {base }, nil
85
86
default :
86
- return nil
87
+ return nil , errors . Errorf ( "unsupported or empty resource strategy: %q" , clusterResourceSet . Spec . Strategy )
87
88
}
88
89
}
89
90
@@ -173,7 +174,7 @@ func (r *reconcileApplyOnceScope) applyObj(ctx context.Context, c client.Client,
173
174
174
175
type applyObj func (ctx context.Context , c client.Client , obj * unstructured.Unstructured ) error
175
176
176
- // apply reconciles unstructured objects using applyObj and aggreates the error if present.
177
+ // apply reconciles unstructured objects using applyObj and aggregates the error if present.
177
178
func apply (ctx context.Context , c client.Client , applyObj applyObj , objs []unstructured.Unstructured ) error {
178
179
errList := []error {}
179
180
for i := range objs {
0 commit comments