From 346b2364ea0d68724c3e828fe5d18889cd692fa2 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Thu, 28 Sep 2023 07:45:27 -0500 Subject: [PATCH] fix: report an error when the node template is not found Without this change, no instance types are found and the resulting behavior is a generic error regarding not finding instance types. --- pkg/cloudprovider/cloudprovider.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/cloudprovider.go b/pkg/cloudprovider/cloudprovider.go index 802ede1d2d4d..64ad849e4776 100644 --- a/pkg/cloudprovider/cloudprovider.go +++ b/pkg/cloudprovider/cloudprovider.go @@ -177,7 +177,10 @@ func (c *CloudProvider) GetInstanceTypes(ctx context.Context, nodePool *corev1be if errors.IsNotFound(err) { c.recorder.Publish(cloudproviderevents.NodePoolFailedToResolveNodeClass(nodePool)) } - return nil, client.IgnoreNotFound(fmt.Errorf("resolving node class, %w", err)) + // We must return an error here in the event of the node class not being found. Otherwise users just get + // no instance types and a failure to schedule with no indicator pointing to a bad configuration + // as the cause. + return nil, fmt.Errorf("resolving node class, %w", err) } // TODO, break this coupling instanceTypes, err := c.instanceTypeProvider.List(ctx, nodePool.Spec.Template.Spec.Kubelet, nodeClass)