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

Reimplement getting load balancer source ranges #1896

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

panslava
Copy link
Contributor

@panslava panslava commented Jan 4, 2023

  • Introduce custom error type, to identify user errors
  • Cover with unit tests (was not done in old helper)
  • Needed to add IPv6 support later (in next PR)

/assign cezarygerard

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 4, 2023
@k8s-ci-robot k8s-ci-robot requested review from aojea and MrHohn January 4, 2023 17:56
@panslava panslava force-pushed the rework-source-ranges branch from d6c1beb to 2e39784 Compare January 4, 2023 23:29
@mmamczur
Copy link
Contributor

/lgtm

@k8s-ci-robot
Copy link
Contributor

@mmamczur: changing LGTM is restricted to collaborators

In response to this:

/lgtm

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/test-infra repository.

pkg/utils/sourceranges.go Outdated Show resolved Hide resolved
pkg/utils/sourceranges.go Outdated Show resolved Hide resolved
- Introduce custom error type, to identify user errors
- Cover with unit tests
- Needed to add IPv6 support later (in next PR)
@panslava panslava force-pushed the rework-source-ranges branch from 2e39784 to 3ddbfec Compare January 17, 2023 11:15
@@ -482,15 +482,15 @@ func (l4 *L4) ensureIPv4NodesFirewall(nodeNames []string, ipAddress string, resu
}()

// ensure firewalls
sourceRanges, err := helpers.GetLoadBalancerSourceRanges(l4.Service)
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, Ideally we should remove all these helper dependencies from the cloud-provider

grep -r "k8s.io/cloud-provider/service/helpers" pkg/
pkg/l4lb/l4netlbcontroller_test.go:     "k8s.io/cloud-provider/service/helpers"
pkg/l4lb/l4lbcommon.go: "k8s.io/cloud-provider/service/helpers"
pkg/utils/patch/patch.go:       svchelpers "k8s.io/cloud-provider/service/helpers"
pkg/neg/controller.go:  "k8s.io/cloud-provider/service/helpers"
pkg/loadbalancers/l4netlb_test.go:      servicehelper "k8s.io/cloud-provider/service/helpers"
pkg/loadbalancers/l4netlb.go:   "k8s.io/cloud-provider/service/helpers"
pkg/loadbalancers/l4.go:        "k8s.io/cloud-provider/service/helpers"
pkg/loadbalancers/l4_test.go:   servicehelper "k8s.io/cloud-provider/service/helpers"
pkg/healthchecksl4/healthchecksl4.go:   "k8s.io/cloud-provider/service/helpers"

cc: @swetharepakula

},
{
desc: "Should parse ranges from spec",
specRanges: []string{" 192.168.0.1/10", " 132.8.0.1/8 "},
Copy link
Member

Choose a reason for hiding this comment

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

this was a kubernetes API validation mistake, but the ecosystem moved on allowing them
kubernetes/kubernetes#94107

so it seems correct to allow it here too

@aojea
Copy link
Member

aojea commented Jan 17, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 17, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, mmamczur, panslava

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

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

5 participants