Skip to content

Commit 9f6103e

Browse files
committed
no resource message
1 parent a532f2f commit 9f6103e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

pkg/config/config.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (cfg *Config) validateReconcileConfigResources(supportedGVKs []schema.Group
398398
}
399399

400400
// Also validate the resource filter settings
401-
if err := cfg.validateReconcileResources(supportedGVKs); err != nil {
401+
if err := cfg.validateReconcileResources(validResourceNames); err != nil {
402402
return err
403403
}
404404

@@ -609,7 +609,7 @@ func parseReconcileResourcesString(resources string) ([]string, error) {
609609
}
610610

611611
// validateReconcileResources validates that the specified resource kinds are supported by the controller.
612-
func (cfg *Config) validateReconcileResources(supportedGVKs []schema.GroupVersionKind) error {
612+
func (cfg *Config) validateReconcileResources(validResourceNames []string) error {
613613
resources, err := cfg.GetReconcileResources()
614614
if err != nil {
615615
return fmt.Errorf("invalid value for flag '%s': %v", flagReconcileResources, err)
@@ -618,18 +618,13 @@ func (cfg *Config) validateReconcileResources(supportedGVKs []schema.GroupVersio
618618
return nil
619619
}
620620

621-
validResourceKinds := make([]string, 0, len(supportedGVKs))
622-
for _, gvk := range supportedGVKs {
623-
validResourceKinds = append(validResourceKinds, gvk.Kind)
624-
}
625-
626621
for _, resource := range resources {
627-
if !ackutil.InStrings(resource, validResourceKinds) {
622+
if !ackutil.InStrings(resource, validResourceNames) {
628623
return fmt.Errorf(
629624
"invalid value for flag '%s': resource kind '%s' is not supported by this controller. Valid resource kinds are: %s",
630625
flagReconcileResources,
631626
resource,
632-
strings.Join(validResourceKinds, ", "),
627+
strings.Join(validResourceNames, ", "),
633628
)
634629
}
635630
}

pkg/runtime/service_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,12 @@ func (c *serviceController) BindControllerManager(mgr ctrlrt.Manager, cfg ackcfg
278278
return fmt.Errorf("error parsing reconcile resources: %v", err)
279279
}
280280

281+
if len(reconcileResources) == 0 {
282+
c.log.Info("No resources? Did they all go on vacation? Defaulting to reconciling all resources.")
283+
}
281284
// Filter the resource manager factories
282285
filteredRMFs := c.rmFactories
283286
if len(reconcileResources) > 0 {
284-
285287
filteredRMFs = make(map[string]acktypes.AWSResourceManagerFactory)
286288
for key, rmf := range c.rmFactories {
287289
rd := rmf.ResourceDescriptor()

0 commit comments

Comments
 (0)