Skip to content

admin: make admin HTML a compile-time option#21814

Merged
jmarantz merged 9 commits intoenvoyproxy:mainfrom
jmarantz:admin-html-extension
Jun 24, 2022
Merged

admin: make admin HTML a compile-time option#21814
jmarantz merged 9 commits intoenvoyproxy:mainfrom
jmarantz:admin-html-extension

Conversation

@jmarantz
Copy link
Contributor

@jmarantz jmarantz commented Jun 22, 2022

Commit Message: Make the HTML view for stats a compile-time option, defaulting to on. This PR doesn't change any code-paths, but it moves the HTML support into a separate file, compiled into //source/server/admin:admin_lib. In the future, and admin_html_lib will be added, built only when admin-html is not disabled. That will allow #19546 and ultimately #18670 to proceed.

To disable, compile with --define=admin_html=disabled, in which case the admin "/" endpoint will just print that the thml mode was disabled.

Additional Description: This PR is a step toward solving #18675
Risk Level: low -- this just moves code around and doesn't change it at all.
Testing: //test/..., both with and without --define=admin_html=disabled
Docs Changes: included
Release Notes: included
Platform Specific Features: n/a

Signed-off-by: Joshua Marantz <jmarantz@google.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #21814 was opened by jmarantz.

see: more, trace.

jmarantz added 7 commits June 21, 2022 21:44
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz jmarantz changed the title WiP admin: make admin HTML a compile-time option admin: make admin HTML a compile-time option Jun 22, 2022
@jmarantz jmarantz marked this pull request as ready for review June 22, 2022 15:48
EXPECT_THAT(response->body(), HasSubstr("admin commands are:"));

EXPECT_EQ("200", request("admin", "GET", "/", response));
#ifdef ENVOY_ADMIN_HTML
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: in other cases I did not need a -D for this, but it seemed painful to tweak this particular test without it.

I have this gut feel that this define is costly from a build perspective since it is passed on every compile-command, even though it's needed only by one test.

LMK if you think I should re-work this somehow.

@@ -0,0 +1,122 @@
#include "source/common/html/utility.h"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note to reviewers: this code is unchanged; just moved.

namespace Envoy {
namespace Server {

Http::Code AdminImpl::handlerAdminHome(absl::string_view, Http::ResponseHeaderMap& response_headers,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this block here is the only new code in the PR.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks LGTM with a small comment. Thank you!

/wait

Comment on lines +321 to +325
config_setting(
name = "disable_admin_html",
values = {"define": "admin_html=disabled"},
)

Copy link
Member

Choose a reason for hiding this comment

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

Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #21814 (comment) was created by @jmarantz.

see: more, trace.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@jmarantz
Copy link
Contributor Author

Thanks Matt!

@jmarantz jmarantz merged commit 4192e2c into envoyproxy:main Jun 24, 2022
@jmarantz jmarantz deleted the admin-html-extension branch June 24, 2022 03:40
Amila-Rukshan pushed a commit to Amila-Rukshan/envoy that referenced this pull request Jun 28, 2022
Commit Message: Make the HTML view for stats a compile-time option, defaulting to on. This PR doesn't change any code-paths, but it moves the HTML support into a separate file, compiled into //source/server/admin:admin_lib. In the future, and admin_html_lib will be added, built only when admin-html is not disabled. That will allow envoyproxy#19546 and ultimately envoyproxy#18670 to proceed.

To disable, compile with `--define=admin_html=disabled`, in which case the admin `"/"` endpoint will just print that the thml mode was disabled.

Additional Description: This PR is a step toward solving envoyproxy#18675
Risk Level: low -- this just moves code around and doesn't change it at all.
Testing: //test/..., both with and without `--define=admin_html=disabled`
Docs Changes: included
Release Notes: included
Platform Specific Features: n/a

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Amila Senadheera <amila.15@cse.mrt.ac.lk>
jpsim added a commit to envoyproxy/envoy-mobile that referenced this pull request Jun 28, 2022
This isn't something we want to expose when running Envoy Mobile.

For more details: envoyproxy/envoy#21814

Signed-off-by: JP Simard <jp@jpsim.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.

3 participants