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

Use PrivateDnsName as Node name in nodeadm #1715

Merged
merged 1 commit into from
Mar 13, 2024
Merged

Conversation

cartermckinnon
Copy link
Member

Issue #, if available:

#1711

Description of changes:

Sets the --hostname-override on k8s 1.26+ to the EC2 PrivateDnsName.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cartermckinnon cartermckinnon force-pushed the nodeadm-privatednsname branch 3 times, most recently from 0657a2b to 28671c8 Compare March 8, 2024 07:30

// Discovers all cluster details using a describe call to the eks endpoint and
// updates the value of the config's `ClusterDetails` in-place
func populateClusterDetails(eksClient *eks.EKS, clusterName string, cfg *api.NodeConfig) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

This was unused and we've decided to require these args in the user data.

@cartermckinnon cartermckinnon force-pushed the nodeadm-privatednsname branch 2 times, most recently from a7014d6 to 0d404a2 Compare March 8, 2024 07:38

"github.com/aws/aws-sdk-go-v2/feature/ec2/imds"
"github.com/aws/aws-sdk-go/service/eks"
"github.com/aws/aws-sdk-go-v2/service/ec2"
Copy link
Member

Choose a reason for hiding this comment

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

thank you for the -28k lines 😂

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the least I could do ☺️

@@ -249,7 +249,9 @@ func (ksc *kubeletConfig) withCloudProvider(kubeletVersion string, cfg *api.Node
flags["cloud-provider"] = "external"
// provider ID needs to be specified when the cloud provider is external
ksc.ProviderID = ptr.String(getProviderId(cfg.Status.Instance.AvailabilityZone, cfg.Status.Instance.ID))
// TODO set the --hostname-override equal to the EC2 PrivateDnsName
Copy link
Member

Choose a reason for hiding this comment

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

IIRC think there's a unit test with the corresponding TODO

Copy link
Member Author

Choose a reason for hiding this comment

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

this is just a fork of the internal waiter impls in the SDK, very little net-new code

@cartermckinnon
Copy link
Member Author

/ci

Seeing what the runtime behavior looks like while I update the e2e tests...

Copy link
Contributor

github-actions bot commented Mar 9, 2024

@cartermckinnon roger that! I've dispatched a workflow. 👍

Copy link
Contributor

github-actions bot commented Mar 9, 2024

@cartermckinnon the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.23 / al2success ✅success ✅
1.23 / al2023success ✅failure ❌
1.24 / al2success ✅success ✅
1.24 / al2023success ✅failure ❌
1.25 / al2success ✅success ✅
1.25 / al2023success ✅failure ❌
1.26 / al2success ✅success ✅
1.26 / al2023success ✅failure ❌
1.27 / al2success ✅success ✅
1.27 / al2023success ✅failure ❌
1.28 / al2success ✅success ✅
1.28 / al2023success ✅failure ❌
1.29 / al2success ✅success ✅
1.29 / al2023success ✅failure ❌

@cartermckinnon
Copy link
Member Author

/ci

Copy link
Contributor

@cartermckinnon roger that! I've dispatched a workflow. 👍

Copy link
Contributor

@cartermckinnon the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.23 / al2success ✅success ✅
1.23 / al2023success ✅failure ❌
1.24 / al2success ✅success ✅
1.24 / al2023success ✅failure ❌
1.25 / al2success ✅success ✅
1.25 / al2023success ✅failure ❌
1.26 / al2success ✅success ✅
1.26 / al2023success ✅failure ❌
1.27 / al2success ✅success ✅
1.27 / al2023success ✅failure ❌
1.28 / al2success ✅success ✅
1.28 / al2023success ✅failure ❌
1.29 / al2success ✅success ✅
1.29 / al2023success ✅failure ❌

@cartermckinnon
Copy link
Member Author

/ci

Problem was that the aws-go-sdk-v2 doesn't detect the runtime region from IMDS automatically, you have to enable this behavior with a config option.

Copy link
Contributor

@cartermckinnon roger that! I've dispatched a workflow. 👍

Copy link
Contributor

@cartermckinnon the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.23 / al2success ✅success ✅
1.23 / al2023success ✅success ✅
1.24 / al2success ✅success ✅
1.24 / al2023success ✅success ✅
1.25 / al2success ✅success ✅
1.25 / al2023success ✅success ✅
1.26 / al2success ✅success ✅
1.26 / al2023success ✅success ✅
1.27 / al2success ✅success ✅
1.27 / al2023success ✅success ✅
1.28 / al2success ✅success ✅
1.28 / al2023success ✅success ✅
1.29 / al2success ✅success ✅
1.29 / al2023success ✅success ✅

@@ -145,7 +145,14 @@ func (c *initCmd) Run(log *zap.Logger, opts *cli.GlobalOptions) error {
// perform in-place updates when allowed by the user
func enrichConfig(log *zap.Logger, cfg *api.NodeConfig) error {
log.Info("Fetching instance details..")
instanceDetails, err := api.GetIMDSInstanceDetails(context.TODO(), imds.New(imds.Options{}))
imdsClient := imds.New(imds.Options{})
awsConfig, err := config.LoadDefaultConfig(context.TODO(), config.WithClientLogMode(aws.LogRetries), config.WithEC2IMDSRegion(func(o *config.UseEC2IMDSRegion) {
Copy link
Member

Choose a reason for hiding this comment

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

ah! thanks for the fix. 💚

@Issacwww Issacwww merged commit b04bed6 into main Mar 13, 2024
10 checks passed
@Issacwww Issacwww deleted the nodeadm-privatednsname branch March 13, 2024 00:01
@iodeslykos
Copy link

Beautiful! Thank you for this fix, @cartermckinnon.

joelddiaz pushed a commit to joelddiaz/amazon-eks-ami that referenced this pull request May 29, 2024
atmosx pushed a commit to gathertown/amazon-eks-ami that referenced this pull request Jun 18, 2024
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.

4 participants