Skip to content

Commit

Permalink
Start etcd client before ensuring self removal
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
  • Loading branch information
brandond committed Oct 13, 2023
1 parent 4eac0fa commit 373dc40
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1372,8 +1372,17 @@ func (e *ETCD) GetMembersNames(ctx context.Context) ([]string, error) {
return memberNames, nil
}

// RemoveSelf will remove the member if it exists in the cluster
// RemoveSelf will remove the member if it exists in the cluster. This should
// only be called on a node that may have previously run etcd, but will not
// currently run etcd, to ensure that it is not a member of the cluster.
// This is also called by tests to do cleanup between runs.
func (e *ETCD) RemoveSelf(ctx context.Context) error {
if e.client == nil {
if err := e.startClient(ctx); err != nil {
return err
}
}

if err := e.RemovePeer(ctx, e.name, e.address, true); err != nil {
return err
}
Expand Down

0 comments on commit 373dc40

Please sign in to comment.