cluster-api-provider-gcp icon indicating copy to clipboard operation
cluster-api-provider-gcp copied to clipboard

fix: Make gcpmanagedcluster.network a required field

Open tasdikrahman opened this issue 1 year ago • 8 comments

What type of PR is this?

This makes the gcpmanagedcluster.network field a required field.

/kind feature

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

Special notes for your reviewer:

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

TODOs:

  • [ ] squashed commits
  • [ ] includes documentation
  • [ ] adds unit tests

Release note:

fix: Makes GCPManagedCluster Spec's network field a required field

tasdikrahman avatar Jun 12 '24 11:06 tasdikrahman

Welcome @tasdikrahman!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-gcp 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-gcp has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Jun 12 '24 11:06 k8s-ci-robot

Hi @tasdikrahman. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 avatar Jun 12 '24 11:06 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tasdikrahman Once this PR has been reviewed and has the lgtm label, please assign dims for approval. For more information see the Kubernetes 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 avatar Jun 12 '24 11:06 k8s-ci-robot

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

Name Link
Latest commit 9786190924675a48388457b3e9ca95f26be42564
Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-gcp/deploys/66698398a443bf00086812fd
Deploy Preview https://deploy-preview-1259--kubernetes-sigs-cluster-api-gcp.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.

netlify[bot] avatar Jun 12 '24 11:06 netlify[bot]

Would this be considered a breaking API change?

damdo avatar Jun 12 '24 15:06 damdo

Hey folks.

@damdo @cpanato thanks for the review.

Would this be considered a breaking API change?

I feel so, since we are making it required here in this PR. Let me know if you would like me to change something. Thanks.

But thinking out loud, if the controller would crash when this attribute was not passed, the controller would be implicitly requiring this value from what I can understand.

tasdikrahman avatar Jun 14 '24 07:06 tasdikrahman

@tasdikrahman #1187 is highlighting that this missing causes a nil pointer exception, which makes the controller crash. I think the right way of doing this would be to first fix that nil pointer by instead throwing an reconciler error instead of assuming Network is always there. (1)

Then this would alert users that the cluster can't be created because the Network field is missing, and so at least we would give out some informative detail on how they can fix this.

Then yeah by all means, we can set that to not optional, but it would be an API breaking change, which we might want to think through whether we want that to be happening in v1beta1 or that requires a v1beta2.

Would you be able to open a PR to do (1) for now? Thanks!

damdo avatar Jun 14 '24 08:06 damdo

@damdo That makes sense, thanks for your comments, I have tried addressing the nil pointer issue here in this PR https://github.com/kubernetes-sigs/cluster-api-provider-gcp/pull/1261/ to begin with.

tasdikrahman avatar Jun 14 '24 10:06 tasdikrahman

Hello @damdo , I opened up an issue here https://github.com/kubernetes-sigs/cluster-api-provider-gcp/issues/1285 to track this change of the Network field being made a required one.

tasdikrahman avatar Jul 08 '24 14:07 tasdikrahman