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

annotate fakeNodes so that cloudprovider implementations can identify them #4119

Merged

Conversation

marwanad
Copy link
Member

@marwanad marwanad commented Jun 6, 2021

This adds an annotation to the "fakeNode" used by CA for unregistered node. This can be useful for cloudproviders in the DeleteNode() method to have some custom error handling logic and also identify the reason for the fakeNode. (For now, it seems only GCE would make use of the nodes created with error path)

An example of how we want to leverage that: we don't want to decrement the cached NodeGroup capacity in Azure because the capacity reported by APIs won't include Failed instances so the cache will end up drifting unnecessarily from the real capacity and can inadvertently lead to a scale down if some conditions align.

I've noticed the packet provider tries to identify some via providerId but I don't think this is a reliable way. Similar with the magnum provider via the object UID. I think a namespaced annotation would be a convenient way for identification.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 6, 2021
@k8s-ci-robot k8s-ci-robot requested review from feiskyer and Jeffwan June 6, 2021 20:46
@marwanad marwanad force-pushed the annotate-unregistered-nodes branch 2 times, most recently from 8bffb5a to 92bba5b Compare June 6, 2021 20:49
@marwanad marwanad force-pushed the annotate-unregistered-nodes branch from 92bba5b to 36460df Compare June 6, 2021 20:54

// FakeNodeReasonAnnotation is an annotation added to the fake placeholder nodes CA has created
// Note that this don't map to real nodes in k8s and are merely used for error handling
FakeNodeReasonAnnotation = "k8s.io/cluster-autoscaler/fake-node-reason"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the stated goal is to use those annotations in cloudprovider, won't declaring them here risk cyclic dependency problems? I think it's much cleaner to aim at situation where cloudprovider doesn't need to import core CA modules.
Maybe we can declare those consts in cloudprovider.go instead? This has an added benefit of making them easier to discover for anyone implementing new provider.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - good call on that!

@MaciekPytel
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 9, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MaciekPytel, marwanad

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 9, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9a95395 into kubernetes:master Jun 9, 2021
@marwanad marwanad deleted the annotate-unregistered-nodes branch June 9, 2021 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants