Closed Amulyam24 closed 6 hours ago
/good-first-issue
@Amulyam24: This request has been marked as suitable for new contributors.
Please ensure that the issue body includes answers to the following questions:
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.
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.
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
@Amulyam24 I would like to work on this issue
/assign @Shilpa-Gokul
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?!
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.
We had a discussion regarding this issue and couple things decided are as follows
Continue with existing flow when no subnets are set that is create subnet in each available zone for VPC.
For selecting subnet CIDR, Use the field AddressPrefix.HasSubnets to identify whether to use the CIDR for subnet
addressPrefixCollection, _, err := vpcService.ListVPCAddressPrefixes(options)
addressPrefixCollection.AddressPrefixes[].HasSubnets
3. For now allow only one subnet per VPC zone, If user specifies more subnets error out.
Also we can avoid fetching CIDR and use total ip while creating subnet, For more reference see vpc subnet code and discussion
/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:
Creation fails with
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:
kubectl version
):/etc/os-release
):