Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: any plan to support classic clusters in v2container #200

Open
adrian555 opened this issue Mar 11, 2020 · 6 comments
Open

Question: any plan to support classic clusters in v2container #200

adrian555 opened this issue Mar 11, 2020 · 6 comments

Comments

@adrian555
Copy link

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.

@hkantare
Copy link
Collaborator

@adrian555
Copy link
Author

@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.

@hkantare
Copy link
Collaborator

hkantare commented Mar 27, 2020

We have Get and List also calling to v2

rawURL := fmt.Sprintf("/v2/vpc/getCluster?cluster=%s", name)

_, err := r.client.Get("/v2/vpc/getClusters", &clusters, target.ToMap())

@hkantare
Copy link
Collaborator

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

@adrian555
Copy link
Author

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.

@hkantare
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants