Skip to content

Fix behavior with external cloud provider and --hostname-override#124516

Merged
k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
danwinship:cloud-hostname-override
Apr 25, 2024
Merged

Fix behavior with external cloud provider and --hostname-override#124516
k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
danwinship:cloud-hostname-override

Conversation

@danwinship

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug
/kind regression

What this PR does / why we need it:

#121028 changed kubelet startup to not try to autodetect the node IP when using an external cloud provider, but accidentally also changed it to not write out the kubelet-provided hostname value.

Pre-121028, the if !nodeIPSpecified { return nil } wasn't there, so it ended up adding an autodetected node IP and the hostname below (whether that hostname was autodetected or overridden). This patch just revises that so we always add the hostname like before, we just don't write out the nodeIP if it wasn't user-specified.

(The 2 unit tests that this changes the behavior of are the 2 that were added in #121028.)

Which issue(s) this PR fixes:

Fixes #124453

Special notes for your reviewer:

The logic here can be simplified once we drop the legacy cloud provider case, but (a) I wasn't sure what that was waiting for, and (b) this patch needs to be backported anyway.

Does this PR introduce a user-facing change?

Fixed a regression where `kubelet --hostname-override` no longer worked
correctly with an external cloud provider.

/cc @aojea

@k8s-ci-robot k8s-ci-robot requested a review from aojea April 24, 2024 19:41
@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/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/regression Categorizes issue or PR as related to a regression from a prior release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 24, 2024
@aojea

aojea commented Apr 24, 2024

Copy link
Copy Markdown
Member

go fmt error is legit the other is a flake
lgtm

@dims

dims commented Apr 25, 2024

Copy link
Copy Markdown
Member

cc @cartermckinnon @tzneal

@cartermckinnon

Copy link
Copy Markdown
Contributor

/lgtm

thx for the fix!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2024
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: f6c3d6628a3b284b714b57ebdcf6bb3834b5f083

@danwinship danwinship force-pushed the cloud-hostname-override branch from 4da16d5 to 3097271 Compare April 25, 2024 12:12
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2024
@aojea

aojea commented Apr 25, 2024

Copy link
Copy Markdown
Member

/lgtm
/approve

/assign @thockin

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2024
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 0a9d24050e41a910a50ea9c8a399efee61fc195c

@kannon92

Copy link
Copy Markdown
Contributor

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Apr 25, 2024
@k8s-ci-robot k8s-ci-robot removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 25, 2024
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, danwinship, mrunalp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Development

Successfully merging this pull request may close these issues.

--hostname-override flag on kubelet is no longer used for Addresses.Hostname value in Kubernetes 1.29

9 participants