From dd58ca6a1c278fef29132850045b3206999b9861 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Thu, 11 Feb 2021 06:46:15 +0000 Subject: [PATCH] extensions: update straggler v2 extensions to v3. (#14907) * Add v3 equivalents of v2 configs that were included in v3 due to no transitive deprecation. This increases consistency and reduces user confusion. We will continue to support these straggler v2 configs beyond the v2 turndown due to the late addition of v3 counterparts, special case code is added to utility.cc to handle this. * There were two extensions, //envoy/config/cluster/redis and //envoy/config/retry/previous_priorities, that for some reason were not upgraded to use v3 config. This is now fixed and I've grepped for other v2 in //source, none remain. Risk level: Medium (changes to extension config types and deprecated config handling). Testing: Additional unit test added for utility.cc handling, upgraded configs to v3 for other tests. Fixes #14735 Fixes #12841 Signed-off-by: Harvey Tuch Co-authored-by: Abhay Narayan Katare Mirrored from https://github.com/envoyproxy/envoy @ c04a75efe9d601ebcb9650f274b5adde60181f1c --- BUILD | 7 +++-- .../v2/omit_canary_hosts.proto | 3 +++ .../previous_hosts/v2/previous_hosts.proto | 3 +++ .../previous_priorities_config.proto | 3 +++ .../health_checkers/redis}/v3/BUILD | 5 +++- .../health_checkers/redis/v3/redis.proto | 26 +++++++++++++++++++ .../resource_monitors/fixed_heap/v3/BUILD | 12 +++++++++ .../fixed_heap/v3/fixed_heap.proto | 25 ++++++++++++++++++ .../injected_resource/v3/BUILD | 12 +++++++++ .../v3/injected_resource.proto | 26 +++++++++++++++++++ .../retry/host/omit_canary_hosts/v3/BUILD | 12 +++++++++ .../v3/omit_canary_hosts.proto | 7 +++-- .../retry/host}/previous_hosts/v3/BUILD | 5 +++- .../previous_hosts/v3/previous_hosts.proto | 7 +++-- versioning/BUILD | 7 +++-- 15 files changed, 150 insertions(+), 10 deletions(-) rename envoy/{config/retry/omit_canary_hosts => extensions/health_checkers/redis}/v3/BUILD (60%) create mode 100644 envoy/extensions/health_checkers/redis/v3/redis.proto create mode 100644 envoy/extensions/resource_monitors/fixed_heap/v3/BUILD create mode 100644 envoy/extensions/resource_monitors/fixed_heap/v3/fixed_heap.proto create mode 100644 envoy/extensions/resource_monitors/injected_resource/v3/BUILD create mode 100644 envoy/extensions/resource_monitors/injected_resource/v3/injected_resource.proto create mode 100644 envoy/extensions/retry/host/omit_canary_hosts/v3/BUILD rename envoy/{config/retry => extensions/retry/host}/omit_canary_hosts/v3/omit_canary_hosts.proto (53%) rename envoy/{config/retry => extensions/retry/host}/previous_hosts/v3/BUILD (60%) rename envoy/{config/retry => extensions/retry/host}/previous_hosts/v3/previous_hosts.proto (53%) diff --git a/BUILD b/BUILD index daee0fd9..046fac3d 100644 --- a/BUILD +++ b/BUILD @@ -144,9 +144,7 @@ proto_library( "//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg", "//envoy/config/resource_monitor/injected_resource/v2alpha:pkg", "//envoy/config/retry/omit_canary_hosts/v2:pkg", - "//envoy/config/retry/omit_canary_hosts/v3:pkg", "//envoy/config/retry/previous_hosts/v2:pkg", - "//envoy/config/retry/previous_hosts/v3:pkg", "//envoy/config/route/v3:pkg", "//envoy/config/tap/v3:pkg", "//envoy/config/trace/v3:pkg", @@ -241,12 +239,17 @@ proto_library( "//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg", "//envoy/extensions/filters/udp/dns_filter/v3alpha:pkg", "//envoy/extensions/filters/udp/udp_proxy/v3:pkg", + "//envoy/extensions/health_checkers/redis/v3:pkg", "//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg", "//envoy/extensions/internal_redirect/previous_routes/v3:pkg", "//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg", "//envoy/extensions/network/socket_interface/v3:pkg", "//envoy/extensions/rate_limit_descriptors/expr/v3:pkg", + "//envoy/extensions/resource_monitors/fixed_heap/v3:pkg", + "//envoy/extensions/resource_monitors/injected_resource/v3:pkg", + "//envoy/extensions/retry/host/omit_canary_hosts/v3:pkg", "//envoy/extensions/retry/host/omit_host_metadata/v3:pkg", + "//envoy/extensions/retry/host/previous_hosts/v3:pkg", "//envoy/extensions/retry/priority/previous_priorities/v3:pkg", "//envoy/extensions/stat_sinks/wasm/v3:pkg", "//envoy/extensions/transport_sockets/alts/v3:pkg", diff --git a/envoy/config/retry/omit_canary_hosts/v2/omit_canary_hosts.proto b/envoy/config/retry/omit_canary_hosts/v2/omit_canary_hosts.proto index 107bf6fc..c2b2e58a 100644 --- a/envoy/config/retry/omit_canary_hosts/v2/omit_canary_hosts.proto +++ b/envoy/config/retry/omit_canary_hosts/v2/omit_canary_hosts.proto @@ -2,11 +2,14 @@ syntax = "proto3"; package envoy.config.retry.omit_canary_hosts.v2; +import "udpa/annotations/migrate.proto"; import "udpa/annotations/status.proto"; option java_package = "io.envoyproxy.envoy.config.retry.omit_canary_hosts.v2"; option java_outer_classname = "OmitCanaryHostsProto"; option java_multiple_files = true; +option (udpa.annotations.file_migrate).move_to_package = + "envoy.extensions.retry.host.omit_canary_hosts.v3"; option (udpa.annotations.file_status).package_version_status = ACTIVE; // [#protodoc-title: Omit Canary Hosts Predicate] diff --git a/envoy/config/retry/previous_hosts/v2/previous_hosts.proto b/envoy/config/retry/previous_hosts/v2/previous_hosts.proto index e87e8cd7..f69c5054 100644 --- a/envoy/config/retry/previous_hosts/v2/previous_hosts.proto +++ b/envoy/config/retry/previous_hosts/v2/previous_hosts.proto @@ -2,11 +2,14 @@ syntax = "proto3"; package envoy.config.retry.previous_hosts.v2; +import "udpa/annotations/migrate.proto"; import "udpa/annotations/status.proto"; option java_package = "io.envoyproxy.envoy.config.retry.previous_hosts.v2"; option java_outer_classname = "PreviousHostsProto"; option java_multiple_files = true; +option (udpa.annotations.file_migrate).move_to_package = + "envoy.extensions.retry.host.previous_hosts.v3"; option (udpa.annotations.file_status).package_version_status = ACTIVE; // [#protodoc-title: Previous Hosts Predicate] diff --git a/envoy/config/retry/previous_priorities/previous_priorities_config.proto b/envoy/config/retry/previous_priorities/previous_priorities_config.proto index e9674117..3fc400c0 100644 --- a/envoy/config/retry/previous_priorities/previous_priorities_config.proto +++ b/envoy/config/retry/previous_priorities/previous_priorities_config.proto @@ -2,12 +2,15 @@ syntax = "proto3"; package envoy.config.retry.previous_priorities; +import "udpa/annotations/migrate.proto"; import "udpa/annotations/status.proto"; import "validate/validate.proto"; option java_package = "io.envoyproxy.envoy.config.retry.previous_priorities"; option java_outer_classname = "PreviousPrioritiesConfigProto"; option java_multiple_files = true; +option (udpa.annotations.file_migrate).move_to_package = + "envoy.extensions.retry.priority.previous_priorities.v3"; option (udpa.annotations.file_status).package_version_status = FROZEN; // [#protodoc-title: Previous priorities retry selector] diff --git a/envoy/config/retry/omit_canary_hosts/v3/BUILD b/envoy/extensions/health_checkers/redis/v3/BUILD similarity index 60% rename from envoy/config/retry/omit_canary_hosts/v3/BUILD rename to envoy/extensions/health_checkers/redis/v3/BUILD index ee92fb65..1cb4c615 100644 --- a/envoy/config/retry/omit_canary_hosts/v3/BUILD +++ b/envoy/extensions/health_checkers/redis/v3/BUILD @@ -5,5 +5,8 @@ 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"], + deps = [ + "//envoy/config/health_checker/redis/v2:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], ) diff --git a/envoy/extensions/health_checkers/redis/v3/redis.proto b/envoy/extensions/health_checkers/redis/v3/redis.proto new file mode 100644 index 00000000..10f5c2b3 --- /dev/null +++ b/envoy/extensions/health_checkers/redis/v3/redis.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package envoy.extensions.health_checkers.redis.v3; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.health_checkers.redis.v3"; +option java_outer_classname = "RedisProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Redis] +// Redis health checker :ref:`configuration overview `. +// [#extension: envoy.health_checkers.redis] + +message Redis { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.health_checker.redis.v2.Redis"; + + // If set, optionally perform ``EXISTS `` 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; +} diff --git a/envoy/extensions/resource_monitors/fixed_heap/v3/BUILD b/envoy/extensions/resource_monitors/fixed_heap/v3/BUILD new file mode 100644 index 00000000..3fb51ff1 --- /dev/null +++ b/envoy/extensions/resource_monitors/fixed_heap/v3/BUILD @@ -0,0 +1,12 @@ +# 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 = [ + "//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/resource_monitors/fixed_heap/v3/fixed_heap.proto b/envoy/extensions/resource_monitors/fixed_heap/v3/fixed_heap.proto new file mode 100644 index 00000000..48aaa0a0 --- /dev/null +++ b/envoy/extensions/resource_monitors/fixed_heap/v3/fixed_heap.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package envoy.extensions.resource_monitors.fixed_heap.v3; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.resource_monitors.fixed_heap.v3"; +option java_outer_classname = "FixedHeapProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Fixed heap] +// [#extension: envoy.resource_monitors.fixed_heap] + +// The fixed heap resource monitor reports the Envoy process memory pressure, computed as a +// fraction of currently reserved heap memory divided by a statically configured maximum +// specified in the FixedHeapConfig. +message FixedHeapConfig { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.resource_monitor.fixed_heap.v2alpha.FixedHeapConfig"; + + uint64 max_heap_size_bytes = 1 [(validate.rules).uint64 = {gt: 0}]; +} diff --git a/envoy/extensions/resource_monitors/injected_resource/v3/BUILD b/envoy/extensions/resource_monitors/injected_resource/v3/BUILD new file mode 100644 index 00000000..975b8fcb --- /dev/null +++ b/envoy/extensions/resource_monitors/injected_resource/v3/BUILD @@ -0,0 +1,12 @@ +# 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 = [ + "//envoy/config/resource_monitor/injected_resource/v2alpha:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/resource_monitors/injected_resource/v3/injected_resource.proto b/envoy/extensions/resource_monitors/injected_resource/v3/injected_resource.proto new file mode 100644 index 00000000..643ea686 --- /dev/null +++ b/envoy/extensions/resource_monitors/injected_resource/v3/injected_resource.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package envoy.extensions.resource_monitors.injected_resource.v3; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.resource_monitors.injected_resource.v3"; +option java_outer_classname = "InjectedResourceProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Injected resource] +// [#extension: envoy.resource_monitors.injected_resource] + +// The injected resource monitor allows injecting a synthetic resource pressure into Envoy +// via a text file, which must contain a floating-point number in the range [0..1] representing +// the resource pressure and be updated atomically by a symbolic link swap. +// This is intended primarily for integration tests to force Envoy into an overloaded state. +message InjectedResourceConfig { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.resource_monitor.injected_resource.v2alpha.InjectedResourceConfig"; + + string filename = 1 [(validate.rules).string = {min_len: 1}]; +} diff --git a/envoy/extensions/retry/host/omit_canary_hosts/v3/BUILD b/envoy/extensions/retry/host/omit_canary_hosts/v3/BUILD new file mode 100644 index 00000000..0eab79b8 --- /dev/null +++ b/envoy/extensions/retry/host/omit_canary_hosts/v3/BUILD @@ -0,0 +1,12 @@ +# 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 = [ + "//envoy/config/retry/omit_canary_hosts/v2:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/config/retry/omit_canary_hosts/v3/omit_canary_hosts.proto b/envoy/extensions/retry/host/omit_canary_hosts/v3/omit_canary_hosts.proto similarity index 53% rename from envoy/config/retry/omit_canary_hosts/v3/omit_canary_hosts.proto rename to envoy/extensions/retry/host/omit_canary_hosts/v3/omit_canary_hosts.proto index fe928ba7..930cced8 100644 --- a/envoy/config/retry/omit_canary_hosts/v3/omit_canary_hosts.proto +++ b/envoy/extensions/retry/host/omit_canary_hosts/v3/omit_canary_hosts.proto @@ -1,10 +1,11 @@ syntax = "proto3"; -package envoy.config.retry.omit_canary_hosts.v3; +package envoy.extensions.retry.host.omit_canary_hosts.v3; import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; -option java_package = "io.envoyproxy.envoy.config.retry.omit_canary_hosts.v3"; +option java_package = "io.envoyproxy.envoy.extensions.retry.host.omit_canary_hosts.v3"; option java_outer_classname = "OmitCanaryHostsProto"; option java_multiple_files = true; option (udpa.annotations.file_status).package_version_status = ACTIVE; @@ -13,4 +14,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // [#extension: envoy.retry_host_predicates.omit_canary_hosts] message OmitCanaryHostsPredicate { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.retry.omit_canary_hosts.v2.OmitCanaryHostsPredicate"; } diff --git a/envoy/config/retry/previous_hosts/v3/BUILD b/envoy/extensions/retry/host/previous_hosts/v3/BUILD similarity index 60% rename from envoy/config/retry/previous_hosts/v3/BUILD rename to envoy/extensions/retry/host/previous_hosts/v3/BUILD index ee92fb65..88d9a6e2 100644 --- a/envoy/config/retry/previous_hosts/v3/BUILD +++ b/envoy/extensions/retry/host/previous_hosts/v3/BUILD @@ -5,5 +5,8 @@ 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"], + deps = [ + "//envoy/config/retry/previous_hosts/v2:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], ) diff --git a/envoy/config/retry/previous_hosts/v3/previous_hosts.proto b/envoy/extensions/retry/host/previous_hosts/v3/previous_hosts.proto similarity index 53% rename from envoy/config/retry/previous_hosts/v3/previous_hosts.proto rename to envoy/extensions/retry/host/previous_hosts/v3/previous_hosts.proto index 349802eb..addce657 100644 --- a/envoy/config/retry/previous_hosts/v3/previous_hosts.proto +++ b/envoy/extensions/retry/host/previous_hosts/v3/previous_hosts.proto @@ -1,10 +1,11 @@ syntax = "proto3"; -package envoy.config.retry.previous_hosts.v3; +package envoy.extensions.retry.host.previous_hosts.v3; import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; -option java_package = "io.envoyproxy.envoy.config.retry.previous_hosts.v3"; +option java_package = "io.envoyproxy.envoy.extensions.retry.host.previous_hosts.v3"; option java_outer_classname = "PreviousHostsProto"; option java_multiple_files = true; option (udpa.annotations.file_status).package_version_status = ACTIVE; @@ -13,4 +14,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // [#extension: envoy.retry_host_predicates.previous_hosts] message PreviousHostsPredicate { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.retry.previous_hosts.v2.PreviousHostsPredicate"; } diff --git a/versioning/BUILD b/versioning/BUILD index 4668593e..f5bb3ce6 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -27,9 +27,7 @@ proto_library( "//envoy/config/resource_monitor/fixed_heap/v2alpha:pkg", "//envoy/config/resource_monitor/injected_resource/v2alpha:pkg", "//envoy/config/retry/omit_canary_hosts/v2:pkg", - "//envoy/config/retry/omit_canary_hosts/v3:pkg", "//envoy/config/retry/previous_hosts/v2:pkg", - "//envoy/config/retry/previous_hosts/v3:pkg", "//envoy/config/route/v3:pkg", "//envoy/config/tap/v3:pkg", "//envoy/config/trace/v3:pkg", @@ -124,12 +122,17 @@ proto_library( "//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg", "//envoy/extensions/filters/udp/dns_filter/v3alpha:pkg", "//envoy/extensions/filters/udp/udp_proxy/v3:pkg", + "//envoy/extensions/health_checkers/redis/v3:pkg", "//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg", "//envoy/extensions/internal_redirect/previous_routes/v3:pkg", "//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg", "//envoy/extensions/network/socket_interface/v3:pkg", "//envoy/extensions/rate_limit_descriptors/expr/v3:pkg", + "//envoy/extensions/resource_monitors/fixed_heap/v3:pkg", + "//envoy/extensions/resource_monitors/injected_resource/v3:pkg", + "//envoy/extensions/retry/host/omit_canary_hosts/v3:pkg", "//envoy/extensions/retry/host/omit_host_metadata/v3:pkg", + "//envoy/extensions/retry/host/previous_hosts/v3:pkg", "//envoy/extensions/retry/priority/previous_priorities/v3:pkg", "//envoy/extensions/stat_sinks/wasm/v3:pkg", "//envoy/extensions/transport_sockets/alts/v3:pkg",