clusterCreate: add --no-hostip flag to disable the automatic injection of the host.k3d.internal entry into /etc/hosts and CoreDNS
This commit is contained in:
parent
60069f6f19
commit
d063482a32
@ -134,6 +134,7 @@ func NewCmdClusterCreate() *cobra.Command {
|
||||
cmd.Flags().BoolVar(&updateCurrentContext, "switch-context", true, "Directly switch the default kubeconfig's current-context to the new cluster's context (requires --update-default-kubeconfig)")
|
||||
cmd.Flags().BoolVar(&createClusterOpts.DisableLoadBalancer, "no-lb", false, "Disable the creation of a LoadBalancer in front of the server nodes")
|
||||
cmd.Flags().BoolVar(&noRollback, "no-rollback", false, "Disable the automatic rollback actions, if anything goes wrong")
|
||||
cmd.Flags().BoolVar(&createClusterOpts.PrepDisableHostIPInjection, "no-hostip", false, "Disable the automatic injection of the Host IP as 'host.k3d.internal' into the containers and CoreDNS")
|
||||
|
||||
/* Image Importing */
|
||||
cmd.Flags().BoolVar(&createClusterOpts.DisableImageVolume, "no-image-volume", false, "Disable the creation of a volume for importing images")
|
||||
|
@ -358,7 +358,8 @@ func ClusterCreate(ctx context.Context, runtime k3drt.Runtime, cluster *k3d.Clus
|
||||
* Networking Magic
|
||||
*/
|
||||
|
||||
// add extra host
|
||||
// add /etc/hosts and CoreDNS entry for host.k3d.internal, referring to the host system
|
||||
if !cluster.CreateClusterOpts.PrepDisableHostIPInjection {
|
||||
hostIP, err := GetHostIP(clusterPrepCtx, runtime, cluster)
|
||||
if err != nil {
|
||||
log.Errorln("Failed to get HostIP")
|
||||
@ -377,6 +378,7 @@ func ClusterCreate(ctx context.Context, runtime k3drt.Runtime, cluster *k3d.Clus
|
||||
if err != nil {
|
||||
log.Warnf("Failed to patch CoreDNS ConfigMap to include entry '%s': %+v", hostsEntry, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ var DoNotCopyServerFlags = []string{
|
||||
|
||||
// ClusterCreateOpts describe a set of options one can set when creating a cluster
|
||||
type ClusterCreateOpts struct {
|
||||
PrepDisableHostIPInjection bool
|
||||
DisableImageVolume bool
|
||||
WaitForServer bool
|
||||
Timeout time.Duration
|
||||
|
Loading…
Reference in New Issue
Block a user