[FIX] do not ignore --no-hostip and don't try to inject if network = host (#471)

This commit is contained in:
Konrad Malik 2021-02-03 11:38:31 +01:00 committed by GitHub
parent 092f26a4e2
commit 73e1548264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -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 // add /etc/hosts and CoreDNS entry for host.k3d.internal, referring to the host system
if !clusterConfig.ClusterCreateOpts.PrepDisableHostIPInjection { 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 // create the registry hosting configmap

View File

@ -219,14 +219,15 @@ func TransformSimpleToClusterConfig(ctx context.Context, runtime runtimes.Runtim
**************************/ **************************/
clusterCreateOpts := k3d.ClusterCreateOpts{ clusterCreateOpts := k3d.ClusterCreateOpts{
DisableImageVolume: simpleConfig.Options.K3dOptions.DisableImageVolume, PrepDisableHostIPInjection: simpleConfig.Options.K3dOptions.PrepDisableHostIPInjection,
WaitForServer: simpleConfig.Options.K3dOptions.Wait, DisableImageVolume: simpleConfig.Options.K3dOptions.DisableImageVolume,
Timeout: simpleConfig.Options.K3dOptions.Timeout, WaitForServer: simpleConfig.Options.K3dOptions.Wait,
DisableLoadBalancer: simpleConfig.Options.K3dOptions.DisableLoadbalancer, Timeout: simpleConfig.Options.K3dOptions.Timeout,
K3sServerArgs: simpleConfig.Options.K3sOptions.ExtraServerArgs, DisableLoadBalancer: simpleConfig.Options.K3dOptions.DisableLoadbalancer,
K3sAgentArgs: simpleConfig.Options.K3sOptions.ExtraAgentArgs, K3sServerArgs: simpleConfig.Options.K3sOptions.ExtraServerArgs,
GlobalLabels: map[string]string{}, // empty init K3sAgentArgs: simpleConfig.Options.K3sOptions.ExtraAgentArgs,
GlobalEnv: []string{}, // empty init GlobalLabels: map[string]string{}, // empty init
GlobalEnv: []string{}, // empty init
} }
// ensure, that we have the default object labels // ensure, that we have the default object labels