Skip to content

Commit

Permalink
fix: handle colima host (#1228)
Browse files Browse the repository at this point in the history
  • Loading branch information
thejan2009 authored Mar 9, 2023
1 parent 0f9ca60 commit 3386725
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/client/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/runtimes/docker/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/runtimes/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3386725

Please sign in to comment.