@@ -44,6 +44,14 @@ type HTTPRouteFilterSpec struct {
4444 DirectResponse * HTTPDirectResponseFilter `json:"directResponse,omitempty"`
4545 // +optional
4646 CredentialInjection * HTTPCredentialInjectionFilter `json:"credentialInjection,omitempty"`
47+ // Matches defines additional matching criteria for the HTTPRoute rule.
48+ // As with HTTPRouteRule.Matches, the rule is matched if any one match applies.
49+ // When both HTTPRouteRule.Matches and HTTPRouteFilter.Matches are set, the
50+ // effective matching is the logical AND of the two sets.
51+ //
52+ // +optional
53+ // +kubebuilder:validation:MaxItems=8
54+ Matches []HTTPRouteMatchFilter `json:"matches,omitempty"`
4755}
4856
4957// HTTPURLRewriteFilter define rewrites of HTTP URL components such as path and host
@@ -186,6 +194,55 @@ type InjectedCredential struct {
186194 // EG may support more credential types in the future, for example, OAuth2 access token retrieved by Client Credentials Grant flow.
187195}
188196
197+ // HTTPRouteMatchFilter defines additional matching criteria for the HTTPRoute rule.
198+ // At least one matcher must be specified.
199+ //
200+ // +kubebuilder:validation:MinProperties=1
201+ type HTTPRouteMatchFilter struct {
202+ // Cookies is a list of cookie matchers evaluated against the HTTP request.
203+ // All specified matchers must match.
204+ //
205+ // +kubebuilder:validation:MinItems=1
206+ // +kubebuilder:validation:MaxItems=16
207+ Cookies []HTTPCookieMatch `json:"cookies,omitempty"`
208+ }
209+
210+ // CookieMatchType specifies the semantics of how cookie values should be compared.
211+ // Valid CookieMatchType values are "Exact" and "RegularExpression".
212+ //
213+ // +kubebuilder:validation:Enum=Exact;RegularExpression
214+ type CookieMatchType string
215+
216+ // CookieMatchType constants.
217+ const (
218+ // CookieMatchExact matches the exact value of the cookie.
219+ CookieMatchExact CookieMatchType = "Exact"
220+ // CookieMatchRegularExpression matches a regular expression against the value of the cookie.
221+ // The regex string must adhere to the syntax documented in https://github.com/google/re2/wiki/Syntax.
222+ CookieMatchRegularExpression CookieMatchType = "RegularExpression"
223+ )
224+
225+ // HTTPCookieMatch defines how to match a single cookie.
226+ type HTTPCookieMatch struct {
227+ // Type specifies how to match against the value of the cookie.
228+ //
229+ // +optional
230+ // +kubebuilder:default=Exact
231+ Type * CookieMatchType `json:"type,omitempty"`
232+
233+ // Name is the cookie name to evaluate.
234+ //
235+ // +kubebuilder:validation:MinLength=1
236+ // +kubebuilder:validation:MaxLength=256
237+ Name string `json:"name"`
238+
239+ // Value is the cookie value to be matched.
240+ //
241+ // +kubebuilder:validation:MinLength=1
242+ // +kubebuilder:validation:MaxLength=4096
243+ Value string `json:"value"`
244+ }
245+
189246//+kubebuilder:object:root=true
190247
191248// HTTPRouteFilterList contains a list of HTTPRouteFilter resources.
0 commit comments