diff --git a/pkg/controllers/nodeclass/status/ami.go b/pkg/controllers/nodeclass/status/ami.go index faf94d2dac08..9f0bc79da083 100644 --- a/pkg/controllers/nodeclass/status/ami.go +++ b/pkg/controllers/nodeclass/status/ami.go @@ -42,7 +42,9 @@ func (a *AMI) Reconcile(ctx context.Context, nodeClass *v1.EC2NodeClass) (reconc if len(amis) == 0 { nodeClass.Status.AMIs = nil nodeClass.StatusConditions().SetFalse(v1.ConditionTypeAMIsReady, "AMINotFound", "AMISelector did not match any AMIs") - return reconcile.Result{}, nil + // If users have omitted the necessary tags from their AMIs and later add them, we need to reprocess the information. + // Returning 'ok' in this case means that the nodeclass will remain in an unready state until the component is restarted. + return reconcile.Result{RequeueAfter: 2 * time.Minute}, nil } nodeClass.Status.AMIs = lo.Map(amis, func(ami amifamily.AMI, _ int) v1.AMI { reqs := lo.Map(ami.Requirements.NodeSelectorRequirements(), func(item karpv1.NodeSelectorRequirementWithMinValues, _ int) corev1.NodeSelectorRequirement { diff --git a/pkg/controllers/nodeclass/status/securitygroup.go b/pkg/controllers/nodeclass/status/securitygroup.go index f003b2dfd3ea..44b4be217e55 100644 --- a/pkg/controllers/nodeclass/status/securitygroup.go +++ b/pkg/controllers/nodeclass/status/securitygroup.go @@ -40,7 +40,9 @@ func (sg *SecurityGroup) Reconcile(ctx context.Context, nodeClass *v1.EC2NodeCla if len(securityGroups) == 0 && len(nodeClass.Spec.SecurityGroupSelectorTerms) > 0 { nodeClass.Status.SecurityGroups = nil nodeClass.StatusConditions().SetFalse(v1.ConditionTypeSecurityGroupsReady, "SecurityGroupsNotFound", "SecurityGroupSelector did not match any SecurityGroups") - return reconcile.Result{}, nil + // If users have omitted the necessary tags from their SecurityGroups and later add them, we need to reprocess the information. + // Returning 'ok' in this case means that the nodeclass will remain in an unready state until the component is restarted. + return reconcile.Result{RequeueAfter: 2 * time.Minute}, nil } sort.Slice(securityGroups, func(i, j int) bool { return *securityGroups[i].GroupId < *securityGroups[j].GroupId diff --git a/pkg/controllers/nodeclass/status/subnet.go b/pkg/controllers/nodeclass/status/subnet.go index 4e71dd0384a1..28964cafa59e 100644 --- a/pkg/controllers/nodeclass/status/subnet.go +++ b/pkg/controllers/nodeclass/status/subnet.go @@ -40,7 +40,9 @@ func (s *Subnet) Reconcile(ctx context.Context, nodeClass *v1.EC2NodeClass) (rec if len(subnets) == 0 { nodeClass.Status.Subnets = nil nodeClass.StatusConditions().SetFalse(v1.ConditionTypeSubnetsReady, "SubnetsNotFound", "SubnetSelector did not match any Subnets") - return reconcile.Result{}, nil + // If users have omitted the necessary tags from their Subnets and later add them, we need to reprocess the information. + // Returning 'ok' in this case means that the nodeclass will remain in an unready state until the component is restarted. + return reconcile.Result{RequeueAfter: 2 * time.Minute}, nil } sort.Slice(subnets, func(i, j int) bool { if int(*subnets[i].AvailableIpAddressCount) != int(*subnets[j].AvailableIpAddressCount) { diff --git a/pkg/providers/amifamily/ami.go b/pkg/providers/amifamily/ami.go index fd09b3684039..185b4cac1d52 100644 --- a/pkg/providers/amifamily/ami.go +++ b/pkg/providers/amifamily/ami.go @@ -64,7 +64,7 @@ func NewDefaultProvider(clk clock.Clock, versionProvider version.Provider, ssmPr } } -// Get Returning a list of AMIs with its associated requirements +// List Returning a list of AMIs with its associated requirements func (p *DefaultProvider) List(ctx context.Context, nodeClass *v1.EC2NodeClass) (AMIs, error) { p.Lock() defer p.Unlock()