Skip to content

Commit

Permalink
Default apiserver address to privateAddress if onlyBindToAddress (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k authored Nov 4, 2024
1 parent 8e58c29 commit 81260d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions phase/configure_k0s.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ func (p *ConfigureK0s) configFor(h *cluster.Host) (string, error) {
addr = h.Address()
}

if cfg.DigString("spec", "api", "address") == "" {
if onlyBindAddr, ok := cfg.Dig("spec", "api", "onlyBindToAddress").(bool); ok && onlyBindAddr {
cfg.DigMapping("spec", "api")["address"] = addr
}
}

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

0 comments on commit 81260d3

Please sign in to comment.