Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly initialize AWS instance status object #103

Conversation

domenicbozzuto
Copy link

@domenicbozzuto domenicbozzuto commented Mar 8, 2024

Fixes an issue where on AWS, a long-unregistered node would completely block scale-ups.

e5bc070 changed the behavior of getNotRegisteredNodes to filter out nodes that were not expected to register with

func expectedToRegister(instance cloudprovider.Instance) bool {
	return instance.Status != nil && instance.Status.State != cloudprovider.InstanceDeleting && instance.Status.ErrorInfo == nil
}

However, the instance.Status field is optional, and not all cloud providers set this. Notably, AWS did not initialize this unless a 'placeholder' instance was set, such that in normal circumstances, AWS instances will have nil as a status. This meant that expectedToRegister would return false, and the host would not have an entry appended to the notRegistered slice of nodes.

This explicitly initializes AWS's instanceStatus struct, which means that for a long unregistered node, expectedToRegister should now properly return true, and the normal mechanisms for clearing a long unregistered node can operate on it.

@domenicbozzuto
Copy link
Author

domenicbozzuto commented Mar 8, 2024

The other way to fix this would be to assume an instance is expected to register if instance.Status is nil (since the field is explicitly optional)

func expectedToRegister(instance cloudprovider.Instance) bool {
        if instance.Status == nil {
                return true
        } 
	return instance.Status.State != cloudprovider.InstanceDeleting && instance.Status.ErrorInfo == nil
}

EDIT: it looks like this was recently fixed upstream, exactly this way: kubernetes#6528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant