Skip to content

Conversation

@bpickard22
Copy link
Collaborator

@bpickard22 bpickard22 commented Feb 14, 2025

Host name in /etc/host can differ from the nodename in the k8s API, so we standardize the way we calculate the hostname -- always from the K8s API, and then write it to a file on the host so that the CNI plugin side can always read it.

Contributer: @dougbtv the goat

@bpickard22 bpickard22 requested a review from dougbtv as a code owner February 14, 2025 22:57
@coveralls
Copy link

coveralls commented Feb 14, 2025

Pull Request Test Coverage Report for Build 13444567631

Details

  • 0 of 11 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 51.522%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/storage/kubernetes/ipam.go 0 11 0.0%
Totals Coverage Status
Change from base Build 13443484998: -0.05%
Covered Lines: 1963
Relevant Lines: 3810

💛 - Coveralls

@dougbtv dougbtv changed the title Host name resolution Host name determination from k8s api Feb 19, 2025
@bpickard22
Copy link
Collaborator Author

ran e2e locally and all 27 of them passed @dougbtv

return normalizedIP
}

// TODO: what's the best way to discover the node name? this should work in both controller pod and whereabouts host process
Copy link
Member

Choose a reason for hiding this comment

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

Let's update this line with:

getNodeName prefers an OS env var of NODENAME, or, uses a file named ./nodename in the whereabouts configuration path.

Copy link
Member

@dougbtv dougbtv left a comment

Choose a reason for hiding this comment

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

just some nits to clean up, thanks for this one Ben

return "", err
file, err = os.Open("/etc/hostname")
if err != nil {
logging.Errorf("Error opening nodeNameFile, defaulted to /etc/hostname: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

let's change this to:

logging.Errorf("Could not determine nodename and could not open /etc/hostname: %v", err)

AWS and GCP host name on /etc/host differs so we need to standardize the
way we resolve the node name on the host

Contributer: @dougbtv the goat

Signed-off-by: Benjamin Pickard <[email protected]>
Copy link
Member

@dougbtv dougbtv left a comment

Choose a reason for hiding this comment

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

lgtm! appreciate it Ben

@dougbtv
Copy link
Member

dougbtv commented Feb 20, 2025

e2e test is flaking in the same spots. it's unrelated. thanks Ben, appreciate you spiffing it up.

@dougbtv dougbtv merged commit 9a0f4b7 into k8snetworkplumbingwg:master Feb 20, 2025
10 of 11 checks passed
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