Skip to content

Commit

Permalink
update httproute validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Oct 9, 2023
1 parent 957af79 commit 35d67ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/admission/validation/gateway/httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func validateHTTPRouteFeatures(httproute *gatewayapi.HTTPRoute, parserFeatures p
// See: https://github.com/Kong/kubernetes-ingress-controller/issues/3679
if len(match.QueryParams) != 0 {
if !parserFeatures.ExpressionRoutes || kongVersion.LE(versions.QueryParameterVersionCutoff) {
return fmt.Errorf("queryparam matching is not yet supported for httproute")
return fmt.Errorf("queryparam matching is only supported for httproute with Kong %s and expression router",
versions.QueryParameterVersionCutoff.String())
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion internal/admission/validation/gateway/httproute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/kong/kubernetes-ingress-controller/v2/internal/dataplane/parser"
"github.com/kong/kubernetes-ingress-controller/v2/internal/gatewayapi"
"github.com/kong/kubernetes-ingress-controller/v2/internal/versions"
)

func TestValidateHTTPRoute(t *testing.T) {
Expand Down Expand Up @@ -255,7 +256,8 @@ func TestValidateHTTPRoute(t *testing.T) {
}},
valid: false,
validationMsg: "httproute spec did not pass validation",
err: fmt.Errorf("queryparam matching is not yet supported for httproute"),
err: fmt.Errorf("queryparam matching is only supported for httproute with Kong %s and expression router",
versions.QueryParameterVersionCutoff),
},
{
msg: "we don't support any group except core kubernetes for backendRefs",
Expand Down

0 comments on commit 35d67ad

Please sign in to comment.