cluster: decouple RingID from WireguardInterfaceID
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"darvaza.org/core"
|
||||
|
||||
"git.jpi.io/amery/jpictl/pkg/rings"
|
||||
)
|
||||
|
||||
@@ -38,8 +39,8 @@ func (m *Machine) init() error {
|
||||
return core.Wrap(err, m.Name)
|
||||
}
|
||||
|
||||
for i := 0; i < RingsCount; i++ {
|
||||
if err := m.tryReadWireguardKeys(i); err != nil {
|
||||
for _, ring := range Rings {
|
||||
if err := m.tryReadWireguardKeys(ring.ID); err != nil {
|
||||
return core.Wrap(err, m.Name)
|
||||
}
|
||||
}
|
||||
@@ -72,12 +73,12 @@ func (m *Machine) setID() 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 {
|
||||
for _, ring := range Rings {
|
||||
if err := m.tryApplyWireguardConfig(ring.ID); err != nil {
|
||||
m.error(err).
|
||||
WithField("subsystem", "wireguard").
|
||||
WithField("node", m.Name).
|
||||
WithField("ring", i).
|
||||
WithField("ring", MustWireguardInterfaceID(ring.ID)).
|
||||
Print()
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user