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): support url rewriting #5776

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
33 changes: 33 additions & 0 deletions app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
33 changes: 33 additions & 0 deletions deployments/charts/kuma/crds/kuma.io_meshhttproutes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,40 @@ spec:
- RequestHeaderModifier
- ResponseHeaderModifier
- RequestRedirect
- URLRewrite
type: string
urlRewrite:
properties:
hostname:
description: "PreciseHostname is the fully
qualified domain name of a network host.
This matches the RFC 1123 definition of
a hostname with 1 notable exception that
numeric IP addresses are not allowed.
\n Note that as per RFC1035 and RFC1123,
a *label* must consist of lower case alphanumeric
characters or '-', and must start and
end with an alphanumeric character. No
other punctuation is allowed."
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
path:
properties:
replaceFullPath:
type: string
replacePrefixMatch:
type: string
type:
enum:
- ReplaceFullPath
- ReplacePrefixMatch
type: string
required:
- type
type: object
type: object
required:
- type
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ type RuleConf struct {
BackendRefs *[]BackendRef `json:"backendRefs,omitempty"`
}

// +kubebuilder:validation:Enum=RequestHeaderModifier;ResponseHeaderModifier;RequestRedirect
// +kubebuilder:validation:Enum=RequestHeaderModifier;ResponseHeaderModifier;RequestRedirect;URLRewrite
type FilterType string

const (
RequestHeaderModifierType FilterType = "RequestHeaderModifier"
ResponseHeaderModifierType FilterType = "ResponseHeaderModifier"
RequestRedirectType FilterType = "RequestRedirect"
URLRewriteType FilterType = "URLRewrite"
)

// +kubebuilder:validation:MinLength=1
Expand Down Expand Up @@ -157,11 +158,31 @@ type RequestRedirect struct {
StatusCode *int `json:"statusCode,omitempty"`
}

// +kubebuilder:validation:Enum=ReplaceFullPath;ReplacePrefixMatch
type PathRewriteType string

const (
ReplaceFullPathType PathRewriteType = "ReplaceFullPath"
ReplacePrefixMatchType PathRewriteType = "ReplacePrefixMatch"
)

type PathRewrite struct {
Type PathRewriteType `json:"type"`
ReplaceFullPath *string `json:"replaceFullPath,omitempty"`
ReplacePrefixMatch *string `json:"replacePrefixMatch,omitempty"`
}

type URLRewrite struct {
Hostname *PreciseHostname `json:"hostname,omitempty"`
Path *PathRewrite `json:"path,omitempty"`
}

type Filter struct {
Type FilterType `json:"type"`
RequestHeaderModifier *HeaderModifier `json:"requestHeaderModifier,omitempty"`
ResponseHeaderModifier *HeaderModifier `json:"responseHeaderModifier,omitempty"`
RequestRedirect *RequestRedirect `json:"requestRedirect,omitempty"`
URLRewrite *URLRewrite `json:"urlRewrite,omitempty"`
// TODO: add path to redirect after adding URL rewrite
}

Expand Down
Loading