Skip to content

Move NodeBalancer firewall validation from creation time to preflight check#1053

Open
ChihweiLHBird wants to merge 4 commits intolinode:mainfrom
ChihweiLHBird:zhiwei/move-firewall-check-to-preflight-check
Open

Move NodeBalancer firewall validation from creation time to preflight check#1053
ChihweiLHBird wants to merge 4 commits intolinode:mainfrom
ChihweiLHBird:zhiwei/move-firewall-check-to-preflight-check

Conversation

@ChihweiLHBird
Copy link
Copy Markdown
Contributor

@ChihweiLHBird ChihweiLHBird commented Mar 28, 2026

What this PR does / why we need it:

Moves firewall existence validation for direct NodeBalancerFirewallID from EnsureNodeBalancer to the controller's preflight checks, matching the existing behavior for NodeBalancerFirewallRef. This provides earlier feedback when a non-existent firewall ID is specified. Splits reconcilePreflightLinodeFirewallCheck into reconcilePreflightFirewallID and reconcilePreflightFirewallRef.

Special notes for your reviewer:

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
@ChihweiLHBird ChihweiLHBird marked this pull request as ready for review March 28, 2026 18:52
Copilot AI review requested due to automatic review settings March 28, 2026 18:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Moves NodeBalancer firewall existence validation for direct NodeBalancerFirewallID from the load balancer service layer into the LinodeCluster controller preflight checks, aligning it with the existing NodeBalancerFirewallRef preflight behavior for earlier feedback during reconciliation.

Changes:

  • Split the controller preflight firewall check into reconcilePreflightFirewallID and reconcilePreflightFirewallRef, and invoke the appropriate one based on spec configuration.
  • Remove direct-firewall GetFirewall validation from cloud/services.EnsureNodeBalancer, passing the ID through to the Linode API create call.
  • Update unit tests: add controller coverage for “direct firewall ID not found” and remove service-level coverage that no longer applies.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/controller/linodecluster_controller.go Adds preflight validation for direct firewall IDs and splits preflight logic into ID vs Ref paths.
internal/controller/linodecluster_controller_test.go Adds a controller test path asserting the preflight condition is set false when a direct firewall ID is invalid.
cloud/services/loadbalancers.go Removes firewall existence validation from EnsureNodeBalancer when a direct ID is provided.
cloud/services/loadbalancers_test.go Removes expectations/tests tied to the deleted service-layer GetFirewall validation.

Comment thread internal/controller/linodecluster_controller.go
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants