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

✨ Implement support for EFA interface type #5275

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

Conversation

RadekManak
Copy link

@RadekManak RadekManak commented Jan 13, 2025

What type of PR is this?

/kind feature

What this PR does / why we need it:
This PR adds a new enum field to AWSMachineSpec called NetworkInterfaceType that configures the type of the first interface (also called primary interface) on the created instance.

The two values are:
NetworkInterfaceTypeENI: The network interface will be ENI. Currently, AWS defaults to this type when not specified.
NetworkInterfaceTypeEFAWithENAInterface: This option sets up both ENA (for IP networking) and EFA interface for HPC connections.

Fixes #3035

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests

Release note:

Add support for creating instances with elastic fabric adapter interface type.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 13, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fabriziopandini 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
Copy link
Contributor

Welcome @RadekManak!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-aws 🎉. 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-sigs/cluster-api-provider-aws 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
Copy link
Contributor

Hi @RadekManak. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 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. labels Jan 13, 2025
@nrb
Copy link
Contributor

nrb commented Jan 13, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 13, 2025
@@ -153,6 +163,11 @@ type AWSMachineSpec struct {
// +kubebuilder:validation:MaxItems=2
NetworkInterfaces []string `json:"networkInterfaces,omitempty"`

// NetworkInterfaceType is the interface type of the primary network Interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe mention here that the default is interface and that "" and interface are equivalent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can have explicit default here? E.g. // +kubebuilder:default=interface

Choose a reason for hiding this comment

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

Is it possible in the future that we might want to change the default? For example, what if Amazon deprecates the current interface type and makes EFA the choice, we would want to move folks across to EFA. If we add an explicit default here, then they would have to manually update their configs to move across should things ever change

Copy link
Author

Choose a reason for hiding this comment

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

Added note that when field is not set, aws defaults the value.

@nrb
Copy link
Contributor

nrb commented Jan 13, 2025

Overall looks good, just one small comment.

/assign @damdo

// NetworkInterfaceType is the type of network interface.
type NetworkInterfaceType string

const (

Choose a reason for hiding this comment

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

Should we follow Kube conventions and use PascalCase rather than these lowercase version, so Interface and EFA

Copy link
Author

Choose a reason for hiding this comment

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

I used the aws API values. The API is case insensitive so I think it is safe to use PascalCase.

Copy link
Author

Choose a reason for hiding this comment

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

In the future, we may want to add other interface types.

Is the correct approach to use PascalCase and convert to the API options?
If for e.g. we want to add EFA only interface that is "efa-only" do we use "EFAOnly" and have dict to convert them? Or is parity with API preferred here?

// NetworkInterfaceType is the interface type of the primary network Interface.
// +kubebuilder:validation:Enum=interface;efa
// +optional
NetworkInterfaceType *NetworkInterfaceType `json:"networkInterfaceType,omitempty"`

Choose a reason for hiding this comment

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

Does this need to be a pointer? There's no difference between "" and a nil value right?

Copy link
Author

Choose a reason for hiding this comment

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

I used the pointer to avoid "" value being passed through to the AWS API.

Changed to non-pointer and updated the code to not set empty string on the AWS API call.

Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something, but isn't "" passed to the AWS API due to Go's defaulting to zero values?

Copy link
Author

Choose a reason for hiding this comment

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

The AWS API call still uses *string. I added a condition to keep the value nil when "" value is on the spec. https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/5275/files#diff-4d2ea189a70ea097ffeeb50f78cc676a224386d4fe17b1bec9c83a4731d9c379R586-R589

@RadekManak RadekManak force-pushed the efa-support branch 4 times, most recently from f8138bc to 51631e7 Compare January 23, 2025 11:03
@RadekManak
Copy link
Author

/test pull-cluster-api-provider-aws-test
Not quite sure why this failed getting bootstrap-data-new, seems unrelated.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 24, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. needs-priority needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

AWS Elastic Fabric Adapter support
6 participants