cluster: generate ring keys on scan if missing
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -68,7 +68,8 @@ func (m *Machine) setID() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Machine) scan(opts *ScanOptions) error {
|
||||
// scan is called once we know about all zones and machine names
|
||||
func (m *Machine) scan(_ *ScanOptions) error {
|
||||
for i := 0; i < RingsCount; i++ {
|
||||
if err := m.tryApplyWireguardConfig(i); err != nil {
|
||||
m.error(err).
|
||||
@@ -80,6 +81,22 @@ func (m *Machine) scan(opts *ScanOptions) error {
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// scanWrapUp is called once all machines have been scanned
|
||||
func (m *Machine) scanWrapUp(opts *ScanOptions) error {
|
||||
for _, ri := range m.Rings {
|
||||
if err := m.setRingDefaults(ri); err != nil {
|
||||
m.error(err).
|
||||
WithField("subsystem", "wireguard").
|
||||
WithField("node", m.Name).
|
||||
WithField("ring", ri.Ring).
|
||||
Print()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if !opts.DontResolvePublicAddresses {
|
||||
return m.UpdatePublicAddresses()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user