Repository: knox Updated Branches: refs/heads/master 33d530c56 -> 8e2cebda6
KNOX-1212 - Support new YARN webui2 in Knox (Sunil Govindan via Phil Zampino) Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/8e2cebda Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/8e2cebda Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/8e2cebda Branch: refs/heads/master Commit: 8e2cebda6bde0548af3fd85a91ab32e6040e0918 Parents: 33d530c Author: Sunil G <sun...@apache.org> Authored: Thu Apr 5 19:23:03 2018 +0530 Committer: Phil Zampino <pzamp...@apache.org> Committed: Fri Apr 6 15:57:26 2018 -0400 ---------------------------------------------------------------------- .../services/yarnuiv2/3.0.0/rewrite.xml | 151 +++++++++++++++++++ .../services/yarnuiv2/3.0.0/service.xml | 92 +++++++++++ 2 files changed, 243 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/8e2cebda/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml new file mode 100644 index 0000000..4af4c90 --- /dev/null +++ b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<rules> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/rootAppScript" pattern="*://*:*/**/yarnuiv2/"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/node" pattern="*://*:*/**/yarnuiv2/node?{host}&{port=**}"> + <rewrite template="http://{host}:{port=**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/timeline" pattern="*://*:*/**/yarnuiv2/timeline?{host}&{port=**}"> + <rewrite template="http://{host}:{port=**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/path" pattern="*://*:*/**/yarnuiv2/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/query" pattern="*://*:*/**/yarnuiv2/{**}?{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/{**}?{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/ws" pattern="*://*:*/**/yarnuiv2/ws/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ws/{**}"/> + </rule> + + <!-- Resources --> + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/styles" pattern="*://*:*/**/yarnuiv2/styles/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/styles/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/scripts" pattern="*://*:*/**/yarnuiv2/scripts/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/scripts/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/extensions" pattern="*://*:*/**/yarnuiv2/extensions/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/extensions/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/jax" pattern="*://*:*/**/yarnuiv2/jax/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/jax/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/components" pattern="*://*:*/**/yarnuiv2/components/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/components/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/assets" pattern="*://*:*/**/yarnuiv2/assets/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/assets/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/fonts" pattern="*://*:*/**/yarnuiv2/fonts/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/fonts/{**}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/config" pattern="*://*:*/**/yarnuiv2/config/{**}"> + <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/config/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/sitepath"> + <rewrite template="{$frontend[path]}/yarnuiv2"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/css" pattern="styles/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/styles/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/assets/styles" pattern="assets/styles/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/assets/styles/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/assets" pattern="assets/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/assets/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/config" pattern="config/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/config/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/javascript" pattern="scripts/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/scripts/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/javascript" pattern="extensions/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/extensions/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/javascript" pattern="jax/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/jax/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/javascript" pattern="components/{**}"> + <rewrite template="{$frontend[path]}/yarnuiv2/components/{**}"/> + </rule> + + <rule dir="OUT" name="YARNUIV2/yarnuiv2/outbound/logohref"> + <rewrite template="ui2/#/cluster-overview"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/nodeaddress"> + <match pattern="{host}:{port}"/> + <rewrite template="{$frontend[url]}/yarnuiv2/node?{host}?{port}"/> + </rule> + + <rule dir="IN" name="YARNUIV2/yarnuiv2/outbound/timeline"> + <match pattern="{host}:{port}"/> + <rewrite template="{$frontend[url]}/yarnuiv2/timeline?{host}?{port}"/> + </rule> + + <filter name="YARNUIV2/yarnuiv2/outbound/links"> + <content type="*/x-javascript"> + <apply path="ui2/#/cluster-overview" rule="YARNUIV2/yarnuiv2/outbound/logohref"/> + </content> + <content type="application/javascript"> + <apply path="ui2/#/cluster-overview" rule="YARNUIV2/yarnuiv2/outbound/logohref"/> + </content> + <content type="*/html"> + </content> + </filter> + + <filter name="YARNUIV2/yarnuiv2/outbound/mainpage"> + <content type="*/json"> + <apply path="$.nodes.node[*].nodeHTTPAddress" rule="YARNUIV2/yarnuiv2/nodeaddress"/> + </content> + </filter> + + <filter name="YARNUIV2/yarnuiv2/outbound/query"> + <content type="*/json"> + <apply path="$.property.value" rule="YARNUIV2/yarnuiv2/outbound/timeline"/> + </content> + </filter> + +</rules> + http://git-wip-us.apache.org/repos/asf/knox/blob/8e2cebda/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml new file mode 100644 index 0000000..83d4dfd --- /dev/null +++ b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<service role="YARNUIV2" name="yarnuiv2" version="0.1.0"> + <policies> + <policy role="webappsec"/> + <policy role="authentication" name="Anonymous"/> + <policy role="rewrite"/> + <policy role="authorization"/> + </policies> + + <routes> + <route path="/yarnuiv2"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/rootAppScript" to="request.url"/> + </route> + + <route path="/yarnuiv2/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/path" to="request.url"/> + </route> + + <route path="/yarnuiv2/node?**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/node" to="request.url"/> + </route> + + <route path="/yarnuiv2/timeline?**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/timeline" to="request.url"/> + </route> + + <route path="/yarnuiv2/**?**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/query" to="request.url"/> + <rewrite apply="YARNUIV2/yarnuiv2/outbound/query" to="response.body"/> + </route> + + <route path="/yarnuiv2/**/yarn-ui.js"> + <rewrite apply="YARNUIV2/yarnuiv2/outbound/links" to="response.body"/> + </route> + + <route path="/yarnuiv2/ws/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/ws" to="request.url"/> + <rewrite apply="YARNUIV2/yarnuiv2/outbound/mainpage" to="response.body"/> + <dispatch contributor-name="http-client" /> + </route> + <!-- Resources --> + <route path="/yarnuiv2/styles/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/styles" to="request.url"/> + </route> + + <route path="/yarnuiv2/scripts/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/scripts" to="request.url"/> + </route> + + <route path="/yarnuiv2/extensions/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/extensions" to="request.url"/> + </route> + + <route path="/yarnuiv2/jax/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/jax" to="request.url"/> + </route> + + <route path="/yarnuiv2/components/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/components" to="request.url"/> + </route> + + <route path="/yarnuiv2/assets/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/assets" to="request.url"/> + </route> + + <route path="/yarnuiv2/fonts/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/fonts" to="request.url"/> + </route> + + <route path="/yarnuiv2/config/**"> + <rewrite apply="YARNUIV2/yarnuiv2/inbound/config" to="request.url"/> + </route> + + </routes> + <dispatch classname="org.apache.knox.gateway.dispatch.PassAllHeadersDispatch"/> +</service>