diff --git a/pkg/client/host.go b/pkg/client/host.go index 3d381c81f..cd28e54bf 100644 --- a/pkg/client/host.go +++ b/pkg/client/host.go @@ -91,6 +91,21 @@ func GetHostIP(ctx context.Context, runtime runtimes.Runtime, cluster *k3d.Clust } + // Colima + if rtimeInfo.InfoName == "colima" { + toolsNode, err := EnsureToolsNode(ctx, runtime, cluster) + if err != nil { + return nil, fmt.Errorf("failed to ensure that k3d-tools node is running to get host IP :%w", err) + } + + limaIP, err := resolveHostnameFromInside(ctx, runtime, toolsNode, "host.lima.internal", ResolveHostCmdGetEnt) + if err == nil { + return limaIP, nil + } + + l.Log().Debugf("[GetHostIP on colima] failed to resolve 'host.lima.internal' from inside the k3d-tools node: %v", err) + } + ip, err := runtime.GetHostIP(ctx, cluster.Network.Name) if err != nil { return nil, fmt.Errorf("runtime failed to get host IP: %w", err) diff --git a/pkg/runtimes/docker/info.go b/pkg/runtimes/docker/info.go index ea43ac32e..0c66e8c0d 100644 --- a/pkg/runtimes/docker/info.go +++ b/pkg/runtimes/docker/info.go @@ -53,6 +53,7 @@ func (d Docker) Info() (*runtimeTypes.RuntimeInfo, error) { CgroupVersion: info.CgroupVersion, CgroupDriver: info.CgroupDriver, Filesystem: "UNKNOWN", + InfoName: info.Name, } // Get the backing filesystem for the storage driver diff --git a/pkg/runtimes/types/types.go b/pkg/runtimes/types/types.go index 95ae7c8a2..6af48dbc3 100644 --- a/pkg/runtimes/types/types.go +++ b/pkg/runtimes/types/types.go @@ -31,6 +31,7 @@ type RuntimeInfo struct { CgroupVersion string `json:"cgroupversion,omitempty"` CgroupDriver string `json:"cgroupdriver,omitempty"` Filesystem string `json:"filesystem,omitempty"` + InfoName string `json:"infoname,omitempty"` } type NodeLogsOpts struct {