Skip to content

Commit

Permalink
Separator = replaced by cons (#692)
Browse files Browse the repository at this point in the history
Separator = replaced by cons

Separator = replaced by cons

Co-authored-by: dsy3502 <[email protected]>
  • Loading branch information
dsy3502 and dsy3502 authored Dec 22, 2021
1 parent 540e6c2 commit 2cfe547
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/yurttunnel/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
yurttunnelServerHTTPProxyPorts = "http-proxy-ports"
yurttunnelServerHTTPSProxyPorts = "https-proxy-ports"
PortsSeparator = ","
PortPairSeparator = "="

KubeletHTTPSPort = "10250"
KubeletHTTPPort = "10255"
Expand Down Expand Up @@ -146,12 +147,12 @@ func resolvePorts(portsStr, insecurePort string) []string {
return ports
}

isPortPair := strings.Contains(portsStr, "=")
isPortPair := strings.Contains(portsStr, PortPairSeparator)
parts := strings.Split(portsStr, PortsSeparator)
for _, port := range parts {
var proxyPort string
if isPortPair {
subParts := strings.Split(port, "=")
subParts := strings.Split(port, PortPairSeparator)
if len(subParts) == 2 && strings.TrimSpace(subParts[1]) == insecurePort {
proxyPort = strings.TrimSpace(subParts[0])
}
Expand Down

0 comments on commit 2cfe547

Please sign in to comment.