mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
configure corrosion bootstrap peers when initialising a machine
This commit is contained in:
@@ -32,6 +32,7 @@ type DBConfig struct {
|
|||||||
|
|
||||||
type GossipConfig struct {
|
type GossipConfig struct {
|
||||||
Addr netip.AddrPort `toml:"addr"`
|
Addr netip.AddrPort `toml:"addr"`
|
||||||
|
Bootstrap []string `toml:"bootstrap"`
|
||||||
Plaintext bool `toml:"plaintext"`
|
Plaintext bool `toml:"plaintext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,15 @@ func (m *Machine) configureCorrosion(dataDir string) error {
|
|||||||
}
|
}
|
||||||
corroConfigPath := filepath.Join(dataDir, "config.toml")
|
corroConfigPath := filepath.Join(dataDir, "config.toml")
|
||||||
|
|
||||||
|
// TODO: use a partial list of machine peers for bootstrapping if the cluster is large.
|
||||||
|
var bootstrap []string
|
||||||
|
for _, peer := range m.state.Network.Peers {
|
||||||
|
if peer.Subnet == nil {
|
||||||
|
// Skip non-machine peers.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
bootstrap = append(bootstrap, netip.AddrPortFrom(peer.ManagementIP, corrosion.DefaultGossipPort).String())
|
||||||
|
}
|
||||||
cfg := corrosion.Config{
|
cfg := corrosion.Config{
|
||||||
DB: corrosion.DBConfig{
|
DB: corrosion.DBConfig{
|
||||||
Path: filepath.Join(dataDir, "store.db"),
|
Path: filepath.Join(dataDir, "store.db"),
|
||||||
@@ -265,6 +274,7 @@ func (m *Machine) configureCorrosion(dataDir string) error {
|
|||||||
},
|
},
|
||||||
Gossip: corrosion.GossipConfig{
|
Gossip: corrosion.GossipConfig{
|
||||||
Addr: netip.AddrPortFrom(m.state.Network.ManagementIP, corrosion.DefaultGossipPort),
|
Addr: netip.AddrPortFrom(m.state.Network.ManagementIP, corrosion.DefaultGossipPort),
|
||||||
|
Bootstrap: bootstrap,
|
||||||
Plaintext: true,
|
Plaintext: true,
|
||||||
},
|
},
|
||||||
API: corrosion.APIConfig{
|
API: corrosion.APIConfig{
|
||||||
|
|||||||
Reference in New Issue
Block a user