Skip to content

Commit

Permalink
Merge pull request #620 from areed/proxy-join
Browse files Browse the repository at this point in the history
Add proxy to node join scripts
  • Loading branch information
areed committed May 30, 2020
2 parents d572a0c + efb0d2c commit fa1e9b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kotsadm/pkg/kurl/node_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kurl

import (
"fmt"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -33,6 +34,8 @@ func GenerateAddNodeCommand(client kubernetes.Interface, master bool) ([]string,
}

data := cm.Data
proxyAddr := os.Getenv("HTTP_PROXY")
noProxyAddrs := os.Getenv("NO_PROXY")

bootstrapTokenExpiration, err := time.Parse(time.RFC3339, data[bootstrapTokenExpirationKey])
if err != nil {
Expand All @@ -43,6 +46,8 @@ func GenerateAddNodeCommand(client kubernetes.Interface, master bool) ([]string,

if ok, _ := strconv.ParseBool(data["airgap"]); ok {
command = append(command, "cat join.sh | sudo bash -s airgap")
} else if proxyAddr != "" {
command = append(command, fmt.Sprintf("curl -sSL -x %s %s/%s/join.sh | sudo bash -s", proxyAddr, data["kurl_url"], data["installer_id"]))
} else {
command = append(command, fmt.Sprintf("curl -sSL %s/%s/join.sh | sudo bash -s", data["kurl_url"], data["installer_id"]))
}
Expand All @@ -55,6 +60,10 @@ func GenerateAddNodeCommand(client kubernetes.Interface, master bool) ([]string,
fmt.Sprintf("kubernetes-version=%s", versionInfo.GitVersion),
)

if proxyAddr != "" && noProxyAddrs != "" {
command = append(command, fmt.Sprintf("additional-no-proxy-addresses=%s", noProxyAddrs))
}

if master {
command = append(command,
fmt.Sprintf("cert-key=%s", data["cert_key"]),
Expand Down

0 comments on commit fa1e9b5

Please sign in to comment.