mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Fix URL pruning when joining an etcd member (#3832)
* Fix URL pruning when joining an etcd member Problem: Existing member clientURLs were checked if they contain the joining node's IP. In some edge cases this would prune valid URLs when the joining IP is a substring match of the only existing member's IP. Because of this, it was impossible to e.g. join 10.0.0.2 to an existing node that has an IP of 10.0.0.2X or 10.0.0.2XX: level=fatal msg="starting kubernetes: preparing server: start managed database: joining etcd cluster: etcdclient: no available endpoints" Solution: Fixed by properly parsing the URLs and comparing the IPs for equality instead of substring match. Signed-off-by: Malte Starostik <info@stellaware.de>
This commit is contained in:
parent
e87204c064
commit
b23955e835
@ -750,8 +750,12 @@ members:
|
|||||||
if member.IsLearner {
|
if member.IsLearner {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, url := range member.ClientURLs {
|
for _, clientURL := range member.ClientURLs {
|
||||||
if strings.Contains(url, ip) {
|
u, err := url.Parse(clientURL)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if u.Hostname() == ip {
|
||||||
continue members
|
continue members
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user