From e3de64f451c1b0f2c66ede9d34737a24ae31efdb Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Thu, 25 May 2023 14:50:00 +0000 Subject: [PATCH] hc: add health event sink interface and file sink implementation (#27419) * add access log to health check Signed-off-by: Boteng Yao Mirrored from https://github.com/envoyproxy/envoy @ 881bc030a8f1cdc904311de6c1cdba38ef8cc98a --- BUILD | 1 + envoy/config/core/v3/health_check.proto | 18 ++++++++++++--- .../health_check/event_sinks/file/v3/BUILD | 9 ++++++++ .../event_sinks/file/v3/file.proto | 22 +++++++++++++++++++ versioning/BUILD | 1 + 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 envoy/extensions/health_check/event_sinks/file/v3/BUILD create mode 100644 envoy/extensions/health_check/event_sinks/file/v3/file.proto diff --git a/BUILD b/BUILD index cc3a5068..0a9934e0 100644 --- a/BUILD +++ b/BUILD @@ -235,6 +235,7 @@ proto_library( "//envoy/extensions/formatter/cel/v3:pkg", "//envoy/extensions/formatter/metadata/v3:pkg", "//envoy/extensions/formatter/req_without_query/v3:pkg", + "//envoy/extensions/health_check/event_sinks/file/v3:pkg", "//envoy/extensions/health_checkers/redis/v3:pkg", "//envoy/extensions/health_checkers/thrift/v3:pkg", "//envoy/extensions/http/cache/file_system_http_cache/v3:pkg", diff --git a/envoy/config/core/v3/health_check.proto b/envoy/config/core/v3/health_check.proto index f4c9d857..2ec258d8 100644 --- a/envoy/config/core/v3/health_check.proto +++ b/envoy/config/core/v3/health_check.proto @@ -4,6 +4,7 @@ package envoy.config.core.v3; import "envoy/config/core/v3/base.proto"; import "envoy/config/core/v3/event_service_config.proto"; +import "envoy/config/core/v3/extension.proto"; import "envoy/type/matcher/v3/string.proto"; import "envoy/type/v3/http.proto"; import "envoy/type/v3/range.proto"; @@ -13,6 +14,7 @@ import "google/protobuf/duration.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/wrappers.proto"; +import "envoy/annotations/deprecation.proto"; import "udpa/annotations/status.proto"; import "udpa/annotations/versioning.proto"; import "validate/validate.proto"; @@ -60,7 +62,7 @@ message HealthStatusSet { [(validate.rules).repeated = {items {enum {defined_only: true}}}]; } -// [#next-free-field: 25] +// [#next-free-field: 26] message HealthCheck { option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.core.HealthCheck"; @@ -366,9 +368,19 @@ message HealthCheck { // The default value for "healthy edge interval" is the same as the default interval. google.protobuf.Duration healthy_edge_interval = 16 [(validate.rules).duration = {gt {}}]; + // .. attention:: + // This field is deprecated in favor of the extension + // :ref:`event_logger ` and + // :ref:`event_log_path ` + // in the file sink extension. + // // Specifies the path to the :ref:`health check event log `. - // If empty, no event log will be written. - string event_log_path = 17; + string event_log_path = 17 + [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"]; + + // A list of event log sinks to process the health check event. + // [#extension-category: envoy.health_check.event_sinks] + repeated TypedExtensionConfig event_logger = 25; // [#not-implemented-hide:] // The gRPC service for the health check event service. diff --git a/envoy/extensions/health_check/event_sinks/file/v3/BUILD b/envoy/extensions/health_check/event_sinks/file/v3/BUILD new file mode 100644 index 00000000..ee92fb65 --- /dev/null +++ b/envoy/extensions/health_check/event_sinks/file/v3/BUILD @@ -0,0 +1,9 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], +) diff --git a/envoy/extensions/health_check/event_sinks/file/v3/file.proto b/envoy/extensions/health_check/event_sinks/file/v3/file.proto new file mode 100644 index 00000000..d436474a --- /dev/null +++ b/envoy/extensions/health_check/event_sinks/file/v3/file.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package envoy.extensions.health_check.event_sinks.file.v3; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.health_check.event_sinks.file.v3"; +option java_outer_classname = "FileProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/health_check/event_sinks/file/v3;filev3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Health Check Log File Sink] +// [#extension: envoy.health_check.event_sinks.file] + +// Health check event file sink. +// The health check event will be converted to JSON. +message HealthCheckEventFileSink { + // Specifies the path to the health check event log. + string event_log_path = 1 [(validate.rules).string = {min_len: 1}]; +} diff --git a/versioning/BUILD b/versioning/BUILD index 4f4a25d6..a256f1a4 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -173,6 +173,7 @@ proto_library( "//envoy/extensions/formatter/cel/v3:pkg", "//envoy/extensions/formatter/metadata/v3:pkg", "//envoy/extensions/formatter/req_without_query/v3:pkg", + "//envoy/extensions/health_check/event_sinks/file/v3:pkg", "//envoy/extensions/health_checkers/redis/v3:pkg", "//envoy/extensions/health_checkers/thrift/v3:pkg", "//envoy/extensions/http/cache/file_system_http_cache/v3:pkg",