Skip to content

Conversation

barbacbd
Copy link
Contributor

@barbacbd barbacbd commented Sep 18, 2025

What type of PR is this?

/kind feature
/kind api-change

What this PR does / why we need it:

Add API changes to Skip firewall rule creation. When unmanaged, the firewall rules will not be
created. When this is the case, the firewall rules should exist prior to creating the network.
This will allow ServiceAccounts to skip the rules:compute.firewalls.create.
Update the services and interfaces. The firewall service will no longer create firewall rules when
the firewall policy is set to unmanaged OR when a shared vpc is used during installation and resource creation.

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 #

https://issues.redhat.com/browse/CORS-4230

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:

Add API changes to Skip firewall rule creation. When unmanaged, the firewall rules will not be
created. When this is the case, the firewall rules should exist prior to creating the network.
This will allow ServiceAccounts to skip the rules:compute.firewalls.create.

Update the services and interfaces. The firewall service will no longer create firewall rules when
the firewall policy is set to unmanaged OR when a shared vpc is used during installation and resource creation.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Sep 18, 2025
Copy link

netlify bot commented Sep 18, 2025

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

Name Link
🔨 Latest commit 56d4280
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-cluster-api-gcp/deploys/68d42ee43f740700081ae43a
😎 Deploy Preview https://deploy-preview-1532--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 project configuration.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 18, 2025
@k8s-ci-robot k8s-ci-robot requested review from damdo and dims September 18, 2025 19:38
@k8s-ci-robot
Copy link
Contributor

Hi @barbacbd. 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 Sep 18, 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.

/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 Sep 19, 2025
@barbacbd
Copy link
Contributor Author

/retest

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 @barbacbd

On the API side, I think we could make it a bit more "future proof" and adherent to the upstream API conventions: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md

Comment on lines 140 to 143
// SkipFirewallRuleCreation should be set to true when no firewall rules should be
// created by the provider.
SkipFirewallRuleCreation *bool `json:"skipFirewallRuleCreation,omitempty"`

Copy link
Member

Choose a reason for hiding this comment

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

How about creating a Firewall type that in the future can be expanded if necessary?

// Firewall configuration.
// +optional
Firewall FirewallSpec `json:"firewall,omitempty"`

And for the inner struct maybe have a field called something along the lines of RulesManagement?

// FirewallSpec contains configuration for the firewall.
type FirewallSpec struct {
	// RulesManagement determines the management policy for firewall rules.
	// "On": The controller will create and manage firewall rules.
	// "Off": The controller will not touch any firewall rules. If this is
	//        changed to "Off" after rules have been created, they will not be
	//        deleted.
	// Defaults to "On".
	// +optional
	// +kubebuilder:default:="On"
	RulesManagement RulesManagementPolicy `json:"rulesManagement,omitempty"`
}

// RulesManagementPolicy is a string enum type for managing firewall rules.
// +kubebuilder:validation:Enum=On;Off
type RulesManagementPolicy string

const (
	// RulesManagementOn indicates that the controller should create and manage
	// firewall rules. This is the default behavior.
	RulesManagementOn RulesManagementPolicy = "On"

	// RulesManagementOff indicates that the controller should not create or manage
	// any firewall rules. If rules already exist, they will be left as-is.
	RulesManagementOff RulesManagementPolicy = "Off"
)

Copy link
Member

Choose a reason for hiding this comment

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

cc. @JoelSpeed for a sanity check

Choose a reason for hiding this comment

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

Seems like a reasonable suggestion, though maybe you want to change it to be rules: Managed | Unmanaged so that in the future you could potentially add a PartiallyManaged or other third option to the enum

… firewall rule creation

api:

Add API changes to Skip firewall rule creation. When unmanaged, the firewall rules will not be
created. When this is the case, the firewall rules should exist prior to creating the network.
This will allow ServiceAccounts to skip the rules:

compute.firewalls.create

cloud:

Update the services and interfaces. The firewall service will no longer create firewall rules when
the firewall policy is set to unmanaged OR when a shared vpc is used during installation and resource creation.
@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 Sep 24, 2025
@barbacbd barbacbd changed the title CORS-4230: Add SkipFirewallRuleCreation CORS-4230: Add a firewall spec and the ability to manage or unmanaged firewall rule creation Sep 24, 2025
@barbacbd barbacbd requested review from damdo and JoelSpeed September 24, 2025 19:01
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!

/approve

/assign @justinsb @salasberryfin @cpanato

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: barbacbd, damdo

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 Sep 25, 2025
@barbacbd barbacbd mentioned this pull request Sep 26, 2025
3 tasks
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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. 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/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.

7 participants