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

Use zone to filter PowerVS service instance #1853

Conversation

dharaneeshvrd
Copy link
Contributor

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1839

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:


@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Jun 19, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 19, 2024
Copy link

netlify bot commented Jun 19, 2024

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit e50f895
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/667570c1ee7b290008662aae
😎 Deploy Preview https://deploy-preview-1853--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dharaneeshvrd dharaneeshvrd changed the title Use zone to filter PowerVS service instance [WIP] Use zone to filter PowerVS service instance Jun 20, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 20, 2024
@dharaneeshvrd dharaneeshvrd force-pushed the fix-powervs-instance-get-with-zone branch from 836af54 to 46c74bc Compare June 21, 2024 05:42
@dharaneeshvrd dharaneeshvrd changed the title [WIP] Use zone to filter PowerVS service instance Use zone to filter PowerVS service instance Jun 21, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 21, 2024
Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good to me, But trying to understand when there were two service instance with same name , why didn't you hit this error here

default:
		errStr := fmt.Errorf("there exist more than one service instance ID with same name %s, Try setting serviceInstance.ID", name)

Also within the same zone we can't have the same service instance right?

@dharaneeshvrd
Copy link
Contributor Author

dharaneeshvrd commented Jun 21, 2024

Problem I faced is, let's say there is an existing powervs instance called capi-dhar-serviceInstance in osa21 zone.
When I try to deploy new cluster with same name capi-dhar in dal12 zone, instead of creating a new powervs instance in dal12, it tries to use the one in osa21 since the it's having same name.
It won't hit this, since there no two matching instances in this situation.

Also within the same zone we can't have the same service instance right?

But for this unfortunately it still allows duplicate within zone too.

@Karthik-K-N
Copy link
Contributor

Problem I faced is, let's say there is an existing powervs instance called capi-dhar-serviceInstance in osa21 zone. When I try to deploy new cluster with same name capi-dhar in dal12 zone, instead of creating a new powervs instance in dal12, it tries to use the one in osa21 since the it's having same name. It won't hit this, since there no two matching instances in this situation.

Also within the same zone we can't have the same service instance right?

But for this unfortunately it still allows duplicate within zone too.

Got the point now, Thank you.

Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 21, 2024
@mkumatag
Copy link
Member

But for this unfortunately it still allows duplicate within zone too.

This is exactly my doubt too, we can't foolproof 100% here in this case, we need to mention somewhere in the api spec saying that if multiple instance with same name present then it will pick first in the list and if user wants to use any specific one then use by ID

Client client.Client
Logger logr.Logger
IBMPowerVSImage *infrav1beta2.IBMPowerVSImage
ServiceInstanceZone *string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ServiceInstanceZone *string
Zone *string

@@ -178,9 +179,10 @@ func NewPowerVSMachineScope(params PowerVSMachineScopeParams) (scope *PowerVSMac
serviceInstanceName = fmt.Sprintf("%s-%s", params.IBMPowerVSCluster.GetName(), "serviceInstance")
if params.IBMPowerVSCluster.Spec.ServiceInstance != nil && params.IBMPowerVSCluster.Spec.ServiceInstance.Name != nil {
serviceInstanceName = *params.IBMPowerVSCluster.Spec.ServiceInstance.Name
zone = params.IBMPowerVSCluster.Spec.Zone
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will it make any difference? why don't we just pass params.IBMPowerVSCluster.Spec.Zone directly in the below function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. changed.

@dharaneeshvrd dharaneeshvrd force-pushed the fix-powervs-instance-get-with-zone branch from 46c74bc to e2dd106 Compare June 21, 2024 12:17
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 21, 2024
@dharaneeshvrd dharaneeshvrd force-pushed the fix-powervs-instance-get-with-zone branch from e2dd106 to e50f895 Compare June 21, 2024 12:23
@dharaneeshvrd
Copy link
Contributor Author

Updated the ServiceInstance field's description, ptal!

@@ -65,6 +65,7 @@ type IBMPowerVSClusterSpec struct {
// when omitted system will dynamically create the service instance with name CLUSTER_NAME-serviceInstance.
// when ServiceInstance.ID is set, its expected that there exist a service instance in PowerVS workspace with id or else system will give error.
// when ServiceInstance.Name is set, system will first check for service instance with Name in PowerVS workspace, if not exist system will create new instance.
// if there are more than one service instance exist with the ServiceInstance.Name in given Zone, installation fails with an error. Use ServiceInstance.ID in those situations to use the specific service instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this failure logic written?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dharaneeshvrd, mkumatag

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 21, 2024
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 21, 2024
@k8s-ci-robot k8s-ci-robot merged commit 104ee47 into kubernetes-sigs:main Jun 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need a check on powervs service instance with zone since dup name is allowed
4 participants