Browse Source

cluster: remove k8s_token files from zones on write if found

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/42/head
Alejandro Mery 9 months ago
parent
commit
019143820f
  1. 16
      pkg/cluster/regions.go

16
pkg/cluster/regions.go

@ -199,13 +199,25 @@ func (z *Zone) SyncRegions() error {
err := z.syncZoneRegions()
if err == nil {
z.ForEachMachine(func(p *Machine) bool {
err = z.syncMachineRegions(p)
return err != nil
})
}
return err
}
func (*Zone) syncMachineRegions(p *Machine) error {
var err error
if p.IsActive() {
err = p.RemoveFile("region")
} else {
err = p.WriteStringFile("none\n", "region")
}
return err != nil
})
if err == nil {
err = p.RemoveFile(RegionClusterTokenFileName)
}
return err

Loading…
Cancel
Save