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

[release-1.21] Use FQDN for node name if cloud provider is set to AWS #1622

Merged
merged 2 commits into from
Aug 12, 2021

Conversation

galal-hussein
Copy link
Contributor

Proposed Changes

Use FQDN hostname for node name if --node-name is not set and --cloud-provider-name is set to AWS

Yes we should mention that if the user didn't enter a specific node name and cloud provider is set to aws then node name will default to hostname -f

Types of Changes

Bug Fix

Verification

  • Start k3s server with cloud-provider-name=aws

Linked Issues

#1618

Further Comments

@galal-hussein galal-hussein requested a review from a team as a code owner August 12, 2021 20:15
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

minor nit on string trimming, but lgtm!

Comment on lines 204 to 207
fqdn := b.String()
fqdn = fqdn[:len(fqdn)-1]

return fqdn, nil
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fqdn := b.String()
fqdn = fqdn[:len(fqdn)-1]
return fqdn, nil
return strings.TrimSpace(b.String()), nil

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do this, then we don't need line 205.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 69 to 70
nodeName := clx.String("node-name")
if nodeName == "" && cfg.CloudProviderName == "aws" {
Copy link
Member

Choose a reason for hiding this comment

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

We only appear to use the nodeName in the test; don't bother creating a variable for it?

Suggested change
nodeName := clx.String("node-name")
if nodeName == "" && cfg.CloudProviderName == "aws" {
if clx.String("node-name") == "" && cfg.CloudProviderName == "aws" {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@galal-hussein galal-hussein requested a review from brandond August 12, 2021 20:55
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

LGTM. I think at some point we might want this function in a util package somewhere, but that doesn't have to happen now.

@galal-hussein galal-hussein merged commit ff0daf4 into rancher:release-1.21 Aug 12, 2021
@brandond brandond changed the title Use FQDN for node name if cloud provider is set to AWS [release-1.21] Use FQDN for node name if cloud provider is set to AWS Aug 13, 2021
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