createCluster/createNode: use K3S_URL instead of --server
This commit is contained in:
parent
dd2d5a6b70
commit
4bfac51c7c
@ -116,7 +116,7 @@ func CreateCluster(ctx context.Context, cluster *k3d.Cluster, runtime k3drt.Runt
|
||||
*/
|
||||
|
||||
// Worker defaults (per cluster)
|
||||
// connection url
|
||||
// connection url is always the name of the first master node (index 0)
|
||||
connectionURL := fmt.Sprintf("https://%s:%s", generateNodeName(cluster.Name, k3d.MasterRole, 0), k3d.DefaultAPIPort)
|
||||
|
||||
nodeSetup := func(node *k3d.Node, suffix int) error {
|
||||
@ -141,7 +141,7 @@ func CreateCluster(ctx context.Context, cluster *k3d.Cluster, runtime k3drt.Runt
|
||||
|
||||
// the cluster has an init master node, but its not this one, so connect it to the init node
|
||||
if cluster.InitNode != nil && !node.MasterOpts.IsInit {
|
||||
node.Args = append(node.Args, "--server", fmt.Sprintf("https://%s:%s", cluster.InitNode.Name, k3d.DefaultAPIPort))
|
||||
node.Env = append(node.Env, fmt.Sprintf("K3S_URL=%s", connectionURL))
|
||||
}
|
||||
|
||||
} else if node.Role == k3d.WorkerRole {
|
||||
|
||||
@ -170,7 +170,9 @@ func DeleteNode(runtime runtimes.Runtime, node *k3d.Node) error {
|
||||
|
||||
// patchWorkerSpec adds worker node specific settings to a node
|
||||
func patchWorkerSpec(node *k3d.Node) error {
|
||||
node.Args = append([]string{"agent"}, node.Args...)
|
||||
if node.Cmd == nil {
|
||||
node.Cmd = []string{"agent"}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -178,7 +180,9 @@ func patchWorkerSpec(node *k3d.Node) error {
|
||||
func patchMasterSpec(node *k3d.Node) error {
|
||||
|
||||
// command / arguments
|
||||
node.Args = append([]string{"server"}, node.Args...)
|
||||
if node.Cmd == nil {
|
||||
node.Cmd = []string{"server"}
|
||||
}
|
||||
|
||||
// Add labels and TLS SAN for the exposed API
|
||||
// FIXME: For now, the labels concerning the API on the master nodes are only being used for configuring the kubeconfig
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user