bluemix-go icon indicating copy to clipboard operation
bluemix-go copied to clipboard

Question: any plan to support classic clusters in v2container

Open adrian555 opened this issue 4 years ago • 6 comments

It seems that the v2container all resolves to /v2/vpc path for get, list, create, delete clusters. Is there any plan to support the classic type?

Or people should just use v1container for those type of clusters?

Thanks.

adrian555 avatar Mar 11 '20 21:03 adrian555

We already support https://github.com/IBM-Cloud/bluemix-go/blob/master/api/container/containerv2/clusters.go

hkantare avatar Mar 27 '20 04:03 hkantare

@hkantare I only see the Create func calls the POST to vpc link in this https://github.com/IBM-Cloud/bluemix-go/blob/master/api/container/containerv2/clusters.go#L163.

adrian555 avatar Mar 27 '20 05:03 adrian555

We have Get and List also calling to v2 https://github.com/IBM-Cloud/bluemix-go/blob/42bf472738fd2fbf88cad3964d8c82f75fadeb47/api/container/containerv2/clusters.go#L177 https://github.com/IBM-Cloud/bluemix-go/blob/42bf472738fd2fbf88cad3964d8c82f75fadeb47/api/container/containerv2/clusters.go#L152

hkantare avatar Mar 27 '20 05:03 hkantare

https://containers.cloud.ibm.com/global/swagger-global-api/#/ What is the difference between v2 and v2/VPC

hkantare avatar Mar 27 '20 06:03 hkantare

https://containers.cloud.ibm.com/global/swagger-global-api/#/ What is the difference between v2 and v2/VPC

That is exactly my question... in above swagger API doc, there are v2/vpc/GetCluster and v2/vpc/CreateCluster. But there are only v2/classic/GetCluster, but not corresponding v2/classic/CreateCluster.

The reason I am asking this question is I tried to follow the example https://github.com/IBM-Cloud/bluemix-go/blob/master/examples/container/V2containers/CreateClusterV2/main.go to create a cluster, it did not work. And I had to switch back to v1 and it worked with v1. My code looks like this:

	log.Infoln("Start to create an IKS cluster. It may take a while...")
	c := new(bluemix.Config)
	c.IAMAccessToken = auth.accessToken
	c.IAMRefreshToken = auth.refreshToken
	trace.Logger = trace.NewLogger("true")

	var clusterInfo = v1.ClusterCreateRequest{
		Name:        cluster.name,
		Datacenter:  cluster.dataCenter,
		MachineType: cluster.machineType,
		WorkerNum:   cluster.workerNum,
		PrivateVlan: cluster.privateVlan,
		PublicVlan:  cluster.publicVlan,
	}

	sess, err := session.New(c)
	if err != nil {
		log.Errorf("%v", err)
	}

	target := v1.ClusterTargetHeader{}

	target.Region = cluster.region

	clusterClient, err := v1.New(sess)
	if err != nil {
		log.Errorf("%v", err)
	}
	clustersAPI := clusterClient.Clusters()

	// create the cluster, the return response contains the ID
	out, err := clustersAPI.Create(clusterInfo, target)
	if err != nil {
		log.Errorf("%v", err)
	}...

So I am not sure what difference is between classic and vpc in v2. And would appreciate if you have a good example that I can follow. Thanks.

adrian555 avatar Mar 27 '20 06:03 adrian555

Actually we types of clusters (classic cluster , VPC clusters) For classic clusters you need to use v1.ClusterCreateRequest for VPC based cluster you need to use v2.ClusterCreateRequest https://cloud.ibm.com/docs/containers?topic=containers-clusters#prepare_cluster_level

hkantare avatar Mar 27 '20 06:03 hkantare