Skip to content

Commit

Permalink
dataclients/kubernetes: disable network backend address validation
Browse files Browse the repository at this point in the history
Disable address validation to prevent errors for existing RouteGroups.

Reverts #2719

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov committed Dec 6, 2023
1 parent f67dd0e commit 3a6925a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
5 changes: 0 additions & 5 deletions cmd/webhook/admission/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ func TestRouteGroupAdmitter(t *testing.T) {
inputFile: "rg-with-multiple-predicates.json",
message: `single predicate expected at \"Method(\\\"GET\\\") && Path(\\\"/\\\")\"\nsingle predicate expected at \" \"`,
},
{
name: "routegroup with invalid backends",
inputFile: "rg-with-invalid-backend-path.json",
message: `backend address \"http://example.com/foo\" does not match scheme://host format\nbackend address \"http://example.com/foo/bar\" does not match scheme://host format\nbackend address \"http://example.com/foo/\" does not match scheme://host format\nbackend address \"/foo\" does not match scheme://host format\nbackend address \"http://example.com/\" does not match scheme://host format\nbackend address \"example.com/\" does not match scheme://host format\nbackend address \"example.com/foo\" does not match scheme://host format\nbackend address \"http://example.com?foo=bar\" does not match scheme://host format\nbackend address \"example.com\" does not match scheme://host format`,
},
} {
t.Run(tc.name, func(t *testing.T) {
expectedResponse := responseAllowedFmt
Expand Down
3 changes: 2 additions & 1 deletion dataclients/kubernetes/definitions/routegroupvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (rgv *RouteGroupValidator) Validate(item *RouteGroupItem) error {
var errs []error
errs = append(errs, rgv.validateFilters(item))
errs = append(errs, rgv.validatePredicates(item))
errs = append(errs, rgv.validateBackends(item))
// errs = append(errs, rgv.validateBackends(item))

return errorsJoin(errs...)
}
Expand Down Expand Up @@ -93,6 +93,7 @@ func (rgv *RouteGroupValidator) validatePredicates(item *RouteGroupItem) error {
return errorsJoin(errs...)
}

//lint:ignore U1000 Disable address validation to prevent errors for existing RouteGroups
func (rgv *RouteGroupValidator) validateBackends(item *RouteGroupItem) error {
var errs []error
for _, backend := range item.Spec.Backends {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,3 @@ single predicate expected at "Path(\"/foo\") && Method(\"GET\")"
single predicate expected at ""
single filter expected at "inlineContent(\"/foo\") -> status(200)"
single filter expected at " "
backend address "http://example.com/foo" does not match scheme://host format
backend address "http://example.com/foo/bar" does not match scheme://host format
backend address "http://example.com/foo/" does not match scheme://host format
backend address "/foo" does not match scheme://host format
backend address "example.com/" does not match scheme://host format
backend address "http://example.com?foo=bar" does not match scheme://host format
backend address "example.com" does not match scheme://host format
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
backend address \\\"http://example\.com/foo\\\" does not match scheme://host format
backend address \\\"http://example\.com/foo/bar\\\" does not match scheme://host format
backend address \\\"/foo\\\" does not match scheme://host format
backend address \\\"/foo/bar\\\" does not match scheme://host format
backend address \\\"example\.com/foo\\\" does not match scheme://host format
backend address \\\"http://example\.com/\\\" does not match scheme://host format
backend address \\\"http://example\.com\?foo=bar\\\" does not match scheme://host format
backend address \\\"example\.com\\\" does not match scheme://host format

0 comments on commit 3a6925a

Please sign in to comment.