From 11343cd6ea76f642e30afcde743320f32efd2e5c Mon Sep 17 00:00:00 2001 From: senmiaoliu Date: Tue, 16 Apr 2024 15:25:35 +0800 Subject: [PATCH] [KYUUBI #6299] Support disabling Web UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes #6299 ## Describe Your Solution ๐Ÿ”ง when disabling web ui, return 404 page ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklist ๐Ÿ“ - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6311 from lsm1/branch-support-disable-webui. Closes #6299 aa96c2737 [senmiaoliu] remove enable.html 998504710 [senmiaoliu] fix style a2622cbbc [senmiaoliu] disable web ui Authored-by: senmiaoliu Signed-off-by: Cheng Pan --- docs/configuration/settings.md | 1 + .../main/scala/org/apache/kyuubi/config/KyuubiConf.scala | 7 +++++++ .../apache/kyuubi/server/KyuubiRestFrontendService.scala | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/configuration/settings.md b/docs/configuration/settings.md index 72b5ab520..f102e0a05 100644 --- a/docs/configuration/settings.md +++ b/docs/configuration/settings.md @@ -260,6 +260,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co | kyuubi.frontend.rest.proxy.jetty.client.requestBufferSize | 4096 | Size of the buffer in bytes used to write requests for Jetty server used by the RESTful frontend service. | int | 1.10.0 | | kyuubi.frontend.rest.proxy.jetty.client.responseBufferSize | 4096 | Size of the buffer in bytes used to read response for Jetty server used by the RESTful frontend service. | int | 1.10.0 | | kyuubi.frontend.rest.proxy.jetty.client.timeout | PT60S | The total timeout in milliseconds for Jetty server used by the RESTful frontend service. | duration | 1.10.0 | +| kyuubi.frontend.rest.ui.enabled | true | Whether to enable Web UI when RESTful protocol is enabled | boolean | 1.10.0 | | kyuubi.frontend.ssl.keystore.algorithm | <undefined> | SSL certificate keystore algorithm. | string | 1.7.0 | | kyuubi.frontend.ssl.keystore.password | <undefined> | SSL certificate keystore password. | string | 1.7.0 | | kyuubi.frontend.ssl.keystore.path | <undefined> | SSL certificate keystore location. | string | 1.7.0 | diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala index 840421a3d..397c04935 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala @@ -626,6 +626,13 @@ object KyuubiConf { .timeConf .createWithDefaultString("PT5S") + val FRONTEND_REST_UI_ENABLED: ConfigEntry[Boolean] = + buildConf("kyuubi.frontend.rest.ui.enabled") + .doc("Whether to enable Web UI when RESTful protocol is enabled") + .version("1.10.0") + .booleanConf + .createWithDefault(true) + val FRONTEND_WORKER_KEEPALIVE_TIME: ConfigEntry[Long] = buildConf("kyuubi.frontend.worker.keepalive.time") .doc("(deprecated) Keep-alive time (in milliseconds) for an idle worker thread") diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala index a3dd40389..06eb63fee 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala @@ -111,8 +111,9 @@ class KyuubiRestFrontendService(override val serverable: Serverable) val proxyHandler = ApiRootResource.getEngineUIProxyHandler(this) server.addHandler(authenticationFactory.httpHandlerWrapperFactory.wrapHandler(proxyHandler)) - - installWebUI() + if (conf.get(FRONTEND_REST_UI_ENABLED)) { + installWebUI() + } } private def installWebUI(): Unit = {