You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2020/04/27 13:56:57 UTC

[GitHub] [knox] pzampino commented on pull request #326: KNOX-2357 - Descriptor handler should not default discovery type to A…

pzampino commented on pull request #326:
URL: https://github.com/apache/knox/pull/326#issuecomment-620003022


   > My two cents:
   > 
   > * checking the `username` and `passwordAlias` here is not enough because in CM discovery Knox defaults to `cm.discovery.user` and `cm.discovery.password` if they are not defined -> following the new logic, performing the emptyness check here does not mean the user does not want service discovery
   > * checking the `address` here is not enough because in Ambari discovery Knox defaults to the value of `gateway.discovery.default.address` Gateway configuration
   > 
   And in this case, the discovery type must be set in the descriptor to trigger discovery (which it will be because CM is not the default type).
   
   > What if we simply rely on the discovery type. If none is selected -> no discovery will be performed. Discovery type is still optional (that is, the end-user does not need to select one) and makes the code easier to read and understand:
   > 
   My only concern is that existing descriptors that depend on the default type determination may be broken. Perhaps, that is not a significant concern though.
   
   > * `performDiscovery` should only be invoked if discovery type is not `null` [here](https://github.com/apache/knox/blob/v1.4.0/gateway-topology-simple/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java#L109)
   > * the [default discovery type](https://github.com/apache/knox/blob/v1.4.0/gateway-topology-simple/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java#L71) should be removed
   > * we may want to add some `WARN` level messages in the log in case discovery type is not selected but any of the other discovery related configuration is present. This check should be implemented in `SimpleDescriptorImpl` instead of in `SimpleDescriptorHandler` where only the log should be placed.
   > 
   I may be misunderstanding, but I think I disagree about the placement of this logic. The handler is interpreting the descriptor state to make the decision to perform discovery or not; I don't think that is an implementation-specific decision, and I don't think the descriptor should be responsible for discovery logic since it's really just a representation of a config file.
   
   


----------------------------------------------------------------
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:
users@infra.apache.org