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

chore(MeshHTTPRoute): default catch all path in route match #6993

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,26 @@ func prepareRoutes(

var routes []Route
for _, rule := range rules {
var matches []api.Match

for _, match := range rule.Matches {
if match.Path == nil {
// According to Envoy docs, match must have precisely one of
// prefix, path, safe_regex, connect_matcher,
// path_separated_prefix, path_match_policy set, so when policy
// doesn't specify explicit type of matching, we are assuming
// "catch all" path (any path starting with "/").
match.Path = &api.PathMatch{
Value: "/",
bartsmykla marked this conversation as resolved.
Show resolved Hide resolved
Type: api.PathPrefix,
}
}

matches = append(matches, match)
}

route := Route{
Matches: rule.Matches,
Matches: matches,
}

if rule.Default.BackendRefs != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resources:
cluster: backend-_0_
timeout: 0s
- match:
prefix: /
queryParameters:
- name: v1
stringMatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resources:
- name: foo-prefix
stringMatch:
prefix: x
prefix: /
route:
cluster: backend
timeout: 0s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ virtualHosts:
idleTimeout: 5s
weightedClusters:
clusters:
- name: backend-26cb64fa4e85e7b7
- name: other-service-7ab0707c3913adf1
bartsmykla marked this conversation as resolved.
Show resolved Hide resolved
requestHeadersToAdd:
- header:
key: x-kuma-tags
value: '&kuma.io/service=sample-gateway&'
weight: 1
- name: other-service-7ab0707c3913adf1
- name: backend-26cb64fa4e85e7b7
requestHeadersToAdd:
- header:
key: x-kuma-tags
Expand Down