diff --git a/DEPRECATED.md b/DEPRECATED.md index ace294b0ff31..389c0ecd9510 100644 --- a/DEPRECATED.md +++ b/DEPRECATED.md @@ -17,6 +17,7 @@ A logged warning is expected for each deprecated item that is in deprecation win Prior to 1.8.0, Envoy can use either proto to send client requests to a ratelimit server with the use of the `use_data_plane_proto` boolean flag in the [ratelimit configuration](https://github.com/envoyproxy/envoy/blob/master/api/envoy/config/ratelimit/v2/rls.proto). However, when using the deprecated client a warning is logged. +* Use of the --v2-config-only flag. ## Version 1.7.0 diff --git a/docs/root/configuration/overview/v2_overview.rst b/docs/root/configuration/overview/v2_overview.rst index f67e2ceb4629..feb1032a4d4a 100644 --- a/docs/root/configuration/overview/v2_overview.rst +++ b/docs/root/configuration/overview/v2_overview.rst @@ -37,12 +37,9 @@ flag, i.e.: .. code-block:: console - ./envoy -c .{json,yaml,pb,pb_text} --v2-config-only + ./envoy -c .{json,yaml,pb,pb_text} -where the extension reflects the underlying v2 config representation. The -:option:`--v2-config-only` flag is not strictly required as Envoy will attempt -to autodetect the config file version, but this option provides an enhanced -debug experience when configuration parsing fails. +where the extension reflects the underlying v2 config representation. The :ref:`Bootstrap ` message is the root of the configuration. A key concept in the :ref:`Bootstrap ` diff --git a/docs/root/intro/version_history.rst b/docs/root/intro/version_history.rst index 580daf97e487..68bb3340bcf0 100644 --- a/docs/root/intro/version_history.rst +++ b/docs/root/intro/version_history.rst @@ -7,7 +7,7 @@ Version history to filter based on the presence of Envoy response flags. * admin: added :http:get:`/hystrix_event_stream` as an endpoint for monitoring envoy's statistics through `Hystrix dashboard `_. -* config: v1 disabled by default. v1 support remains available until October via flipping --v2-config-only=false. +* config: v1 disabled by default. v1 support remains available until October via setting :option:`--allow-deprecated-v1-api`. * health check: added support for :ref:`custom health check `. * health check: added support for :ref:`specifying jitter as a percentage `. * health_check: added support for :ref:`health check event logging `. diff --git a/docs/root/operations/cli.rst b/docs/root/operations/cli.rst index e50e99462e32..c6081452c677 100644 --- a/docs/root/operations/cli.rst +++ b/docs/root/operations/cli.rst @@ -11,8 +11,8 @@ following are the command line options that Envoy supports. *(optional)* The path to the v1 or v2 :ref:`JSON/YAML/proto3 configuration file `. If this flag is missing, :option:`--config-yaml` is required. This will be parsed as a :ref:`v2 bootstrap configuration file - ` and on failure, subject to - :option:`--v2-config-only`, will be considered as a :ref:`v1 JSON + `. On failure, if :option:`--allow-deprecated-v1-api`, + is set, it will be considered as a :ref:`v1 JSON configuration file `. For v2 configuration files, valid extensions are ``.json``, ``.yaml``, ``.pb`` and ``.pb_text``, which indicate JSON, YAML, `binary proto3 @@ -34,9 +34,14 @@ following are the command line options that Envoy supports. .. option:: --v2-config-only + *(deprecated)* This flag used to allow opting into only using a + :ref:`v2 bootstrap configuration file `. This is now set by default. + +.. option:: --allow-deprecated-v1-api + *(optional)* This flag determines whether the configuration file should only be parsed as a :ref:`v2 bootstrap configuration file - `. If false (default), when a v2 bootstrap + `. If specified when a v2 bootstrap config parse fails, a second attempt to parse the config as a :ref:`v1 JSON configuration file ` will be made. diff --git a/source/server/options_impl.cc b/source/server/options_impl.cc index 8d47f18cb9ca..e66155781545 100644 --- a/source/server/options_impl.cc +++ b/source/server/options_impl.cc @@ -57,7 +57,13 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv, TCLAP::ValueArg config_yaml( "", "config-yaml", "Inline YAML configuration, merges with the contents of --config-path", false, "", "string", cmd); - TCLAP::SwitchArg v2_config_only("", "v2-config-only", "parse config as v2 only", cmd, true); + + // Deprecated and unused. + TCLAP::SwitchArg v2_config_only("", "v2-config-only", "deprecated", cmd, true); + + TCLAP::SwitchArg allow_v1_config("", "allow-deprecated-v1-api", "allow use of legacy v1 config", + cmd, false); + TCLAP::ValueArg admin_address_path("", "admin-address-path", "Admin address path", false, "", "string", cmd); TCLAP::ValueArg local_address_ip_version("", "local-address-ip-version", @@ -177,7 +183,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv, concurrency_ = concurrency.getValue(); config_path_ = config_path.getValue(); config_yaml_ = config_yaml.getValue(); - v2_config_only_ = v2_config_only.getValue(); + v2_config_only_ = !allow_v1_config.getValue(); admin_address_path_ = admin_address_path.getValue(); log_path_ = log_path.getValue(); restart_epoch_ = restart_epoch.getValue(); diff --git a/test/server/options_impl_test.cc b/test/server/options_impl_test.cc index 9a9def19817e..c6077699e41c 100644 --- a/test/server/options_impl_test.cc +++ b/test/server/options_impl_test.cc @@ -60,6 +60,27 @@ TEST(OptionsImplTest, InvalidCommandLine) { "Couldn't find match for argument"); } +TEST(OptionsImplTest, v1Allowed) { + std::unique_ptr options = createOptionsImpl( + "envoy --mode validate --concurrency 2 -c hello --admin-address-path path --restart-epoch 1 " + "--local-address-ip-version v6 -l info --service-cluster cluster --service-node node " + "--service-zone zone --file-flush-interval-msec 9000 --drain-time-s 60 --log-format [%v] " + "--parent-shutdown-time-s 90 --log-path /foo/bar --allow-deprecated-v1-api " + "--disable-hot-restart"); + EXPECT_EQ(Server::Mode::Validate, options->mode()); + EXPECT_FALSE(options->v2ConfigOnly()); +} + +TEST(OptionsImplTest, v1Disallowed) { + std::unique_ptr options = createOptionsImpl( + "envoy --mode validate --concurrency 2 -c hello --admin-address-path path --restart-epoch 1 " + "--local-address-ip-version v6 -l info --service-cluster cluster --service-node node " + "--service-zone zone --file-flush-interval-msec 9000 --drain-time-s 60 --log-format [%v] " + "--parent-shutdown-time-s 90 --log-path /foo/bar --disable-hot-restart"); + EXPECT_EQ(Server::Mode::Validate, options->mode()); + EXPECT_TRUE(options->v2ConfigOnly()); +} + TEST(OptionsImplTest, All) { std::unique_ptr options = createOptionsImpl( "envoy --mode validate --concurrency 2 -c hello --admin-address-path path --restart-epoch 1 " @@ -69,7 +90,7 @@ TEST(OptionsImplTest, All) { EXPECT_EQ(Server::Mode::Validate, options->mode()); EXPECT_EQ(2U, options->concurrency()); EXPECT_EQ("hello", options->configPath()); - EXPECT_FALSE(options->v2ConfigOnly()); + EXPECT_TRUE(options->v2ConfigOnly()); EXPECT_EQ("path", options->adminAddressPath()); EXPECT_EQ(Network::Address::IpVersion::v6, options->localAddressIpVersion()); EXPECT_EQ(1U, options->restartEpoch());