diff --git a/pkg/client/cluster.go b/pkg/client/cluster.go index 885fadd2..00535170 100644 --- a/pkg/client/cluster.go +++ b/pkg/client/cluster.go @@ -93,7 +93,11 @@ func ClusterRun(ctx context.Context, runtime k3drt.Runtime, clusterConfig *confi // add /etc/hosts and CoreDNS entry for host.k3d.internal, referring to the host system if !clusterConfig.ClusterCreateOpts.PrepDisableHostIPInjection { - prepInjectHostIP(ctx, runtime, &clusterConfig.Cluster) + if clusterConfig.Cluster.Network.Name != "host" { + prepInjectHostIP(ctx, runtime, &clusterConfig.Cluster) + } else { + log.Infoln("Hostnetwork selected -> Skipping injection of docker host into the cluster") + } } // create the registry hosting configmap diff --git a/pkg/config/transform.go b/pkg/config/transform.go index 669bceac..f585ccb2 100644 --- a/pkg/config/transform.go +++ b/pkg/config/transform.go @@ -219,14 +219,15 @@ func TransformSimpleToClusterConfig(ctx context.Context, runtime runtimes.Runtim **************************/ clusterCreateOpts := k3d.ClusterCreateOpts{ - DisableImageVolume: simpleConfig.Options.K3dOptions.DisableImageVolume, - WaitForServer: simpleConfig.Options.K3dOptions.Wait, - Timeout: simpleConfig.Options.K3dOptions.Timeout, - DisableLoadBalancer: simpleConfig.Options.K3dOptions.DisableLoadbalancer, - K3sServerArgs: simpleConfig.Options.K3sOptions.ExtraServerArgs, - K3sAgentArgs: simpleConfig.Options.K3sOptions.ExtraAgentArgs, - GlobalLabels: map[string]string{}, // empty init - GlobalEnv: []string{}, // empty init + PrepDisableHostIPInjection: simpleConfig.Options.K3dOptions.PrepDisableHostIPInjection, + DisableImageVolume: simpleConfig.Options.K3dOptions.DisableImageVolume, + WaitForServer: simpleConfig.Options.K3dOptions.Wait, + Timeout: simpleConfig.Options.K3dOptions.Timeout, + DisableLoadBalancer: simpleConfig.Options.K3dOptions.DisableLoadbalancer, + K3sServerArgs: simpleConfig.Options.K3sOptions.ExtraServerArgs, + K3sAgentArgs: simpleConfig.Options.K3sOptions.ExtraAgentArgs, + GlobalLabels: map[string]string{}, // empty init + GlobalEnv: []string{}, // empty init } // ensure, that we have the default object labels