Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config dump, listeners are added to warming list if workers are not started yet #7511

Merged
merged 2 commits into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions source/server/listener_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,22 @@ ProtobufTypes::MessagePtr ListenerManagerImpl::dumpListenerConfigs() {
static_listener.mutable_listener()->MergeFrom(listener->config());
TimestampUtil::systemClockToTimestamp(listener->last_updated_,
*(static_listener.mutable_last_updated()));
continue;
}
envoy::admin::v2alpha::ListenersConfigDump_DynamicListener* dump_listener;
// Listeners are always added to active_listeners_ list before workers are started.
// This applies even when the listeners are still waiting for initialization.
// To avoid confusion in config dump, in that case, we add these listeners to warming
// listeners config dump rather than active ones.
if (workers_started_) {
dump_listener = config_dump->mutable_dynamic_active_listeners()->Add();
} else {
auto& dynamic_listener = *config_dump->mutable_dynamic_active_listeners()->Add();
dynamic_listener.set_version_info(listener->versionInfo());
dynamic_listener.mutable_listener()->MergeFrom(listener->config());
TimestampUtil::systemClockToTimestamp(listener->last_updated_,
*(dynamic_listener.mutable_last_updated()));
dump_listener = config_dump->mutable_dynamic_warming_listeners()->Add();
}
dump_listener->set_version_info(listener->versionInfo());
dump_listener->mutable_listener()->MergeFrom(listener->config());
TimestampUtil::systemClockToTimestamp(listener->last_updated_,
*(dump_listener->mutable_last_updated()));
}

for (const auto& listener : warming_listeners_) {
Expand Down
4 changes: 2 additions & 2 deletions test/server/listener_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ filter_chains: {}
version_info: version1
static_listeners:
dynamic_active_listeners:
dynamic_warming_listeners:
version_info: "version1"
listener:
name: "foo"
Expand All @@ -777,7 +778,6 @@ version_info: version1
last_updated:
seconds: 1001001001
nanos: 1000000
dynamic_warming_listeners:
dynamic_draining_listeners:
)EOF");

Expand Down Expand Up @@ -808,6 +808,7 @@ per_connection_buffer_limit_bytes: 10
version_info: version2
static_listeners:
dynamic_active_listeners:
dynamic_warming_listeners:
version_info: "version2"
listener:
name: "foo"
Expand All @@ -820,7 +821,6 @@ version_info: version2
last_updated:
seconds: 2002002002
nanos: 2000000
dynamic_warming_listeners:
dynamic_draining_listeners:
)EOF");

Expand Down