Skip to content

Conversation

@hrbasic
Copy link
Contributor

@hrbasic hrbasic commented May 3, 2025

/kind feature

What this PR does / why we need it:
When Cluster API (CAPI) is deployed in a different region or outside of the Google Cloud Platform (GCP), reconciliation fails because CAPI cannot reach the control plane API. Enabling the global access option on the internal passthrough load balancer would resolve this issue.

Which issue(s) this PR fixes
Fixes #1468

Release note:

Option for enabling global access for internal passthrough load balancer.

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. labels May 3, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 3, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @hrbasic!

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. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 3, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @hrbasic. 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 k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 3, 2025
@netlify
Copy link

netlify bot commented May 3, 2025

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

Name Link
🔨 Latest commit 1d6db6d
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-gcp/deploys/681b2462b8c8290008021b28
😎 Deploy Preview https://deploy-preview-1469--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.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 6, 2025
@richardcase
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 6, 2025
Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

Thanks for this @hrbasic 🙇

The pointer isn't needed on the bool field if you don't want to distinguish between "not set" and "false".

Apart from that, looks good to me.

// to access Internal Passthrough Network Load Balancer.
// Defaults to false.
// +optional
AllowGlobalAccess *bool `json:"allowGlobalAccess,omitempty"`
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
AllowGlobalAccess *bool `json:"allowGlobalAccess,omitempty"`
AllowGlobalAccess bool `json:"allowGlobalAccess,omitempty"`

Comment on lines 375 to 379
// AllowGlobalAccess allows clients from any region
// to access Internal Passthrough Network Load Balancer.
// Defaults to false.
// +optional
AllowGlobalAccess *bool `json:"allowGlobalAccess,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

The use of Booleans in new Kubernetes (and CAPI) APIs is strongly discouraged.
Reference in the Kubernetes API conventions: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#primitive-types

Think twice about bool fields. Many ideas start as boolean but eventually trend towards a small set of mutually exclusive options. Plan for future expansions by describing the policy options explicitly as a string type alias (e.g. TerminationMessagePolicy).

The suggested replacement is to use an Enum Type. So for example in this case you could define something like:
internalAccess, which can take two values: Regional | Global

Copy link
Member

Choose a reason for hiding this comment

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

Thats a good point @damdo. And KAL will pick that up when we add it.

I don't feel overly opinionated on the use of a bool here, but an enum will be more future-proof for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review and comments. I've updated the code to use an enum instead of a bool, as you suggested. Please let me know if there's anything else you'd like me to address.

@hrbasic hrbasic force-pushed the allow-global-access branch from 5dcd961 to 7bfe66c Compare May 7, 2025 07:28
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

Thanks for the change to Enum, I left some nits on the consts naming but mostly LGTM

@hrbasic hrbasic force-pushed the allow-global-access branch from 333747b to 1d6db6d Compare May 7, 2025 09:14
@richardcase
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hrbasic, richardcase

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2025
Copy link
Member

@damdo damdo 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 May 7, 2025
@k8s-ci-robot k8s-ci-robot merged commit 71f39ce into kubernetes-sigs:main May 7, 2025
17 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.1.0 milestone May 7, 2025
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Add an option to enable global access for internal passthrough load balancer

4 participants