firewall_controller: honor firewall-managed annotation and loadBalancerSourceRanges for LoadBalancer services#915
Open
elkh510 wants to merge 1 commit into
Conversation
Author
|
hi @gottwald @sreeram-venkitesh @sriritwikdo — could you please take a look when you have a moment? This fixes the two issues described in #911. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #911
Changes
1. Extend
isManaged()check to LoadBalancer servicesThe
kubernetes.digitalocean.com/firewall-managed: "false"annotation was silently ignored forLoadBalancerservices -isManaged()was only called in theNodePortbranch. This change adds the same check to theLoadBalancerbranch so the annotation works consistently across both service types.2. Use
spec.loadBalancerSourceRangesas inbound rule sourcesFor
REGIONAL_NETWORK+ externalLoadBalancerservices, service port inbound rules were always created with hardcoded0.0.0.0/0/::/0sources. This change readsspec.loadBalancerSourceRanges(already parsed elsewhere for LB-level firewall rules) and uses those CIDRs as the source addresses in the worker firewall inbound rules when set.Health check port rules are unaffected - they continue to use
LoadBalancerUIDsas source.Internal (
network: internal) LBs are unaffected - they are excluded by the existinglbNetwork == Externalguard and no worker firewall rules are added for them.Tests
Two new test cases added to
TestFirewallController_createReconciledFirewallRequest:skip REGIONAL_NETWORK LB service when firewall-managed annotation is falseuse loadBalancerSourceRanges as inbound rule sources for REGIONAL_NETWORK LB