Skip to content

Commit

Permalink
httproute: use lists insteads of maps for HTTPRequestHeaderFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
hbagdi committed May 25, 2021
1 parent 53e7802 commit 6019033
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 22 deletions.
21 changes: 19 additions & 2 deletions apis/v1alpha2/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,23 @@ const (
HTTPRouteFilterExtensionRef HTTPRouteFilterType = "ExtensionRef"
)

// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
type HTTPHeader struct {
// Name is the name of the HTTP query param to be matched. This must be an
// exact string match. (See
// https://tools.ietf.org/html/rfc7230#section-2.7.3).
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
Name string `json:"name"`

// Value is the value of HTTP query param to be matched.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=1024
Value string `json:"value"`
}

// HTTPRequestHeaderFilter defines configuration for the RequestHeaderModifier
// filter.
type HTTPRequestHeaderFilter struct {
Expand All @@ -550,7 +567,7 @@ type HTTPRequestHeaderFilter struct {
// Support: Extended
//
// +optional
Set map[string]string `json:"set,omitempty"`
Set []HTTPHeader `json:"set,omitempty"`

// Add adds the given header (name, value) to the request
// before the action. It appends to any existing values associated
Expand All @@ -571,7 +588,7 @@ type HTTPRequestHeaderFilter struct {
// Support: Extended
//
// +optional
Add map[string]string `json:"add,omitempty"`
Add []HTTPHeader `json:"add,omitempty"`

// Remove the given header(s) from the HTTP request before the
// action. The value of RemoveHeader is a list of HTTP header
Expand Down
27 changes: 19 additions & 8 deletions apis/v1alpha2/zz_generated.deepcopy.go

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

102 changes: 90 additions & 12 deletions config/crd/bases/networking.x-k8s.io_httproutes.yaml

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

0 comments on commit 6019033

Please sign in to comment.