Skip to content

Commit

Permalink
Use an env-var for the node-token instead of a file
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Oct 27, 2023
1 parent bee8462 commit 8c01ffb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions cmd/plan.go
Expand Up @@ -27,11 +27,11 @@ Input file format, in JSON:
` + pkg.SupportMessageShort + `
`,
Example: ` ## Generate an installation script where 3x of the
## available hosts are dedicated as servers, with a custom user
Example: ` # Generate an installation script where 3x of the
# available hosts are dedicated as servers, with a custom user
k3sup plan hosts.json --servers 3 --user ubuntu
## Override the TLS SAN, for HA
# Override the TLS SAN, for HA
k3sup plan hosts.json --servers 3 --tls-san $SAN_IP
`,
SilenceUsage: true,
Expand Down Expand Up @@ -110,10 +110,9 @@ Input file format, in JSON:
contextName, tlsSanStr)

script += fmt.Sprintf(`
echo "Saving the server's node-token to ./token.txt"
echo "Fetching the server's node-token into memory"
k3sup node-token --host %s \
--user %s > token.txt
NODE_TOKEN=$(k3sup node-token --host %s --user %s)
`, host.IP, user)

serversAdded = 1
Expand All @@ -124,7 +123,7 @@ k3sup node-token --host %s \
script += fmt.Sprintf(`k3sup join --host %s \
--server-host %s \
--server \
--node-token-path ./token.txt \
--node-token-path $NODE_TOKEN \
--user %s%s%s
`, host.IP, primaryServer.IP, user, tlsSanStr, bgStr)

Expand All @@ -134,7 +133,7 @@ k3sup node-token --host %s \

script += fmt.Sprintf(`k3sup join --host %s \
--server-host %s \
--node-token-path ./token.txt \
--node-token-path $NODE_TOKEN \
--user %s%s
`, host.IP, primaryServer.IP, user, bgStr)
}
Expand Down

0 comments on commit 8c01ffb

Please sign in to comment.