Skip to content

Commit 8ea2ae8

Browse files
committed
Make A/B deployment proportional to service weight
Distribute requests among the route's services based on service weight. The portion of the total weight that each service has is distributed evenly among the service's endpoints. bug 1470350 https://bugzilla.redhat.com/show_bug.cgi?id=1470350
1 parent 74121fa commit 8ea2ae8

File tree

12 files changed

+165
-56
lines changed

12 files changed

+165
-56
lines changed

api/protobuf-spec/github_com_openshift_origin_pkg_route_apis_route_v1.proto

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/swagger-spec/oapi-v1.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31412,7 +31412,7 @@
3141231412
},
3141331413
"v1.RouteSpec": {
3141431414
"id": "v1.RouteSpec",
31415-
"description": "RouteSpec describes the hostname or path the route exposes, any security information, and one or more backends the route points to. Weights on each backend can define the balance of traffic sent to each backend - if all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
31415+
"description": "RouteSpec describes the hostname or path the route exposes, any security information, and one to four backends the route points to. Weights (0-256, default 1) on each backend can define the balance of traffic sent to each backend. Weight 0 suppresses traffic to the backend - if all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
3141631416
"required": [
3141731417
"host",
3141831418
"to"
@@ -31435,7 +31435,7 @@
3143531435
"items": {
3143631436
"$ref": "v1.RouteTargetReference"
3143731437
},
31438-
"description": "alternateBackends is an extension of the 'to' field. If more than one service needs to be pointed to, then use this field. Use the weight field in RouteTargetReference object to specify relative preference. If the weight field is zero, the backend is ignored."
31438+
"description": "alternateBackends allows up to 3 additional backends to be assigned to the route. Only the Service kind is allowed, and it will be defaulted to Service. Use the weight field in RouteTargetReference object to specify relative preference. If the weight field is zero, no traffic will be sent to this service."
3143931439
},
3144031440
"port": {
3144131441
"$ref": "v1.RoutePort",
@@ -31471,7 +31471,7 @@
3147131471
"weight": {
3147231472
"type": "integer",
3147331473
"format": "int32",
31474-
"description": "weight as an integer between 1 and 256 that specifies the target's relative weight against other target reference objects"
31474+
"description": "weight as an integer between 0 and 256, default 1, that specifies the target's relative weight against other target reference objects. 0 suppresses requests to this backend."
3147531475
}
3147631476
}
3147731477
},

