Skip to content

Normalize k0s node names before maintenance#1095

Open
kv1sidisi wants to merge 2 commits into
k0sproject:mainfrom
kv1sidisi:fix-node-name-case
Open

Normalize k0s node names before maintenance#1095
kv1sidisi wants to merge 2 commits into
k0sproject:mainfrom
kv1sidisi:fix-node-name-case

Conversation

@kv1sidisi

Copy link
Copy Markdown
  • Normalize node names to lowercase before kubectl maintenance and readiness checks.
  • Catch case-only hostname duplicates earlier and keep reset flows aligned with the same node identity.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes how k0sctl derives the Kubernetes node name from a host by normalizing hostnames to lowercase before running kubectl-based readiness checks and node maintenance operations, and by validating hostname uniqueness using the normalized node identity.

Changes:

  • Introduces Host.KubernetesNodeName() (lowercased hostname) and switches kubectl node operations (drain/cordon/uncordon/delete/taints) to use it.
  • Updates node readiness checks and reset flows to reference the normalized node name.
  • Updates host validation to detect case-only hostname duplicates earlier; adds a unit test for KubernetesNodeName().

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/node/statusfunc.go Uses normalized node name for kubectl get node readiness checks and related error messages.
pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/host.go Adds KubernetesNodeName() and applies it across kubectl node maintenance helpers.
pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/host_test.go Adds unit test ensuring node name normalization behavior.
phase/validate_hosts.go Validates hostname uniqueness using the normalized Kubernetes node name.
phase/reset_workers.go Uses normalized node name when draining/deleting worker nodes during reset.
phase/reset_controllers.go Uses normalized node name when draining/deleting controller-worker nodes during reset.
phase/gather_k0s_facts.go Logs worker-join readiness checks using the normalized node name.
phase/gather_facts.go Normalizes configured hostname override to lowercase when setting host metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phase/validate_hosts.go
kv1sidisi and others added 2 commits June 15, 2026 15:07
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
@kke kke force-pushed the fix-node-name-case branch from f2cdec5 to 4dd6a41 Compare June 15, 2026 12:08
@kke

kke commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The commit needs to be signed off

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.

3 participants