Use per hosts SANs for controllers in ConfigureK0S phase - #1128
Open
i-prudnikov wants to merge 2 commits into
Open
Use per hosts SANs for controllers in ConfigureK0S phase#1128i-prudnikov wants to merge 2 commits into
i-prudnikov wants to merge 2 commits into
Conversation
Signed-off-by: I. Prudnikov <22475397+i-prudnikov@users.noreply.github.com>
i-prudnikov
force-pushed
the
feat/avoid-cross-controllers-IP-in-SAN
branch
from
July 29, 2026 14:11
664bf2a to
3194e04
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the ConfigureK0s phase to generate controller-specific spec.api.sans lists (base SANs + that controller’s own addresses) instead of injecting a union of all controller addresses into every controller’s config. This aligns with k0sctl’s phase-driven orchestration by reducing unnecessary config churn (and resulting controller restarts) when adding new control-plane nodes.
Changes:
- Build a per-controller base config (
controllerBaseConfig) and inject per-host SANs via the newhostsSanshelper. - Update
configForto accept a caller-provided base config mapping, enabling per-host configuration inputs. - Add unit tests covering per-host SAN composition, deduplication, and non-mutation of shared base inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
phase/configure_k0s.go |
Switch SAN injection to per-controller configs; add hostsSans; update configFor signature and call sites. |
phase/configure_k0s_test.go |
Add tests validating per-host SAN behavior and config generation with per-host SANs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
120
to
124
| defer func() { | ||
| if err := h.Sudo().FS().Remove(tempConfigPath); err != nil { | ||
| log.Warnf("%s: failed to delete temporary file %s: %s", h, tempConfigPath, err) | ||
| if err := c.Sudo().FS().Remove(tempConfigPath); err != nil { | ||
| log.Warnf("%s: failed to delete temporary file %s: %s", c, tempConfigPath, err) | ||
| } | ||
| }() |
Contributor
Author
There was a problem hiding this comment.
Fixed (moved to helper function)
Signed-off-by: I. Prudnikov <22475397+i-prudnikov@users.noreply.github.com>
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.
This PR introduce dedicate SANs list per controller, rather than union of all CP nodes address.
The rationale behind:
This change keep all the same addresses injected into the SANs, but keep the SANs list to be dedicated per controller.