[
https://issues.apache.org/jira/browse/KNOX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086337#comment-16086337
]
Jesus Alvarez commented on KNOX-976:
------------------------------------
Sorry on the delay -- Just got back from being out of office,
The policies here I added as a workaround to Knox corrupting the json body for
the json body of one of the JNBG POST calls, it looks as though knox changes
the conenttype to use application/x-www-form-urlencoded by default:
Intended flow:
1. Application queries <knox>/default/gateway/jkg/kernelspecs to retrieve
available kernels
{code}
curl -v -u guest:guest-password -X GET
https://sample.org:8443/gateway/default/jkg/api/kernelspecs
{code}
2. Application POSTS the kernel to start
{code}
curl -v -u "guest:guest-password" -k -X POST
https://sample.org:8443/gateway/default/jkg/api/kernels -d '{"name" :
"spark_2.1_python2", "env": { "KERNEL_USERNAME": "guest" } }'
{code}
Without the policies, knox will send the {} in the json body as %7B%22
{code}
2017-07-13 13:03:42,666 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-0
>>
"%7B%22name%22+%3A+%22spark_2.1_python2%22%2C+%22env%22%3A+%7B+%22KERNEL_USERNAME%22%3A+%22guest%22+%7D+%7D[\r][\n]"
{code}
With the policies in place, knox sends the correct json body over
{code}
2017-07-13 12:56:45,879 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-14
>> "{"name" : "spark_2.1_python2", "env": { "KERNEL_USERNAME": "guest" }
}[\r][\n]"
{code}
The jkgws service.xml does not require these policies, and I have corrected
this in the new patch.
The PassAllHeadersDispatch was originally added to allow passing in connection
keep-alive as a workaround for https://issues.apache.org/jira/browse/KNOX-921,
however with the workaround added in that jira, this is no longer required and
removed from new patch.
> Add Jupyter Kernel Gateway Service Definitions
> ----------------------------------------------
>
> Key: KNOX-976
> URL: https://issues.apache.org/jira/browse/KNOX-976
> Project: Apache Knox
> Issue Type: Task
> Reporter: Jesus Alvarez
> Assignee: Jesus Alvarez
> Fix For: 0.13.0
>
> Attachments: jkg-knox.png, KNOX-976.patch
>
>
> Jupyter Kernel Gateway is a web server that provides headless access to
> Jupyter kernels.
> This allows remote Jupyter notebooks to connect to a kernel gateway running
> in an HDP cluster, and spawn the kernel/spark driver on the kernel gateway
> host.
> https://jupyter-kernel-gateway.readthedocs.io/en/latest/
> Jupyter Kernel Gateway uses on HTTP and Websocket, hence dependency link to
> KNOX-776.
> There are other Jupyter ecosystem projects which could highly benefit/use
> Knox in the future, such as Jupyter Hub.
> The layout which we have currently is similar to zeppelinui/zeppelinws:
>
> gateway-service-definitions/src/main/resources/services/jkg/1.1.2/*.xml
> gateway-service-definitions/src/main/resources/services/jkgws/1.1.2/*.xml
> If there is a preferred naming structure for the 2 services please advise
> (Such as
> gateway-service-definitions/src/main/resources/services/jupyterkernelgateway/1.1.2/*.xml
> )
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)