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

Multiple subnet creation fails when zone is not specified #1779

Open
Amulyam24 opened this issue May 16, 2024 · 8 comments · May be fixed by #1793
Open

Multiple subnet creation fails when zone is not specified #1779

Amulyam24 opened this issue May 16, 2024 · 8 comments · May be fixed by #1793
Assignees
Labels
area/provider/ibmcloud Issues or PRs related to ibmcloud provider good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@Amulyam24
Copy link
Contributor

/kind bug
/area provider/ibmcloud

What steps did you take and what happened:
If zone it not specified while creating multiple subnets, second subnet creation will fail as the default address prefix is already assigned to the first subnet.
Spec:

apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMPowerVSCluster
metadata:
  annotations:
    powervs.cluster.x-k8s.io/create-infra: "true"
  labels:
    cluster.x-k8s.io/cluster-name: capi-test-amulya
  name: capi-test-amulya
  namespace: default
spec:
  loadBalancers:
  - name: capi-test-amulya-loadbalancer
  - name: capi-test-amulya-loadbalancer-1
  resourceGroup:
    name: ibm-hypershift-dev
  serviceInstance:
    name: capi-test-amulya-serviceInstance
  transitGateway:
    name: capi-test-amulya-transitgateway
  vpc:
    name: capi-test-amulya-vpc
    region: eu-es
  vpcSubnets:
  - name: capi-test-amulya-vpcsubnet
  - name: capi-test-amulya-vpcsubnet-1
  zone: mad02

Creation fails with

"error creating vpc subnet" err="Subnet CIDR 10.251.0.0/18 conflicts with existing subnet: 02w7-c247a3e9-c9d0-4717-a878-96edd68059c4

What did you expect to happen:
While creating multiple subnets, if subnet zone is missing from spec, don't proceed and instead throw an error.

Anything else you would like to add:
We can add a check to validate the spec before proceeding with cluster creation.

Environment:

  • Cluster-api version:
  • Minikube/KIND version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. area/provider/ibmcloud Issues or PRs related to ibmcloud provider labels May 16, 2024
@Amulyam24
Copy link
Contributor Author

/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@Amulyam24:
This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels May 16, 2024
@mkumatag
Copy link
Member

but how are we handling that for the first subnet when user didn't supply the zone?

While creating multiple subnets, if subnet zone is missing from spec, don't proceed and instead throw an error.

@Amulyam24
Copy link
Contributor Author

but how are we handling that for the first subnet when user didn't supply the zone?

While creating multiple subnets, if subnet zone is missing from spec, don't proceed and instead throw an error.

We are fetching the zone from PowerVS zone - https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/cloud/scope/powervs_cluster.go#L1113-L1130

@Shilpa-Gokul
Copy link
Contributor

@Amulyam24 I would like to work on this issue

@Shilpa-Gokul
Copy link
Contributor

/assign @Shilpa-Gokul

@mkumatag
Copy link
Member

but how are we handling that for the first subnet when user didn't supply the zone?

While creating multiple subnets, if subnet zone is missing from spec, don't proceed and instead throw an error.

We are fetching the zone from PowerVS zone - https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/cloud/scope/powervs_cluster.go#L1113-L1130

There is logic written to use always the first one here -

// TODO(karthik-k-n): Decide on using all zones or using one zone
		if len(vpcZones) == 0 {
			return nil, fmt.Errorf("error getting vpc zones error: %v", err)
		}
		zone = vpcZones[0]

wondering if we need a logic to use the subsequent vpc zone for the next subnet?!

@Amulyam24
Copy link
Contributor Author

but how are we handling that for the first subnet when user didn't supply the zone?

While creating multiple subnets, if subnet zone is missing from spec, don't proceed and instead throw an error.

We are fetching the zone from PowerVS zone - https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/blob/main/cloud/scope/powervs_cluster.go#L1113-L1130

There is logic written to use always the first one here -

// TODO(karthik-k-n): Decide on using all zones or using one zone
		if len(vpcZones) == 0 {
			return nil, fmt.Errorf("error getting vpc zones error: %v", err)
		}
		zone = vpcZones[0]

wondering if we need a logic to use the subsequent vpc zone for the next subnet?!

yes, we can try that out.

@mkumatag mkumatag added this to the Next milestone May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/provider/ibmcloud Issues or PRs related to ibmcloud provider good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants