openanalytics / shinyproxy-operator

Easily run ShinyProxy on a Kubernetes cluster
https://shinyproxy.io
Apache License 2.0
36 stars 9 forks source link

How to use a NGINX or Traefik Ingress with shinyproxy-operator? #1

Closed cnukwas closed 3 years ago

cnukwas commented 3 years ago

I am helping internal team setting up ShinyProxy Operator, little lost as I don't see a service for ShinyProxy deployment after creating Kubernetes objects. I do see a redis service but there is nothing for ShinyProxy. Any clues on how to use either a NGINX or Traefik Ingress without using Skipper-Ingress mentioned here? I thought that the deployment would create a Kubernetes service and we can expose using Ingress, but I don't see any such thing.

I do see a mention of fqdn: shinyproxy-demo.local in shinyproxy.yaml, what changes needs to be done in order to use our own URL?

Thanks

cnukwas commented 3 years ago

Noticed a NodePort service got created once ShinyProxy pod start up issues have been resolved. I was able to access the NodePort URL and set up an Ingress URL as well. Need to see how to inject a 'static' service name since I see a long and dynamic name during the deployment.

LEDfan commented 3 years ago

Hi @cnukwas

Thank you for your interest in the operator! The operator indeed uses Skipper for handling and managing ingress. The main idea of the Operator is to manage multiple ShinyProxy instances with different configuration such that users don't loose their connection with running Shiny apps. This is explained in more detail here https://shinyproxy.io/documentation/deployment/#why-1

However, because of running multiple instances, we need some way to route users to the correct instance. A user which opens a new session will be routed to the latest version of ShinyProxy (i.e. the instance which contains the latest configuration). However, users which are already using instances with older configuration, still need to access those old instances. To do this routing we use Skipper. Hence it's a vital part of the operator.

Maybe you can explain your use-case of the Operator a bit more. That way we can see what people want to do with it and how we can improve it.

LEDfan commented 3 years ago

I forgot to mention this, but you can perfectly run Skipper without it being the ingress controller. In fact, that is how we use it. For example, you can put nginx in front of skipper and ensure that skipper is only used as a Service.

cnukwas commented 3 years ago

@LEDfan, thanks again. Based on this it appears that we must have Skipper service and container also running in the environment to allow the operator to route requests between old and new ShinyProxy containers. I am able to configure Traefik Ingress without Skipper deployment but have not tested the routing features by spinning up multiple SP instances. We don't have any special requirements for the operator, I wasn't sure whether or not Skipper is necessary since we have our own Ingress Controller. On a side note how do we customize or get source code for the operator Docker image?

cnukwas commented 3 years ago

Noticed a NodePort service got created once ShinyProxy pod start up issues have been resolved. I was able to access the NodePort URL and set up an Ingress URL as well. Need to see how to inject a 'static' service name since I see a long and dynamic name during the deployment.

Any clue on either overriding the service name to a known string or other approaches as I see that the service name is getting created based on hash? Not a major issue but trying to see if there are any customization options for this. I guess front-end Skipper with an Ingress Controller may help, since we will no longer call ShinyProxy service directly?

Thanks

LEDfan commented 3 years ago

Any clue on either overriding the service name to a known string or other approaches as I see that the service name is getting created based on hash?

Indeed the service name is generated using a hash of the application.yaml. The idea is to have a unique, but predictable name, so that other components can rely on the name. We currently don't provide a way to customize this.

I guess front-end Skipper with an Ingress Controller may help, since we will no longer call ShinyProxy service directly?

Yes that should help. Indeed, the ShinyProxy services created by the Operator are not meant to be used directly. Instead Skipper will use it gather the endpoints it internally uses.

cnukwas commented 3 years ago

@LEDfan, thanks again. Working on putting Skipper in place.