Skip to content
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
2 changes: 2 additions & 0 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ In addition, the following conventions should be followed:
```

This is more efficient, extendable and self-describing.

* To represent percentage values, use the Percent message type defined in [api/base.proto](api/base.proto).
5 changes: 5 additions & 0 deletions api/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ message Locality {
string sub_zone = 3;
}

// Identifies a percentage, in the range [0.0, 100.0].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more comment to this.

Specifies a percentage, in the range [0.0, 100.0]. For Envoy APIs, this message must be used instead of int32 or double for specifying traffic split and similar settings based on percentage.

PS: if we define a message to replace double, we must force people to use it. Otherwise, we will get mixed double vs Percent, which would be a bad outcome. You may even want to update STYLE.md to force people to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I’ll add an update to STYLE.md

message Percent {
double value = 1 [(validate.rules).double = {gte: 0, lte: 100}];
}

// Identifies a specific Envoy instance. The node identifier is presented to the
// management server, which may use this identifier to distinguish per Envoy
// configuration for serving.
Expand Down
3 changes: 3 additions & 0 deletions api/filter/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ api_proto_library(
api_proto_library(
name = "health_check",
srcs = ["health_check.proto"],
deps = [
"//api:base",
],
)

api_proto_library(
Expand Down
7 changes: 7 additions & 0 deletions api/filter/http/health_check.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package envoy.api.v2.filter.http;
import "google/protobuf/duration.proto";
import "google/protobuf/wrappers.proto";

import "api/base.proto";
import "validate/validate.proto";

// [#protodoc-title: Health check]
Expand All @@ -21,4 +22,10 @@ message HealthCheck {
// If operating in pass through mode, the amount of time in milliseconds
// that the filter should cache the upstream response.
google.protobuf.Duration cache_time = 3;

// [#not-implemented-hide:]
// If operating in non-pass-through mode, specifies a set of upstream cluster
// names and the minimum percentage of servers in each of those clusters that
// must be healthy in order for the filter to return a 200.
map<string, Percent> cluster_min_healthy_percentages = 4;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on CDS use case? @brian-pane

}