Skip to content

Fix priority between network and DHCP server #2269

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dharaneeshvrd
Copy link
Contributor

@dharaneeshvrd dharaneeshvrd commented Mar 24, 2025

What this PR does / why we need it:
Fix priority between network and DHCP server
Do not allow to set both network and DHCP server details which will create conflict while creating new DHCP server on whether to use network name or DHCP server name

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 #2159

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:

Fix priority between network and DHCP server

@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Mar 24, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dharaneeshvrd
Once this PR has been reviewed and has the lgtm label, please assign mkumatag for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 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 Mar 24, 2025
Copy link

netlify bot commented Mar 24, 2025

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

Name Link
🔨 Latest commit f46c35c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/67f3d3e09cc8c50008d4601c
😎 Deploy Preview https://deploy-preview-2269.cluster-api-ibmcloud.sigs.k8s.io
📱 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
Copy link
Contributor Author

/cc @Karthik-K-N

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.

https://github.com/Karthik-K-N/cluster-api-provider-ibmcloud/blob/c4171f21acc320fdfe17b812c98be908653134f7/cloud/scope/powervs_cluster.go#L870, This comment needs an update as now we are not allowing to set both network and DHCP details in spec.

},
DHCPServer: &DHCPServer{
Name: ptr.To("capi-dhcp"),
},
Copy link
Contributor

Choose a reason for hiding this comment

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

May lets also add test with network name - dhcp id , network id -dhcp id combination?

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 26, 2025
@dharaneeshvrd
Copy link
Contributor Author

Addressed the comments, ptal @Karthik-K-N

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.

Do you think is there a way to handle/inform about this scenario, Correct me if my understanding is wrong.

What if user sets network.Name="abc" the network "abc" does not exist in cloud. I think our controller will create a DHCP network DHCPSERVERabc_Private. Now user has set "abc" as network in spec but actually its DHCPSERVERabc_Private

@dharaneeshvrd
Copy link
Contributor Author

@Karthik-K-N
Yes that's correct. I checked is there any update in DHCP create payload to accept the network name, seems it is not there.
So added this info into the API description as well as ReconcileNetwork()'s description. Please take a look

@Karthik-K-N
Copy link
Contributor

True, Thats the only thing we can do, along with that should we update spec.Network.Name with the newly created DHCP network name? will that be allowed?

@dharaneeshvrd
Copy link
Contributor Author

should we update spec.Network.Name with the newly created DHCP network name? will that be allowed?

Can you please elaborate this? Do you mean to update the spec once we created the DHCP network? Just wondering since we won't follow that generally right!

@Karthik-K-N
Copy link
Contributor

should we update spec.Network.Name with the newly created DHCP network name? will that be allowed?

Can you please elaborate this? Do you mean to update the spec once we created the DHCP network? Just wondering since we won't follow that generally right!

True we wont follow it, Just thinking.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2025
@Karthik-K-N
Copy link
Contributor

Or else how about strict validation like ID, when network.Name is set it should exist or else return error?

Most of the time we ommit network field and controller will autocreate the resource so it wont be a breaking change.

Do not allow to set both network and DHCP server details which will create conflict while creating new DHCP server on whether to use network name or DHCP server name
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2025
@dharaneeshvrd
Copy link
Contributor Author

Yeah that might be an option if we consider that field only for non DHCP networks. Anyway we are validating with that intention only. But only concern is that it would deviate from the other places on how we treat the name field of a resource.

@Karthik-K-N
Copy link
Contributor

Yeah that might be an option if we consider that field only for non DHCP networks. Anyway we are validating with that intention only. But only concern is that it would deviate from the other places on how we treat the name field of a resource.

True that, Though the use case is very minimal, I am not so sure about showing wrong info about network name in spec.

May be lets discuss this in the community meeting and we can either go with that or keep as it is and add note like now.

@k8s-ci-robot
Copy link
Contributor

@dharaneeshvrd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-ibmcloud-coverage f46c35c link true /test pull-cluster-api-provider-ibmcloud-coverage
pull-cluster-api-provider-ibmcloud-test f46c35c link true /test pull-cluster-api-provider-ibmcloud-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Priority to network name or DHCP server name while creating the DHCP server
3 participants