mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #57846 from dims/fix-external-address-parsing-under-ipv6
Automatic merge from submit-queue (batch tested with PRs 56315, 57846). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix ExternalAddress parsing problem under IPv6 **What this PR does / why we need it**: `!strings.Contains(host, ":") ` will fail miserably under ipv6 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
fa2ea5284e
@ -342,11 +342,11 @@ func (c *Config) Complete(informers informers.SharedInformerFactory) CompletedCo
|
|||||||
if host == "" && c.PublicAddress != nil {
|
if host == "" && c.PublicAddress != nil {
|
||||||
host = c.PublicAddress.String()
|
host = c.PublicAddress.String()
|
||||||
}
|
}
|
||||||
if !strings.Contains(host, ":") {
|
|
||||||
if c.ReadWritePort != 0 {
|
// if there is no port, and we have a ReadWritePort, use that
|
||||||
|
if _, _, err := net.SplitHostPort(host); err != nil && c.ReadWritePort != 0 {
|
||||||
host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort))
|
host = net.JoinHostPort(host, strconv.Itoa(c.ReadWritePort))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
c.ExternalAddress = host
|
c.ExternalAddress = host
|
||||||
|
|
||||||
if c.OpenAPIConfig != nil && c.OpenAPIConfig.SecurityDefinitions != nil {
|
if c.OpenAPIConfig != nil && c.OpenAPIConfig.SecurityDefinitions != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user