Normalize k0s node names before maintenance#1095
Open
kv1sidisi wants to merge 2 commits into
Open
Conversation
kv1sidisi
commented
Jun 11, 2026
- 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.
There was a problem hiding this comment.
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.
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Contributor
|
The commit needs to be signed off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.