[
https://issues.apache.org/jira/browse/KNOX-2160?focusedWorklogId=368140&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-368140
]
ASF GitHub Bot logged work on KNOX-2160:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Jan/20 11:35
Start Date: 08/Jan/20 11:35
Worklog Time Spent: 10m
Work Description: smolnar82 commented on pull request #233: KNOX-2160 -
Monitoring and processing refreshable service parameters
URL: https://github.com/apache/knox/pull/233
## What changes were proposed in this pull request?
Monitoring a pre-defined folder for service parameter changes and, if there
was a change in the `refreshable-service-parameters.xml`, processing the new
service parameters.
## How was this patch tested?
Added and updated JUnit tests then executed them:
```
$ mvn clean -Dshellcheck=true -T1C verify -Prelease,package
...
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 02:37 min
[INFO] Finished at: 2020-01-08T12:16:47+01:00
[INFO] Final Memory: 156M/1615M
[INFO]
------------------------------------------------------------------------
```
Additionally, the following E2E testing took place locally:
- deployed Knox with my changes
- set
-`gateway.refreshable.service.parameters.folder=/Users/smolnar/test/conf_dir`
-`gateway.refreshable.service.parameters.folder.monitor.interval=10000`
in `gateway-site.xml`
- produced `/Users/smolnar/test/conf_dir/refreshable-service-parameters.xml`
(used the same sample I added as a new JUnit test resource)
- started Knox (confirmed - using remote debugging - that the monitoring
thread got created)
- created `cdp-proxy-api` provider/descriptor pair (with HIVE, RANGER and
NIFI services; gave the dummy URLs)
- edited the content of
`/Users/smolnar/test/conf_dir/refreshable-service-parameters.xml`
- confirmed that `cdp-proxy-api` got re-deployed: saw the proper log
messages and checked the re-deployed topology content in the Admin UI
- changed the service parameters in the Admin UI too
Relevant `gateway.log` messages:
```
2020-01-08 12:32:59,484 INFO knox.gateway
(DefaultTopologyService.java:refreshServiceParameters(855)) - Refreshing
service parameters...
2020-01-08 12:32:59,494 INFO knox.gateway
(DefaultTopologyService.java:refreshServiceParameters(857)) - Refreshed service
parameters in cdp-proxy-api
...
2020-01-08 12:33:03,733 INFO knox.gateway
(DefaultTopologyService.java:onFileChange(946)) - Generated topology
cdp-proxy-api.xml because the associated descriptor cdp-proxy-api.json changed.
2020-01-08 12:33:06,179 INFO knox.gateway
(GatewayServer.java:handleCreateDeployment(998)) - Deploying topology
cdp-proxy-api to
/Users/smolnar/test/knoxGateway/data/deployments/cdp-proxy-api.topo.16f84eded98
2020-01-08 12:33:06,179 INFO knox.gateway
(GatewayServer.java:internalDeactivateTopology(917)) - Deactivating topology
cdp-proxy-api
2020-01-08 12:33:06,238 INFO knox.gateway
(DefaultGatewayServices.java:initializeContribution(164)) - Credential store
found for the cluster: cdp-proxy-api - no need to create one.
2020-01-08 12:33:06,607 INFO knox.gateway
(GatewayServer.java:internalActivateTopology(883)) - Activating topology
cdp-proxy-api
2020-01-08 12:33:06,607 INFO knox.gateway
(GatewayServer.java:internalActivateArchive(893)) - Activating topology
cdp-proxy-api archive %2F
2020-01-08 12:33:06,666 INFO knox.gateway
(GatewayServer.java:cleanupTopologyDeployments(356)) - Deleting backup deployed
topology
/Users/smolnar/test/knoxGateway/data/deployments/cdp-proxy-api.topo.16f84d7c1d0
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 368140)
Remaining Estimate: 0h
Time Spent: 10m
> Monitoring and process refreshable service parameters in Knox
> -------------------------------------------------------------
>
> Key: KNOX-2160
> URL: https://issues.apache.org/jira/browse/KNOX-2160
> Project: Apache Knox
> Issue Type: New Feature
> Components: Server
> Affects Versions: 1.1.0, 1.2.0, 1.3.0
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Major
> Fix For: 1.4.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> It'd be beneficial if there was a way to update service parameters in a
> descriptor without using the Admin API/UI. The preferred approach is
> described as follows. I'd add 2 new configurations:
> - {{refreshable.service.parameters.folder}} - optional configuration to
> indicate if Knox should monitor the given folder for service parameter
> changes. If it's {{null}} -> no monitoring is enabled.
> - {{refreshable.service.parameters.folder.monitor.interval}} - indicates the
> time period Knox checks if any parameter changes were made; defaults to 60
> seconds. This is relevant only if {{refreshable.service.parameters.folder}}
> is {{not null}}.
> A new monitor would be implemented (triggered only if monitoring is enabled)
> as follows:
> # checks {{refreshable-service-parameters.xml}} within the configured
> {{refreshable.service.parameters.folder}}. The relevant configuration's name
> is {{refreshable.service.parameters}}.
> # if there is new content (based on file timestamp) -> parse the file and
> build a new parameter list -> trigger topology redeployment with the new
> parameter list by rewriting the appropriate descriptor file.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)