SwissDataScienceCenter / renku-gateway

Gateway between the renku UI and the various renku backend services
https://renkulab.io
Apache License 2.0
6 stars 3 forks source link

Content-based redirection #169

Open jachro opened 5 years ago

jachro commented 5 years ago

As a Renku owner, I'd like Gateway to redirect requests to GET <renku>/<resource> to GET http://knowledge-graph/<resource>. The redirect should happen only for Accept: application/json. Request with Accept: text/html should be redirected to the UI.

ableuler commented 5 years ago

Currently, this would have to happen at the ingress level. Calls without /api never make it to the gateway.

jachro commented 5 years ago

I see. Do you think it's possible to craft this kind of content-type based rules in Ingress?

rokroskar commented 5 years ago

@ableuler nothing is stopping us from sending more paths from the ingress to the gateway, right? I don't see any generic ingress rules that include content types.

ableuler commented 5 years ago

I looks like the canary annotation could do what we want, but it would definitely be an abuse of a feature which has a different purpose. Also, one can provide custom configuration as configMap to nginx ingress. I'm not sure but I guess this would also allow us to achieve what we want. The option mentioned by @rokroskar (routing all traffic to the UI through traefik) would of course also work, but it might be a bit backwards to have an ingress-controller deployed as DeamonSet which just forwards most requests to one or a couple of traefik pods inside the cluster. While this would most likely be no problem for all Renku instances that we'll be running in the foreseeable future, it would still be cleaner to just switch to traefik as ingress controller and provide the desired rules as configmap. Otherwise, would it be an option to use https://<hostname>/entities/projects/<namespace>/<project-name> instead?

jachro commented 5 years ago

That's definitely an option to put some additional segment into the URL. It'd make them a bit longer but from the other side, we could also use the opportunity and add some versioning too. Maybe we can follow the GitLab API URL pattern https://renku/api/v1/projects/<namespace>/<project-name>?

ableuler commented 5 years ago

...we could also use the opportunity and add some versioning too

As we've started without the version in the URL I'd prefer to go for versioning through the header.

In a brief discussion, @rokroskar and I agreed that the human-readable web page URL https://renku/projects/<namespace>/<project-name> should serve as IDs for entities. Rok suggested that machine-readable information could be embedded in the HTML using the <script type="application/ld+json"> tag.

rokroskar commented 5 years ago

But in addition to

the human-readable web page URL https://renku/projects// should serve as IDs for entities. Rok suggested that machine-readable information could be embedded in the HTML using the Githubissues.

  • Githubissues is a development platform for aggregating issues.