Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Support for loadBalancerSourceRanges on the envoy service #2878

Merged
merged 9 commits into from
Apr 19, 2024

Conversation

jaynis
Copy link
Contributor

@jaynis jaynis commented Mar 11, 2024

This PR adds support for loadBalancerSourceRanges on the envoy service. loadBalancerSourceRanges are used to specify firewall rules on the underlying load balancer of the kubernetes platform provider, if the provider supports this.

Signed-off-by: jaynis <kranz.jannis@googlemail.com>
@jaynis jaynis requested a review from a team as a code owner March 11, 2024 15:39
jaynis added 3 commits March 11, 2024 16:51
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.52%. Comparing base (29946b0) to head (146f5d8).
Report is 54 commits behind head on main.

❗ Current head 146f5d8 differs from pull request most recent head f26c300. Consider uploading reports for the commit f26c300 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2878      +/-   ##
==========================================
- Coverage   66.51%   64.52%   -1.99%     
==========================================
  Files         161      121      -40     
  Lines       22673    21405    -1268     
==========================================
- Hits        15080    13811    -1269     
- Misses       6720     6723       +3     
+ Partials      873      871       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jaynis
Copy link
Contributor Author

jaynis commented Mar 11, 2024

Failing tests seem to be related to #2269. Any idea how to overcome this?

@arkodg
Copy link
Contributor

arkodg commented Mar 11, 2024

@jaynis this API may make sense since the knob is specific to LB
to immediately unblock yourself, suggest using the new patch field

apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
  name: custom-proxy-config
  namespace: envoy-gateway-system
spec:
  logging:
    level:
      default: warn
  provider:
    kubernetes:
      envoyService:
        patch:
          value:
            spec:
              loadBalancerSourceRanges: 1.0.0.0/8
    type: Kubernetes

@arkodg
Copy link
Contributor

arkodg commented Mar 11, 2024

/retest

@arkodg arkodg added this to the Backlog milestone Mar 11, 2024
@@ -115,6 +115,12 @@ func validateService(spec *egv1a1.EnvoyProxySpec) []error {
errs = append(errs, fmt.Errorf("allocateLoadBalancerNodePorts can only be set for %v type", egv1a1.ServiceTypeLoadBalancer))
}
}
if serviceType, serviceLoadBalancerSourceRanges :=
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a IP Address check in here

@zirain
Copy link
Contributor

zirain commented Mar 28, 2024

/retest

@arkodg
Copy link
Contributor

arkodg commented Apr 12, 2024

hey @jaynis still working on this one ?

@arkodg arkodg modified the milestones: Backlog, v1.1.0, v1.1.0-rc1 Apr 12, 2024
@jaynis
Copy link
Contributor Author

jaynis commented Apr 12, 2024

Sorry totally forgot about this one. What kind of IP address check do you have in mind there?

@arkodg
Copy link
Contributor

arkodg commented Apr 12, 2024

Sorry totally forgot about this one. What kind of IP address check do you have in mind there?

something like

if ip, err := netip.ParseAddr(*serviceLoadBalancerIP); err != nil || !ip.Unmap().Is4() {

jaynis added 2 commits April 12, 2024 17:16
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
Signed-off-by: jaynis <kranz.jannis@googlemail.com>
@jaynis
Copy link
Contributor Author

jaynis commented Apr 16, 2024

I have added a CEL validation rule to check whether all loadBalancerSourceRanges have a valid CIDR notation. But now I am hitting some kind of schema validation rule cost budget. Limiting the maximum number of items, as suggested in the error message, does not help either.

Any suggestions how to proceed here @arkodg? Should I simply remove the CEL validation again?

@arkodg
Copy link
Contributor

arkodg commented Apr 17, 2024

schema validation rule cost budget

yah should be fine to rm CEL you've already added logic inside the validate method

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

@arkodg arkodg merged commit bdc1eae into envoyproxy:main Apr 19, 2024
19 of 20 checks passed
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.

3 participants