From 81260d31dd1d1913840a297ddea0c93ca2996bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20H=C3=B6rsken?= Date: Mon, 4 Nov 2024 13:44:15 +0100 Subject: [PATCH] Default apiserver address to privateAddress if onlyBindToAddress (#777) --- phase/configure_k0s.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phase/configure_k0s.go b/phase/configure_k0s.go index 4f252ead..8fc86086 100644 --- a/phase/configure_k0s.go +++ b/phase/configure_k0s.go @@ -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 }