kubernetes-sigs / cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Apache License 2.0
3.57k stars 1.31k forks source link

Use random name for KIND or MiniKube as Bootstrap Cluster #981

Closed gyliu513 closed 5 years ago

gyliu513 commented 5 years ago

/kind bug

What steps did you take and what happened: [A clear and concise description of what the bug is.]

For KIND, we are using cluster name as clusterapi at https://github.com/kubernetes-sigs/cluster-api/blob/master/cmd/clusterctl/clusterdeployer/bootstrap/kind/kind.go#L30 as the bootstrap cluster name, the problem here is if I have multiple clusterctl requests, then I need to specify the cluster name in order not to have KIND cluster name conflict.

What did you expect to happen:

It is better enable clusterctl can generate a random name for the KIND or MiniKube cluster name.

/cc @detiber @vincepri @ncdc

FYI @hchenxa

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

detiber commented 5 years ago

I'm not necessarily against the idea, but I would suspect that there could very well be other blockers involved with running multiple clusterctl processes in parallel on the same host. For example the hardcoded use of kubeconfigs withing the current working directory would also be a point of contention between parallel running instances.

gyliu513 commented 5 years ago

Yes, that is a issue we need to fix as well, I will check, but let me first post a PR to fix the cluster name issue here, thanks @detiber for the quick response ;-)

detiber commented 5 years ago

@gyliu513 Changing the location of the generated kubeconfig files would likely cause issues for downstream providers who currently reference the hardcoded locations in their documentation.

We should probably have a larger discussion around if we are willing to accept that and if running clusterctl in parallel is a use case that we should support.

gyliu513 commented 5 years ago

@detiber sure thing, let me do some test first.

FYI @hchenxa @jichenjc

gyliu513 commented 5 years ago

@clyang82

clyang82 commented 5 years ago

@detiber @vincepri @ncdc How about add new parameter to clusterctl command to allow generating multiple kubeconfig files when the clusterctl are running in parallel on the same host. in this way, we can support backward compatibility. something likes:

    createClusterCmd.Flags().BoolVarP(&co.IsParallel, "isParallel", "", false, "Generate multiple kubeconfigs with master ip address to allow running multiple clusterctl processes in parallel on the same host.")
    createClusterCmd.Flags().StringVarP(&co.KubeconfigOutputPath, "kubeconfig-out-path", "", "./", "Where to output the kubeconfig for the provisioned clusters. It only takes effect if isParallel is true.")

WDYT?