health check: add custom health checker (#596)

This patch adds the extension health check, with redis as the first
example.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
pull/603/merge
Dhi Aurrahman 7 years ago committed by Matt Klein
parent 42104457b1
commit 4af506d694
  1. 1
      docs/BUILD
  2. 14
      envoy/api/v2/core/health_check.proto
  3. 8
      envoy/config/health_checker/redis/v2/BUILD
  4. 16
      envoy/config/health_checker/redis/v2/redis.proto
  5. 1
      test/validate/BUILD
  6. 1
      test/validate/pgv_test.cc

@ -43,6 +43,7 @@ proto_library(
"//envoy/config/filter/network/rate_limit/v2:rate_limit",
"//envoy/config/filter/network/redis_proxy/v2:redis_proxy",
"//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy",
"//envoy/config/health_checker/redis/v2:redis",
"//envoy/config/metrics/v2:metrics_service",
"//envoy/config/metrics/v2:stats",
"//envoy/config/ratelimit/v2:rls",

@ -5,6 +5,7 @@ package envoy.api.v2.core;
import "envoy/api/v2/core/base.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";
import "validate/validate.proto";
@ -115,6 +116,16 @@ message HealthCheck {
string service_name = 1;
}
// [#not-implemented-hide:] Custom health check.
message CustomHealthCheck {
// The registered name of the custom health check.
string name = 1 [(validate.rules).string.min_bytes = 1];
// A custom health checker specific configuration which depends on the custom health checker
// being instantiated. See :api:`envoy/config/health_checker` for reference.
google.protobuf.Struct config = 2;
}
oneof health_checker {
option (validate.required) = true;
@ -129,6 +140,9 @@ message HealthCheck {
// gRPC health check.
GrpcHealthCheck grpc_health_check = 11;
// [#not-implemented-hide:] Custom health check.
CustomHealthCheck custom_health_check = 13;
}
// The "no traffic interval" is a special health check interval that is used when a cluster has

@ -0,0 +1,8 @@
load("//bazel:api_build_system.bzl", "api_proto_library")
licenses(["notice"]) # Apache 2
api_proto_library(
name = "redis",
srcs = ["redis.proto"],
)

@ -0,0 +1,16 @@
syntax = "proto3";
package envoy.config.health_checker.redis.v2;
option go_package = "v2";
// [#not-implemented-hide:]
// [#protodoc-title: Redis]
// Redis :ref:`configuration overview <config_health_checker_redis>`.
// Configuration for the Redis custom health checker.
message Redis {
// If set, optionally perform ``EXISTS <key>`` instead of ``PING``. A return value
// from Redis of 0 (does not exist) is considered a passing healthcheck. A return value other
// than 0 is considered a failure. This allows the user to mark a Redis instance for maintenance
// by setting the specified key to any value and waiting for traffic to drain.
string key = 1;
}

@ -28,5 +28,6 @@ api_cc_test(
"//envoy/config/filter/network/mongo_proxy/v2:mongo_proxy",
"//envoy/config/filter/network/redis_proxy/v2:redis_proxy",
"//envoy/config/filter/network/tcp_proxy/v2:tcp_proxy",
"//envoy/config/health_checker/redis/v2:redis",
],
)

@ -8,6 +8,7 @@
#include "envoy/api/v2/lds.pb.validate.h"
#include "envoy/api/v2/rds.pb.validate.h"
#include "envoy/api/v2/core/protocol.pb.validate.h"
#include "envoy/config/health_checker/redis/v2/redis.pb.validate.h"
#include "envoy/config/filter/accesslog/v2/accesslog.pb.validate.h"
#include "envoy/config/filter/http/buffer/v2/buffer.pb.validate.h"
#include "envoy/config/filter/http/fault/v2/fault.pb.validate.h"

Loading…
Cancel
Save