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

Align path prefix matching with Ingress. #869

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 22 additions & 12 deletions apis/v1alpha2/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,33 @@ type HTTPRouteRule struct {
//
// Prefix and Exact paths must be syntactically valid:
//
// - Must begin with the '/' character
// - Must not contain consecutive '/' characters (e.g. /foo///, //).
// - For prefix paths, a trailing '/' character in the Path is ignored,
// e.g. /abc and /abc/ specify the same match.
// - Must begin with the `/` character
// - Must not contain consecutive `/` characters (e.g. `/foo///`, `//`).
//
// +kubebuilder:validation:Enum=Exact;Prefix;RegularExpression
type PathMatchType string

// PathMatchType constants.
const (
PathMatchExact PathMatchType = "Exact"
PathMatchPrefix PathMatchType = "Prefix"
// Matches based on a URL path prefix split by `/`. Matching is
// case sensitive and done on a path element by element basis. A
// path element refers to the list of labels in the path split by
// the `/` separator. A request is a match for path _p_ if every
// _p_ is an element-wise prefix of the request path.
//
// For example, `/abc`, `/abc/` and `/abc/def` match the prefix
// `/abc`, but `/abcd` does not.
PathMatchExact PathMatchType = "Exact"

// Matches the URL path exactly and with case sensitivity.
PathMatchPrefix PathMatchType = "Prefix"
Comment on lines +224 to +235
Copy link
Contributor

Choose a reason for hiding this comment

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

@jpeach 👋 was just looking at this and the godoc for these two (Exact and Prefix) are switched.

Copy link
Contributor Author

Choose a reason for hiding this comment

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


// Matches if the URL path matches the given regular expression with
// case sensitivity.
//
// Since `"RegularExpression"` has custom conformance, implementations
// can support POSIX, PCRE, RE2 or any other regular expression dialect.
// Please read the implementation's documentation to determine the supported
// dialect.
PathMatchRegularExpression PathMatchType = "RegularExpression"
)

Expand All @@ -237,11 +252,6 @@ type HTTPPathMatch struct {
//
// Support: Custom (RegularExpression)
//
// Since RegularExpression PathType has custom conformance, implementations
// can support POSIX, PCRE or any other dialects of regular expressions.
// Please read the implementation's documentation to determine the supported
// dialect.
//
// +optional
// +kubebuilder:default=Prefix
Type *PathMatchType `json:"type,omitempty"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.