api/swagger-spec/openshift-openapi-spec.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99073,14 +99073,14 @@
9907399073
}
9907499074
},
9907599075
"com.github.openshift.origin.pkg.route.apis.route.v1.RouteSpec": {
99076-
"description": "RouteSpec describes the hostname or path the route exposes, any security information, and one or more backends the route points to. Weights on each backend can define the balance of traffic sent to each backend - if all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
99076+
"description": "RouteSpec describes the hostname or path the route exposes, any security information, and one to four backends (services) the route points to. Requests are distributed among the backends depending on the weights assigned to each backend. When using roundrobin scheduling the portion of requests that go to each backend is the backend weight divided by the sum of all of the backend weights. When the backend has more than one endpoint the requests that end up on the backend are roundrobin distributed among the endpoints. Weights are between 0 and 256 with default 1. Weight 0 causes no requests to the backend. If all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
9907799077
"required": [
9907899078
"host",
9907999079
"to"
9908099080
],
9908199081
"properties": {
9908299082
"alternateBackends": {
99083-
"description": "alternateBackends is an extension of the 'to' field. If more than one service needs to be pointed to, then use this field. Use the weight field in RouteTargetReference object to specify relative preference. If the weight field is zero, the backend is ignored.",
99083+
"description": "alternateBackends allows up to 3 additional backends to be assigned to the route. Only the Service kind is allowed, and it will be defaulted to Service. Use the weight field in RouteTargetReference object to specify relative preference.",
9908499084
"type": "array",
9908599085
"items": {
9908699086
"$ref": "#/definitions/com.github.openshift.origin.pkg.route.apis.route.v1.RouteTargetReference"
@@ -99103,7 +99103,7 @@
9910399103
"$ref": "#/definitions/com.github.openshift.origin.pkg.route.apis.route.v1.TLSConfig"
9910499104
},
9910599105
"to": {
99106-
"description": "to is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field is set to zero, no traffic will be sent to this service.",
99106+
"description": "to is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field (0-256 default 1) is set to zero, no traffic will be sent to this backend.",
9910799107
"$ref": "#/definitions/com.github.openshift.origin.pkg.route.apis.route.v1.RouteTargetReference"
9910899108
},
9910999109
"wildcardPolicy": {
@@ -99144,7 +99144,7 @@
9914499144
"type": "string"
9914599145
},
9914699146
"weight": {
99147-
"description": "weight as an integer between 1 and 256 that specifies the target's relative weight against other target reference objects",
99147+
"description": "weight as an integer between 0 and 256, default 1, that specifies the target's relative weight against other target reference objects. 0 suppresses requests to this backend.",
9914899148
"type": "integer",
9914999149
"format": "int32"
9915099150
}

pkg/openapi/zz_generated.openapi.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8104,7 +8104,7 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
81048104
"github.com/openshift/origin/pkg/route/apis/route/v1.RouteSpec": {
81058105
Schema: spec.Schema{
81068106
SchemaProps: spec.SchemaProps{
8107-
Description: "RouteSpec describes the hostname or path the route exposes, any security information, and one or more backends the route points to. Weights on each backend can define the balance of traffic sent to each backend - if all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
8107+
Description: "RouteSpec describes the hostname or path the route exposes, any security information, and one to four backends (services) the route points to. Requests are distributed among the backends depending on the weights assigned to each backend. When using roundrobin scheduling the portion of requests that go to each backend is the backend weight divided by the sum of all of the backend weights. When the backend has more than one endpoint the requests that end up on the backend are roundrobin distributed among the endpoints. Weights are between 0 and 256 with default 1. Weight 0 causes no requests to the backend. If all weights are zero the route will be considered to have no backends and return a standard 503 response.\n\nThe `tls` field is optional and allows specific certificates or behavior for the route. Routers typically configure a default certificate on a wildcard domain to terminate routes without explicit certificates, but custom hostnames usually must choose passthrough (send traffic directly to the backend via the TLS Server-Name- Indication field) or provide a certificate.",
81088108
Properties: map[string]spec.Schema{
81098109
"host": {
81108110
SchemaProps: spec.SchemaProps{
@@ -8122,13 +8122,13 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
81228122
},
81238123
"to": {
81248124
SchemaProps: spec.SchemaProps{
8125-
Description: "to is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field is set to zero, no traffic will be sent to this service.",
8125+
Description: "to is an object the route should use as the primary backend. Only the Service kind is allowed, and it will be defaulted to Service. If the weight field (0-256 default 1) is set to zero, no traffic will be sent to this backend.",
81268126
Ref: ref("github.com/openshift/origin/pkg/route/apis/route/v1.RouteTargetReference"),
81278127
},
81288128
},
81298129
"alternateBackends": {
81308130
SchemaProps: spec.SchemaProps{
8131-
Description: "alternateBackends is an extension of the 'to' field. If more than one service needs to be pointed to, then use this field. Use the weight field in RouteTargetReference object to specify relative preference. If the weight field is zero, the backend is ignored.",
8131+
Description: "alternateBackends allows up to 3 additional backends to be assigned to the route. Only the Service kind is allowed, and it will be defaulted to Service. Use the weight field in RouteTargetReference object to specify relative preference.",
81328132
Type: []string{"array"},
81338133
Items: &spec.SchemaOrArray{
81348134
Schema: &spec.Schema{
@@ -8211,7 +8211,7 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
82118211
},
82128212
"weight": {
82138213
SchemaProps: spec.SchemaProps{
8214-
Description: "weight as an integer between 1 and 256 that specifies the target's relative weight against other target reference objects",
8214+
Description: "weight as an integer between 0 and 256, default 1, that specifies the target's relative weight against other target reference objects. 0 suppresses requests to this backend.",
82158215
Type: []string{"integer"},
82168216
Format: "int32",
82178217
},

pkg/route/apis/route/v1/generated.proto

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)