Repository navigation
Normalize k0s node names before drain, cordon, etc - #1095
Merged
Merged
Conversation
kv1sidisi
commented
Jun 11, 2026
Contributor
- 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.
Contributor
|
The commit needs to be signed off |
Lowercases/normalizes k0s node names before maintenance operations so node lookups match the kubelet-reported names. Co-authored-by: kv1sidisi <lyapunovvadim5002@gmail.com> Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
k0sctl 0.31.1 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## Notice The next release will contain #1092 only which is a significant refactoring to migrate the transport package [rig](https://github.com/k0sproject/rig) from v0.x to v2.0.0 - if issues surface, please report them and roll back to this v0.31.1 version. ## What's Changed * Bump actions/checkout from 6 to 7 by @dependabot[bot] in k0sproject/k0sctl#1105 * Normalize k0s node names before drain, cordon, etc by @kv1sidisi in k0sproject/k0sctl#1095 * Bump github.com/k0sproject/rig from 0.21.10 to 0.21.11 by @dependabot[bot] in k0sproject/k0sctl#1107 ## New Contributors * @kv1sidisi made their first contribution in k0sproject/k0sctl#1095 **Full Changelog**: k0sproject/k0sctl@v0.31.0...v0.31.1 ### SHA256 Checksums ``` c7dc5cdc7f8c006249d573229302612b8ef323ef4faff6a68ebe8c4aba83772d *k0sctl-linux-amd64 9107ce95f3762b2afbd0e5b9c7d4145e5749b36f3e1976c91873d04f6ae4f98f *k0sctl-linux-arm64 c7a09db15db08e238ecec548582f6045bf2fed4e418b3fb3f577f7dca277a2fa *k0sctl-linux-arm 659b4f308e5cbf8b8fcb9780c8f78675a39626a5c8918a94c9cce127d6e58b44 *k0sctl-linux-riscv64 77f83e76e0dafc372cda969c6e2206230900e83397b384c23868b323adcc1f96 *k0sctl-win-amd64.exe dda7dd02d9a9c962e8685f46e03715aac0c22c1c2a0b761dbee675e3bc4eb7f0 *k0sctl-darwin-amd64 1554b0a6643af6ef63c66d47c12e704e5e0f86d6480e8479f0a68dc2c179cd1a *k0sctl-darwin-arm64 ``` </pre> <p>View the full release notes at <a href="https://github.com/k0sproject/k0sctl/releases/tag/v0.31.1">https://github.com/k0sproject/k0sctl/releases/tag/v0.31.1</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!13292
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.