mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Update peer address when running cluster-reset
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
This commit is contained in:
parent
0a0b915921
commit
ab3d25a2c5
@ -216,7 +216,23 @@ func (e *ETCD) Reset(ctx context.Context, rebootstrap func() error) error {
|
||||
logrus.Infof("Etcd is running, restart without --cluster-reset flag now. Backup and delete ${datadir}/server/db on each peer etcd server and rejoin the nodes")
|
||||
os.Exit(0)
|
||||
}
|
||||
} else {
|
||||
// make sure that peer ips are updated to the node ip in case the test fails
|
||||
members, err := e.client.MemberList(ctx)
|
||||
if err != nil {
|
||||
logrus.Warnf("failed to list etcd members: %v", err)
|
||||
continue
|
||||
}
|
||||
if len(members.Members) > 1 {
|
||||
logrus.Warnf("failed to update peer url: etcd still has more than one member")
|
||||
continue
|
||||
}
|
||||
if _, err := e.client.MemberUpdate(ctx, members.Members[0].ID, []string{e.peerURL()}); err != nil {
|
||||
logrus.Warnf("failed to update peer url: %v", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user