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

cluster-api: node template in scale-from-0-nodes scenario with DRA #7804

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ttsuuubasa
Copy link

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR makes cluster-api as Cloud Provider enable to return ResourceSlice which users specify of the node template (NodeInfo) in scale-from-0-nodes scenario by TemplateNodeInfo(). The node template informs Cluster Autoscaler about how resources the node to be spawned has like CPU, memory and GPU in the NodeGroup where no existing nodes are present. With the DRA expansion, the custom resources of the node like GPU is expressed by ResourceSlice, however, cluster-api as Cloud Provider had no way for users to have NodeInfo possess the ResourceSlice. That's why I added the following annotation to specify the DRA driver name and allow users to specify ResourceSlice of NodeInfo returned by TemplateNodeInfo(). This method by annotating follows the device plugin's way and the original annotations can also be used for the device plugin.

capacity.cluster-autoscaler.kubernetes.io/dra-driver: <driver-name>

Which issue(s) this PR fixes:

Fixes #7724

Special notes for your reviewer:

  • Although I stated the annotation for DRA pool name is also required in the above issue, the pool name typically is set as the node name. Therefore, I didn't institute the annotation for the pool name and it is configured to the node name internally.

  • The DRA handles not only GPUs but also other devices.
    The current PR's implementation regards the device as GPU when the DRA driver name and GPU count is specified.
    This may be no problem for the time being because most DRA drivers treat only GPU at this point but not expandable in the future.

  • TemplateNodeInfo() returns the slice of ResourceSlice but this modification include one ResourceSlice to the slice per Node.

Does this PR introduce a user-facing change?

Cloud Provider using cluster-api is extended to handle DRA devices such as GPU in the scale-from-0-nodes.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

[Usage]: https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/README.md#scale-from-zero-support

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 5, 2025
Copy link

linux-foundation-easycla bot commented Feb 5, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ttsuuubasa / name: Tsubasa Watanabe (3fbacf0)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 5, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @ttsuuubasa!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 5, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @ttsuuubasa. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/cluster-autoscaler labels Feb 5, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ttsuuubasa
Once this PR has been reviewed and has the lgtm label, please assign enxebre for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 area/provider/cluster-api Issues or PRs related to Cluster API provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 5, 2025
@ttsuuubasa ttsuuubasa force-pushed the capi-scale-from-0-nodes branch from 40c71bb to b5df22b Compare February 5, 2025 09:06
Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

this is looking good @ttsuuubasa , i have a few requests.

  • add unit tests to confirm the behavior of the new template options for dra in TestNodeGroupTemplateNodeInfo, in clusterapi_nodegroup_test.go.
  • add unit tests to confirm the behavior of InstanceResourceSlices, in clusterapi_unstructured_test.go.
  • update the README to include the new annotation name for DRA.

Modify TemplateNodeInfo() to return the template of ResourceSlice.
This is to address the DRA expansion of Cluster Autoscaler, allowing users to set the number of GPUs and DRA driver name by specifying
the annotation to NodeGroup provided by cluster-api.

Signed-off-by: Tsubasa Watanabe <[email protected]>
@ttsuuubasa ttsuuubasa force-pushed the capi-scale-from-0-nodes branch from b5df22b to 3fbacf0 Compare February 12, 2025 02:57
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 12, 2025
@ttsuuubasa
Copy link
Author

@elmiko
I added the two test cases you mentioned:

  • "When the NodeGroup can scale from zero and DRA is enabled, it creates ResourceSlice derived from the annotation of DRA driver name and GPU count" in TestNodeGroupTemplateNodeInfo, in clusterapi_nodegroup_test.go
  • The test to compare the expected ResourceSlice with one created by InstanceResourceSlices in TestAnnotations, in clusterapi_unstructured_test.go

I also update the README to explain the new annotation for DRA.

Could you please review it again?

@ttsuuubasa ttsuuubasa requested a review from elmiko February 12, 2025 05:27
@elmiko
Copy link
Contributor

elmiko commented Feb 12, 2025

thanks @ttsuuubasa , i will try to review before monday.

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

this is looking nice @ttsuuubasa , thank you!

i would like to get one more review on this, cc @jackfrancis might you be able to give a review?

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-autoscaler area/provider/cluster-api Issues or PRs related to Cluster API provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cluster-api: node template in scale-from-0-nodes scenario with DRA
3 participants