Skip to content

server: add a CLI option to disable extensions#9125

Merged
lizan merged 8 commits intoenvoyproxy:masterfrom
jpeach:disable-extensions-at-startup
Dec 13, 2019
Merged

server: add a CLI option to disable extensions#9125
lizan merged 8 commits intoenvoyproxy:masterfrom
jpeach:disable-extensions-at-startup

Conversation

@jpeach
Copy link
Copy Markdown
Contributor

@jpeach jpeach commented Nov 25, 2019

Description:

Add a new --disable-extensions flag that hides the named extensions
from their corresponding factory registry. The extensions are retained
in the registry factory, but the factory pointer is nulled so that
configuration attempts to use the extensions will fail.

Risk Level: Medium
Testing: Added unit tests, manual verification.
Docs Changes: Added to CLI reference.
Release Notes: Added release note.
Fixes: #9096

Add a new `--disable-extensions` flag that hides the named extensions
from their corresponding factory registry. The extensions are retained
in the registry factory, but the factory pointer is nulled so that
configuration attempts to use the extensions will fail.

This fixes envoyproxy#9096.

Signed-off-by: James Peach <jpeach@apache.org>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #9125 was opened by jpeach.

see: more, trace.

@zuercher zuercher requested review from junr03 and removed request for junr03 November 25, 2019 18:08
@zuercher zuercher self-assigned this Nov 25, 2019
Signed-off-by: James Peach <jpeach@apache.org>
@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Nov 25, 2019

[ RUN      ] IpVersions/UdpProxyIntegrationTest.HelloWorldOnLoopback/IPv6
external/envoy/test/extensions/filters/udp/udp_proxy/udp_proxy_integration_test.cc:95: Failure
Expected equality of these values:
  6
  test_server_->counter("udp.foo.downstream_sess_tx_bytes")->value()
    Which is: 0
Stack trace:
  0x11ec808: Envoy::(anonymous namespace)::UdpProxyIntegrationTest::requestResponseWithListenerAddress()
  0x11eb4dd: Envoy::(anonymous namespace)::UdpProxyIntegrationTest_HelloWorldOnLoopback_Test::TestBody()
  0x2c7b4b4: testing::internal::HandleSehExceptionsInMethodIfSupported<>()
  0x2c6c9be: testing::internal::HandleExceptionsInMethodIfSupported<>()
  0x2c57233: testing::Test::Run()
  0x2c57e1d: testing::TestInfo::Run()
... Google Test internal frames ...

[  FAILED  ] IpVersions/UdpProxyIntegrationTest.HelloWorldOnLoopback/IPv6, where GetParam() = 4-byte object <01-00 00-00> (160 ms)

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🐴 hold your horses - no failures detected, yet.

🐱

Caused by: a #9125 (comment) was created by @jpeach.

see: more, trace.

@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Nov 25, 2019

I'm also looking for feedback on how to fully-qualify extension names. Should we do access_loggers.envoy.tcp_grpc_access_log, or something like access_loggers/envoy.tcp_grpc_access_log?

@lizan
Copy link
Copy Markdown
Member

lizan commented Nov 26, 2019

I'm also looking for feedback on how to fully-qualify extension names. Should we do access_loggers.envoy.tcp_grpc_access_log, or something like access_loggers/envoy.tcp_grpc_access_log?

+1 to the latter.

@lizan
Copy link
Copy Markdown
Member

lizan commented Nov 26, 2019

cc @yanavlasov @htuch, this will affect the reporting client capabilities too.

@lizan
Copy link
Copy Markdown
Member

lizan commented Nov 26, 2019

@Shikugawa do you mind take a pass?

@Shikugawa
Copy link
Copy Markdown
Member

@lizan It looks good for me. But I think that disableFactory must be fixed after #9048 was merged to deal with if passed factory name was deprecated. Instead factory should not be nullptr even if we passed deprecated name as disabled factory.

if (it == factories().end()) {
return false;
}
it->second = nullptr;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just erase the name from factories()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I avoided that because there's no locking around the lookup. That should not be a problem in practice with the current usage, but it makes me nervous :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the value should make you as nervous as erase :) because they are not thread safe either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC it's safe to change the pointer. It has no effect on concurrent lookups and and caller either gets the pointer or gets null. Since we don't deallocate the factory, either is OK. It's racy but not unsafe.

@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Nov 26, 2019

But I think that disableFactory must be fixed after #9048 was merged to deal with if passed factory name was deprecated.

IIUC, there's 2 options here.

  1. When an extension is disabled, it is disabled for all its possible names
  2. Only the given extension name is disabled, other names continue to resolve.

@zuercher zuercher assigned lizan and unassigned zuercher Nov 26, 2019
@lizan
Copy link
Copy Markdown
Member

lizan commented Nov 26, 2019

  1. When an extension is disabled, it is disabled for all its possible names
  2. Only the given extension name is disabled, other names continue to resolve.

I prefer 1.

@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Nov 26, 2019 via email

@lizan
Copy link
Copy Markdown
Member

lizan commented Nov 26, 2019

Those will be tested in DEPRECATED_FEATURE_TEST in the compile time options. It seems more confusing by doing 2 and that doesn't provide security protection either.

Signed-off-by: James Peach <jpeach@apache.org>
When an extension is disabled, use the deprecated name tracking
to disable it by all its possible names.

Signed-off-by: James Peach <jpeach@apache.org>
Signed-off-by: James Peach <jpeach@apache.org>
Signed-off-by: James Peach <jpeach@apache.org>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #9125 was synchronize by jpeach.

see: more, trace.

@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Dec 2, 2019

@lizan Updated with review feedback.

yanavlasov
yanavlasov previously approved these changes Dec 4, 2019
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just nits.

Signed-off-by: James Peach <jpeach@apache.org>
Signed-off-by: James Peach <jpeach@apache.org>
@jpeach
Copy link
Copy Markdown
Contributor Author

jpeach commented Dec 11, 2019

@lizan WDYT? I'd prefer to leave the lambda and disable deletion as it, but happy to discuss further.

@lizan lizan merged commit 445d0ee into envoyproxy:master Dec 13, 2019
prakhag1 pushed a commit to prakhag1/envoy that referenced this pull request Jan 3, 2020
*Description:*

Add a new `--disable-extensions` flag that hides the named extensions
from their corresponding factory registry. The extensions are retained
in the registry factory, but the factory pointer is nulled so that
configuration attempts to use the extensions will fail.

*Risk Level:* Medium
*Testing:* Added unit tests, manual verification.
*Docs Changes:* Added to CLI reference.
*Release Notes:* Added release note.
*Fixes:* envoyproxy#9096 

Signed-off-by: James Peach <jpeach@apache.org>
Signed-off-by: Prakhar <prakhar_au@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants