fix: delete k3d-tools node after gathering environment information, so it doesn't block an IP in a designated subnet
This commit is contained in:
parent
17dc4b7b4d
commit
6f76f8ce5d
@ -70,10 +70,6 @@ func ClusterRun(ctx context.Context, runtime k3drt.Runtime, clusterConfig *confi
|
|||||||
/*
|
/*
|
||||||
* Step 2: Pre-Start Configuration
|
* Step 2: Pre-Start Configuration
|
||||||
*/
|
*/
|
||||||
_, err := EnsureToolsNode(ctx, runtime, &clusterConfig.Cluster)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to ensure k3d-tools node: %w", err)
|
|
||||||
}
|
|
||||||
envInfo, err := GatherEnvironmentInfo(ctx, runtime, &clusterConfig.Cluster)
|
envInfo, err := GatherEnvironmentInfo(ctx, runtime, &clusterConfig.Cluster)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to gather environment information used for cluster creation: %w", err)
|
return fmt.Errorf("failed to gather environment information used for cluster creation: %w", err)
|
||||||
|
@ -25,12 +25,20 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
l "github.com/rancher/k3d/v4/pkg/logger"
|
||||||
"github.com/rancher/k3d/v4/pkg/runtimes"
|
"github.com/rancher/k3d/v4/pkg/runtimes"
|
||||||
|
|
||||||
k3d "github.com/rancher/k3d/v4/pkg/types"
|
k3d "github.com/rancher/k3d/v4/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GatherEnvironmentInfo(ctx context.Context, runtime runtimes.Runtime, cluster *k3d.Cluster) (*k3d.EnvironmentInfo, error) {
|
func GatherEnvironmentInfo(ctx context.Context, runtime runtimes.Runtime, cluster *k3d.Cluster) (*k3d.EnvironmentInfo, error) {
|
||||||
|
l.Log().Infof("Using the k3d-tools node to gather environment information")
|
||||||
|
toolsNode, err := EnsureToolsNode(ctx, runtime, cluster)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer NodeDelete(ctx, runtime, toolsNode, k3d.NodeDeleteOpts{SkipLBUpdate: true})
|
||||||
|
|
||||||
envInfo := &k3d.EnvironmentInfo{}
|
envInfo := &k3d.EnvironmentInfo{}
|
||||||
|
|
||||||
hostIP, err := GetHostIP(ctx, runtime, cluster)
|
hostIP, err := GetHostIP(ctx, runtime, cluster)
|
||||||
|
Loading…
Reference in New Issue
Block a user