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) diff --git a/pkg/cloudprovider/machine_test.go b/pkg/cloudprovider/machine_test.go index 0e2007b847e5..ca22e1bd352b 100644 --- a/pkg/cloudprovider/machine_test.go +++ b/pkg/cloudprovider/machine_test.go @@ -655,7 +655,7 @@ var _ = Describe("Machine/CloudProvider", func() { createFleetInput = awsEnv.EC2API.CreateFleetBehavior.CalledWithInput.Pop() Expect(fake.SubnetsFromFleetRequest(createFleetInput)).To(ConsistOf("test-subnet-2")) }) - It("should launch instances with an alternate provisioner when an awsnodetemplate selects 0 subnets, security groups, or amis", func() { + FIt("should launch instances with an alternate provisioner when an awsnodetemplate selects 0 subnets, security groups, or amis", func() { misconfiguredNodeTemplate := test.AWSNodeTemplate(v1alpha1.AWSNodeTemplateSpec{ AWS: v1alpha1.AWS{ // select nothing! @@ -666,12 +666,12 @@ var _ = Describe("Machine/CloudProvider", func() { // select nothing! AMISelector: map[string]string{"Name": "nothing"}, }) + misconfiguredNodeTemplate.Name = "misconfigured" prov2 := test.Provisioner(coretest.ProvisionerOptions{ ProviderRef: &v1alpha5.MachineTemplateRef{ APIVersion: misconfiguredNodeTemplate.APIVersion, Kind: misconfiguredNodeTemplate.Kind, - // select nothing! - Name: "nothing", + Name: "misconfigured", }, }) ExpectApplied(ctx, env.Client, provisioner, prov2, nodeTemplate, misconfiguredNodeTemplate)