smolnar82 opened a new pull request, #838:
URL: https://github.com/apache/knox/pull/838

   ## What changes were proposed in this pull request?
   
   There are two important pieces of this PR:
   1. the `getTopologies` REST API endpoint in `KnoxMetadataResource` was 
modified in a way such that it includes only one item per service role 
(IMPALAUI, WEBHDFS, HUE, HBASEUI, etc...) with a list of service URLs from now 
on. In previous versions it was different: the response had `N` items per 
service role with a unique service URL.
   
   ```
   $ curl -H 'Accept: application/json' -iku admin:admin-password 
https://localhost:8443/gateway/sandbox/api/v1/metadata/topologies?name=sandbox
   HTTP/1.1 200 OK
   Date: Wed, 31 Jan 2024 09:32:09 GMT
   Set-Cookie: KNOXSESSIONID=node0pafwbogn50gjy2zjiaxuchwx0.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Tue, 30-Jan-2024 09:32:09 GMT; SameSite=lax
   Content-Type: application/json
   Transfer-Encoding: chunked
   
   {
       "topologyInformations": {
           "topologyInformation": [
               {
                   "topology": "sandbox",
                   "pinned": false,
                   "apiServicesViewVersion": "v1",
                   "apiServices": {
                       "service": [
                           {
                               "context": "/webhdfs",
                               "description": "An HTTP REST API which supports 
the complete FileSystem interface for HDFS.",
                               "samples": {
                                   "sample": [
                                       {
                                           "description": "List all files under 
'testPath'",
                                           "value": "curl -iv -X GET 
\"https://localhost:8443/gateway/sandbox/webhdfs/v1/testPath?op=LISTSTATUS\"";
                                       },
                                       {
                                           "description": "Rename a 
File/Directory under ",
                                           "value": "curl -iv -X PUT 
\"https://localhost:8443/gateway/sandbox/webhdfs/v1/testPath/testFile?op=RENAME&destination=testPath/renamedFile\"";
                                       },
                                       {
                                           "description": "Get Home Directory",
                                           "value": "curl -iv -X GET 
\"https://localhost:8443/gateway/sandbox/webhdfs/v1/?op=GETHOMEDIRECTORY\"";
                                       },
                                       {
                                           "description": "You may check out 
Apache WebHDFS's REST API documentation here",
                                           "value": 
"https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html";
                                       }
                                   ]
                               },
                               "serviceName": "WEBHDFS",
                               "serviceUrls": [
                                   
"https://localhost:8443/gateway/sandbox/webhdfs";
                               ],
                               "shortDesc": "Web HDFS",
                               "type": "API",
                               "version": ""
                           }
                       ]
                   },
                   "uiServices": {
                       "service": [
                           {
                               "context": 
"/hbase/webui/master?&host={{HOST}}&port={{PORT}}",
                               "description": "The HBase Master web UI is a 
simple but useful tool, to get an overview of the current status of the 
cluster...",
                               "samples": {
                                   "sample": []
                               },
                               "serviceName": "HBASEUI",
                               "serviceUrls": [
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost1&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost10&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost11&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost12&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost13&port=8889";,
                                   ...
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost6&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost7&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost8&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/hbase/webui/master?&host=localhost9&port=8889";
                               ],
                               "shortDesc": "HBase UI",
                               "type": "UI",
                               "version": "2.1.0"
                           },
                           {
                               "context": "/hdfs/?host={{BACKEND_HOST}}",
                               "description": "The namenode UI or the namenode 
web interface is used to monitor the status of the namenode.",
                               "samples": {
                                   "sample": []
                               },
                               "serviceName": "HDFSUI",
                               "serviceUrls": [
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost10:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost11:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost12:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost13:8889";,
                                   ...
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost6:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost7:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost8:8889";,
                                   
"https://localhost:8443/gateway/sandbox/hdfs/?host=http://localhost9:8889";
                               ],
                               "shortDesc": "HDFS Namenode UI",
                               "type": "UI",
                               "version": ""
                           },
                           {
                               "context": "/hue/",
                               "description": "Hue UI is a Web interface for 
analyzing data with Apache Hadoop",
                               "samples": {
                                   "sample": []
                               },
                               "serviceName": "HUE",
                               "serviceUrls": [
                                   "https://localhost:8443/gateway/sandbox/hue/";
                               ],
                               "shortDesc": "Hue UI",
                               "type": "UI",
                               "version": ""
                           },
                           {
                               "context": 
"/impalaui?scheme={{SCHEME}}&host={{HOST}}&port={{PORT}}",
                               "description": "Each of the Impala daemons 
(impalad, statestored, and catalogd) includes a built-in web server that 
displays diagnostic and status information.",
                               "samples": {
                                   "sample": []
                               },
                               "serviceName": "IMPALAUI",
                               "serviceUrls": [
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost1&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost10&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost11&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost12&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost13&port=8889";,
                                   ...
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost6&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost7&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost8&port=8889";,
                                   
"https://localhost:8443/gateway/sandbox/impalaui?scheme=http&host=localhost9&port=8889";
                               ],
                               "shortDesc": "Impala UI",
                               "type": "UI",
                               "version": ""
                           }
                       ]
                   }
               }
           ]
       }
   }
   ```
   
   2. The Knox Home page is also modified: if a service role has more than one 
service URL, the number of instances is visible next to the service role name 
within the `Topologies` section. Clicking the service icon or the service name 
will result in a modal window that lists all instances of the given service 
role.
   I also added a filter box where end-users can search by hostname and/or port 
to make it easier for them to narrow down those instances precisely for what 
they are looking for.
   <img width="1775" alt="Screenshot 2024-01-31 at 10 56 22" 
src="https://github.com/apache/knox/assets/34065904/3dda9ddf-7314-41f3-8198-e0729cf7d5d1";>
   <img width="1777" alt="Screenshot 2024-01-31 at 10 59 15" 
src="https://github.com/apache/knox/assets/34065904/8bfb95dc-4b18-4feb-9945-f7974dbc766c";>
   
   ## How was this patch tested?
   
   Updated existing unit tests to cover the changes in `ServiceModel` and 
tested the new feature E2E locally (see sample JSON response and the new Home 
page layout above).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to