Skip to content

Commit

Permalink
Remove all SANs manipulation as k0s does it on its own
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Oct 22, 2024
1 parent b29d590 commit 65f0c0c
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions phase/configure_k0s.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,44 +298,12 @@ func (p *ConfigureK0s) configFor(h *cluster.Host) (string, error) {
cfg = p.newBaseConfig.Dup()
}

var sans []string

var addr string
if h.PrivateAddress != "" {
addr = h.PrivateAddress
} else {
addr = h.Address()
}
cfg.DigMapping("spec", "api")["address"] = addr
addUnlessExist(&sans, addr)

if externalAddr := cfg.DigString("spec", "api", "externalAddress"); externalAddr != "" {
addUnlessExist(&sans, externalAddr)
}

oldsans := cfg.Dig("spec", "api", "sans")
switch oldsans := oldsans.(type) {
case []interface{}:
for _, v := range oldsans {
if s, ok := v.(string); ok {
addUnlessExist(&sans, s)
}
}
case []string:
for _, v := range oldsans {
addUnlessExist(&sans, v)
}
}

var controllers cluster.Hosts = p.Config.Spec.Hosts.Controllers()
for _, c := range controllers {
addUnlessExist(&sans, c.Address())
if c.PrivateAddress != "" {
addUnlessExist(&sans, c.PrivateAddress)
}
}
addUnlessExist(&sans, "127.0.0.1")
cfg.DigMapping("spec", "api")["sans"] = sans

if cfg.Dig("spec", "storage", "etcd", "peerAddress") != nil || h.PrivateAddress != "" {
cfg.DigMapping("spec", "storage", "etcd")["peerAddress"] = addr
Expand Down

0 comments on commit 65f0c0c

Please sign in to comment.