hds.proto 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. syntax = "proto3";
  2. package envoy.service.health.v3;
  3. import "envoy/config/cluster/v3/cluster.proto";
  4. import "envoy/config/core/v3/base.proto";
  5. import "envoy/config/core/v3/health_check.proto";
  6. import "envoy/config/endpoint/v3/endpoint_components.proto";
  7. import "google/api/annotations.proto";
  8. import "google/protobuf/duration.proto";
  9. import "envoy/annotations/deprecation.proto";
  10. import "udpa/annotations/status.proto";
  11. import "udpa/annotations/versioning.proto";
  12. option java_package = "io.envoyproxy.envoy.service.health.v3";
  13. option java_outer_classname = "HdsProto";
  14. option java_multiple_files = true;
  15. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/health/v3;healthv3";
  16. option java_generic_services = true;
  17. option (udpa.annotations.file_status).package_version_status = ACTIVE;
  18. // [#protodoc-title: Health Discovery Service (HDS)]
  19. // HDS is Health Discovery Service. It compliments Envoy’s health checking
  20. // service by designating this Envoy to be a healthchecker for a subset of hosts
  21. // in the cluster. The status of these health checks will be reported to the
  22. // management server, where it can be aggregated etc and redistributed back to
  23. // Envoy through EDS.
  24. service HealthDiscoveryService {
  25. // 1. Envoy starts up and if its can_healthcheck option in the static
  26. // bootstrap config is enabled, sends HealthCheckRequest to the management
  27. // server. It supplies its capabilities (which protocol it can health check
  28. // with, what zone it resides in, etc.).
  29. // 2. In response to (1), the management server designates this Envoy as a
  30. // healthchecker to health check a subset of all upstream hosts for a given
  31. // cluster (for example upstream Host 1 and Host 2). It streams
  32. // HealthCheckSpecifier messages with cluster related configuration for all
  33. // clusters this Envoy is designated to health check. Subsequent
  34. // HealthCheckSpecifier message will be sent on changes to:
  35. // a. Endpoints to health checks
  36. // b. Per cluster configuration change
  37. // 3. Envoy creates a health probe based on the HealthCheck config and sends
  38. // it to endpoint(ip:port) of Host 1 and 2. Based on the HealthCheck
  39. // configuration Envoy waits upon the arrival of the probe response and
  40. // looks at the content of the response to decide whether the endpoint is
  41. // healthy or not. If a response hasn't been received within the timeout
  42. // interval, the endpoint health status is considered TIMEOUT.
  43. // 4. Envoy reports results back in an EndpointHealthResponse message.
  44. // Envoy streams responses as often as the interval configured by the
  45. // management server in HealthCheckSpecifier.
  46. // 5. The management Server collects health statuses for all endpoints in the
  47. // cluster (for all clusters) and uses this information to construct
  48. // EndpointDiscoveryResponse messages.
  49. // 6. Once Envoy has a list of upstream endpoints to send traffic to, it load
  50. // balances traffic to them without additional health checking. It may
  51. // use inline healthcheck (i.e. consider endpoint UNHEALTHY if connection
  52. // failed to a particular endpoint to account for health status propagation
  53. // delay between HDS and EDS).
  54. // By default, can_healthcheck is true. If can_healthcheck is false, Cluster
  55. // configuration may not contain HealthCheck message.
  56. // TODO(htuch): How is can_healthcheck communicated to CDS to ensure the above
  57. // invariant?
  58. // TODO(htuch): Add @amb67's diagram.
  59. rpc StreamHealthCheck(stream HealthCheckRequestOrEndpointHealthResponse)
  60. returns (stream HealthCheckSpecifier) {
  61. }
  62. // TODO(htuch): Unlike the gRPC version, there is no stream-based binding of
  63. // request/response. Should we add an identifier to the HealthCheckSpecifier
  64. // to bind with the response?
  65. rpc FetchHealthCheck(HealthCheckRequestOrEndpointHealthResponse) returns (HealthCheckSpecifier) {
  66. option (google.api.http).post = "/v3/discovery:health_check";
  67. option (google.api.http).body = "*";
  68. }
  69. }
  70. // Defines supported protocols etc, so the management server can assign proper
  71. // endpoints to healthcheck.
  72. message Capability {
  73. option (udpa.annotations.versioning).previous_message_type =
  74. "envoy.service.discovery.v2.Capability";
  75. // Different Envoy instances may have different capabilities (e.g. Redis)
  76. // and/or have ports enabled for different protocols.
  77. enum Protocol {
  78. HTTP = 0;
  79. TCP = 1;
  80. REDIS = 2;
  81. }
  82. repeated Protocol health_check_protocols = 1;
  83. }
  84. message HealthCheckRequest {
  85. option (udpa.annotations.versioning).previous_message_type =
  86. "envoy.service.discovery.v2.HealthCheckRequest";
  87. config.core.v3.Node node = 1;
  88. Capability capability = 2;
  89. }
  90. message EndpointHealth {
  91. option (udpa.annotations.versioning).previous_message_type =
  92. "envoy.service.discovery.v2.EndpointHealth";
  93. config.endpoint.v3.Endpoint endpoint = 1;
  94. config.core.v3.HealthStatus health_status = 2;
  95. }
  96. // Group endpoint health by locality under each cluster.
  97. message LocalityEndpointsHealth {
  98. config.core.v3.Locality locality = 1;
  99. repeated EndpointHealth endpoints_health = 2;
  100. }
  101. // The health status of endpoints in a cluster. The cluster name and locality
  102. // should match the corresponding fields in ClusterHealthCheck message.
  103. message ClusterEndpointsHealth {
  104. string cluster_name = 1;
  105. repeated LocalityEndpointsHealth locality_endpoints_health = 2;
  106. }
  107. message EndpointHealthResponse {
  108. option (udpa.annotations.versioning).previous_message_type =
  109. "envoy.service.discovery.v2.EndpointHealthResponse";
  110. // Deprecated - Flat list of endpoint health information.
  111. repeated EndpointHealth endpoints_health = 1
  112. [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
  113. // Organize Endpoint health information by cluster.
  114. repeated ClusterEndpointsHealth cluster_endpoints_health = 2;
  115. }
  116. message HealthCheckRequestOrEndpointHealthResponse {
  117. option (udpa.annotations.versioning).previous_message_type =
  118. "envoy.service.discovery.v2.HealthCheckRequestOrEndpointHealthResponse";
  119. oneof request_type {
  120. HealthCheckRequest health_check_request = 1;
  121. EndpointHealthResponse endpoint_health_response = 2;
  122. }
  123. }
  124. message LocalityEndpoints {
  125. option (udpa.annotations.versioning).previous_message_type =
  126. "envoy.service.discovery.v2.LocalityEndpoints";
  127. config.core.v3.Locality locality = 1;
  128. repeated config.endpoint.v3.Endpoint endpoints = 2;
  129. }
  130. // The cluster name and locality is provided to Envoy for the endpoints that it
  131. // health checks to support statistics reporting, logging and debugging by the
  132. // Envoy instance (outside of HDS). For maximum usefulness, it should match the
  133. // same cluster structure as that provided by EDS.
  134. message ClusterHealthCheck {
  135. option (udpa.annotations.versioning).previous_message_type =
  136. "envoy.service.discovery.v2.ClusterHealthCheck";
  137. string cluster_name = 1;
  138. repeated config.core.v3.HealthCheck health_checks = 2;
  139. repeated LocalityEndpoints locality_endpoints = 3;
  140. // Optional map that gets filtered by :ref:`health_checks.transport_socket_match_criteria <envoy_v3_api_field_config.core.v3.HealthCheck.transport_socket_match_criteria>`
  141. // on connection when health checking. For more details, see
  142. // :ref:`config.cluster.v3.Cluster.transport_socket_matches <envoy_v3_api_field_config.cluster.v3.Cluster.transport_socket_matches>`.
  143. repeated config.cluster.v3.Cluster.TransportSocketMatch transport_socket_matches = 4;
  144. }
  145. message HealthCheckSpecifier {
  146. option (udpa.annotations.versioning).previous_message_type =
  147. "envoy.service.discovery.v2.HealthCheckSpecifier";
  148. repeated ClusterHealthCheck cluster_health_checks = 1;
  149. // The default is 1 second.
  150. google.protobuf.Duration interval = 2;
  151. }
  152. // [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing
  153. // services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file.
  154. message HdsDummy {
  155. }