feature: virtual service supports traffic mirroring to multiple destinations (#2805)

This commit is contained in:
fatedier 2023-08-01 11:17:15 +08:00 committed by GitHub
parent f59de249c8
commit f3753ed9ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1410 additions and 882 deletions

View File

@ -4735,6 +4735,34 @@ spec:
format: double
type: number
type: object
mirrors:
items:
properties:
destination:
properties:
host:
description: The name of a service from the service
registry.
type: string
port:
description: Specifies the port on the host that is
being addressed.
properties:
number:
type: integer
type: object
subset:
description: The name of a subset within the service.
type: string
type: object
percentage:
properties:
value:
format: double
type: number
type: object
type: object
type: array
name:
description: The name assigned to the route for debugging purposes.
type: string
@ -5530,6 +5558,34 @@ spec:
format: double
type: number
type: object
mirrors:
items:
properties:
destination:
properties:
host:
description: The name of a service from the service
registry.
type: string
port:
description: Specifies the port on the host that is
being addressed.
properties:
number:
type: integer
type: object
subset:
description: The name of a subset within the service.
type: string
type: object
percentage:
properties:
value:
format: double
type: number
type: object
type: object
type: array
name:
description: The name assigned to the route for debugging purposes.
type: string

View File

@ -391,6 +391,18 @@
}
}
},
"istio.networking.v1alpha3.HTTPMirrorPolicy": {
"description": "Hide this from doc until implemented.",
"type": "object",
"properties": {
"destination": {
"$ref": "#/components/schemas/istio.networking.v1alpha3.Destination"
},
"percentage": {
"$ref": "#/components/schemas/istio.networking.v1alpha3.Percent"
}
}
},
"istio.networking.v1alpha3.HTTPRedirect": {
"description": "HTTPRedirect can be used to send a 301 redirect response to the caller, where the Authority/Host and the URI in the response can be swapped with the specified values. For example, the following rule redirects requests for /v1/getProductRatings API on the ratings service to /v1/bookRatings provided by the bookratings service.",
"type": "object",
@ -558,6 +570,13 @@
"mirror": {
"$ref": "#/components/schemas/istio.networking.v1alpha3.Destination"
},
"mirrors": {
"description": "Hide this from doc until implemented.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.networking.v1alpha3.HTTPMirrorPolicy"
}
},
"mirrorPercent": {
"description": "Percentage of the traffic to be mirrored by the `mirror` field. Use of integer `mirror_percent` value is deprecated. Use the double `mirror_percentage` field instead $hide_from_docs",
"type": "integer",

File diff suppressed because it is too large Load Diff

View File

@ -633,6 +633,17 @@ message HTTPRoute {
// destination.
Destination mirror = 9;
// $hide_from_docs
// Hide this from doc until implemented.
//
// Specifies the destinations to mirror HTTP traffic in addition
// to the original destination. Mirrored traffic is on a
// best effort basis where the sidecar/gateway will not wait for the
// mirrored destinations to respond before returning the response from the
// original destination. Statistics will be generated for the mirrored
// destination.
repeated HTTPMirrorPolicy mirrors = 22;
// Percentage of the traffic to be mirrored by the `mirror` field.
// Use of integer `mirror_percent` value is deprecated. Use the
// double `mirror_percentage` field instead
@ -656,7 +667,7 @@ message HTTPRoute {
Headers headers = 16;
// $hide_from_docs
// Next available field number: 22
// Next available field number: 23
}
@ -2079,6 +2090,31 @@ message HTTPFaultInjection {
}
}
// $hide_from_docs
// Hide this from doc until implemented.
//
// HTTPMirrorPolicy can be used to specify the destinations to mirror HTTP traffic in addition
// to the original destination. Mirrored traffic is on a
// best effort basis where the sidecar/gateway will not wait for the
// mirrored destinations to respond before returning the response from the
// original destination. Statistics will be generated for the mirrored
// destination.
message HTTPMirrorPolicy {
// $hide_from_docs
// Hide this from doc until implemented.
//
// Destination specifies the target of the mirror operation.
Destination destination = 1 [(google.api.field_behavior) = REQUIRED];
// $hide_from_docs
// Hide this from doc until implemented.
//
// Percentage of the traffic to be mirrored by the `destination` field.
// If this field is absent, all the traffic (100%) will be mirrored.
// Max value is 100.
Percent percentage = 2;
}
// PortSelector specifies the number of a port to be used for
// matching or selection for final routing.
message PortSelector {

View File

@ -509,6 +509,27 @@ func (in *HTTPFaultInjection_Abort) DeepCopyInterface() interface{} {
return in.DeepCopy()
}
// DeepCopyInto supports using HTTPMirrorPolicy within kubernetes types, where deepcopy-gen is used.
func (in *HTTPMirrorPolicy) DeepCopyInto(out *HTTPMirrorPolicy) {
p := proto.Clone(in).(*HTTPMirrorPolicy)
*out = *p
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMirrorPolicy. Required by controller-gen.
func (in *HTTPMirrorPolicy) DeepCopy() *HTTPMirrorPolicy {
if in == nil {
return nil
}
out := new(HTTPMirrorPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMirrorPolicy. Required by controller-gen.
func (in *HTTPMirrorPolicy) DeepCopyInterface() interface{} {
return in.DeepCopy()
}
// DeepCopyInto supports using PortSelector within kubernetes types, where deepcopy-gen is used.
func (in *PortSelector) DeepCopyInto(out *PortSelector) {
p := proto.Clone(in).(*PortSelector)

View File

@ -270,6 +270,17 @@ func (this *HTTPFaultInjection_Abort) UnmarshalJSON(b []byte) error {
return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HTTPMirrorPolicy
func (this *HTTPMirrorPolicy) MarshalJSON() ([]byte, error) {
str, err := VirtualServiceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPMirrorPolicy
func (this *HTTPMirrorPolicy) UnmarshalJSON(b []byte) error {
return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for PortSelector
func (this *PortSelector) MarshalJSON() ([]byte, error) {
str, err := VirtualServiceMarshaler.MarshalToString(this)

View File

@ -391,6 +391,18 @@
}
}
},
"istio.networking.v1beta1.HTTPMirrorPolicy": {
"description": "Hide this from doc until implemented.",
"type": "object",
"properties": {
"destination": {
"$ref": "#/components/schemas/istio.networking.v1beta1.Destination"
},
"percentage": {
"$ref": "#/components/schemas/istio.networking.v1beta1.Percent"
}
}
},
"istio.networking.v1beta1.HTTPRedirect": {
"description": "HTTPRedirect can be used to send a 301 redirect response to the caller, where the Authority/Host and the URI in the response can be swapped with the specified values. For example, the following rule redirects requests for /v1/getProductRatings API on the ratings service to /v1/bookRatings provided by the bookratings service.",
"type": "object",
@ -558,6 +570,13 @@
"mirror": {
"$ref": "#/components/schemas/istio.networking.v1beta1.Destination"
},
"mirrors": {
"description": "Hide this from doc until implemented.",
"type": "array",
"items": {
"$ref": "#/components/schemas/istio.networking.v1beta1.HTTPMirrorPolicy"
}
},
"mirrorPercent": {
"description": "Percentage of the traffic to be mirrored by the `mirror` field. Use of integer `mirror_percent` value is deprecated. Use the double `mirror_percentage` field instead $hide_from_docs",
"type": "integer",

File diff suppressed because it is too large Load Diff

View File

@ -633,6 +633,17 @@ message HTTPRoute {
// destination.
Destination mirror = 9;
// $hide_from_docs
// Hide this from doc until implemented.
//
// Specifies the destinations to mirror HTTP traffic in addition
// to the original destination. Mirrored traffic is on a
// best effort basis where the sidecar/gateway will not wait for the
// mirrored destinations to respond before returning the response from the
// original destination. Statistics will be generated for the mirrored
// destination.
repeated HTTPMirrorPolicy mirrors = 22;
// Percentage of the traffic to be mirrored by the `mirror` field.
// Use of integer `mirror_percent` value is deprecated. Use the
// double `mirror_percentage` field instead
@ -656,7 +667,7 @@ message HTTPRoute {
Headers headers = 16;
// $hide_from_docs
// Next available field number: 22
// Next available field number: 23
}
@ -2079,6 +2090,31 @@ message HTTPFaultInjection {
}
}
// $hide_from_docs
// Hide this from doc until implemented.
//
// HTTPMirrorPolicy can be used to specify the destinations to mirror HTTP traffic in addition
// to the original destination. Mirrored traffic is on a
// best effort basis where the sidecar/gateway will not wait for the
// mirrored destinations to respond before returning the response from the
// original destination. Statistics will be generated for the mirrored
// destination.
message HTTPMirrorPolicy {
// $hide_from_docs
// Hide this from doc until implemented.
//
// Destination specifies the target of the mirror operation.
Destination destination = 1 [(google.api.field_behavior) = REQUIRED];
// $hide_from_docs
// Hide this from doc until implemented.
//
// Percentage of the traffic to be mirrored by the `destination` field.
// If this field is absent, all the traffic (100%) will be mirrored.
// Max value is 100.
Percent percentage = 2;
}
// PortSelector specifies the number of a port to be used for
// matching or selection for final routing.
message PortSelector {

View File

@ -509,6 +509,27 @@ func (in *HTTPFaultInjection_Abort) DeepCopyInterface() interface{} {
return in.DeepCopy()
}
// DeepCopyInto supports using HTTPMirrorPolicy within kubernetes types, where deepcopy-gen is used.
func (in *HTTPMirrorPolicy) DeepCopyInto(out *HTTPMirrorPolicy) {
p := proto.Clone(in).(*HTTPMirrorPolicy)
*out = *p
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMirrorPolicy. Required by controller-gen.
func (in *HTTPMirrorPolicy) DeepCopy() *HTTPMirrorPolicy {
if in == nil {
return nil
}
out := new(HTTPMirrorPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMirrorPolicy. Required by controller-gen.
func (in *HTTPMirrorPolicy) DeepCopyInterface() interface{} {
return in.DeepCopy()
}
// DeepCopyInto supports using PortSelector within kubernetes types, where deepcopy-gen is used.
func (in *PortSelector) DeepCopyInto(out *PortSelector) {
p := proto.Clone(in).(*PortSelector)

View File

@ -270,6 +270,17 @@ func (this *HTTPFaultInjection_Abort) UnmarshalJSON(b []byte) error {
return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for HTTPMirrorPolicy
func (this *HTTPMirrorPolicy) MarshalJSON() ([]byte, error) {
str, err := VirtualServiceMarshaler.MarshalToString(this)
return []byte(str), err
}
// UnmarshalJSON is a custom unmarshaler for HTTPMirrorPolicy
func (this *HTTPMirrorPolicy) UnmarshalJSON(b []byte) error {
return VirtualServiceUnmarshaler.Unmarshal(bytes.NewReader(b), this)
}
// MarshalJSON is a custom marshaler for PortSelector
func (this *PortSelector) MarshalJSON() ([]byte, error) {
str, err := VirtualServiceMarshaler.MarshalToString(this)

View File

@ -41123,6 +41123,12 @@
"name": "mirror",
"type": "Destination"
},
{
"id": 22,
"name": "mirrors",
"type": "HTTPMirrorPolicy",
"is_repeated": true
},
{
"id": 18,
"name": "mirror_percent",
@ -41813,6 +41819,27 @@
}
]
},
{
"name": "HTTPMirrorPolicy",
"fields": [
{
"id": 1,
"name": "destination",
"type": "Destination",
"options": [
{
"name": "(google.api.field_behavior)",
"value": "REQUIRED"
}
]
},
{
"id": 2,
"name": "percentage",
"type": "Percent"
}
]
},
{
"name": "PortSelector",
"fields": [
@ -43691,6 +43718,12 @@
"name": "mirror",
"type": "Destination"
},
{
"id": 22,
"name": "mirrors",
"type": "HTTPMirrorPolicy",
"is_repeated": true
},
{
"id": 18,
"name": "mirror_percent",
@ -44381,6 +44414,27 @@
}
]
},
{
"name": "HTTPMirrorPolicy",
"fields": [
{
"id": 1,
"name": "destination",
"type": "Destination",
"options": [
{
"name": "(google.api.field_behavior)",
"value": "REQUIRED"
}
]
},
{
"id": 2,
"name": "percentage",
"type": "Percent"
}
]
},
{
"name": "PortSelector",
"fields": [