charts icon indicating copy to clipboard operation
charts copied to clipboard

Jupyter Hub doesnt seems to be working like the native jhub when setting the baseUrl parameter

Open chrispward opened this issue 2 years ago • 5 comments

Name and Version

bitnami/Jupyterhub:latest

What steps will reproduce the bug?

Trying to use the jupyter hub helm charts to install on new k8 cluster. We are using Contour as our ingress. (we are using httproxy chart separately rather than using the ingress properties)

When trying to install jhub and configure it to use the hub.baseUrl property, the hub will not start fully and you see 404 errors.

I used a vanilla jhub helm install using the https://jupyterhub.readthedocs.io/en/stable/index.html with the attached properties and it works differently in regards to what I think is, what I think, a proxy error.

It's difficult to trace the charts so raising this as a bug.

Are you using any custom parameters or values?

bitnamiConfig.yaml

global:
  storageClass: pmax-storage-policy
    
hub:
  adminUser: admin
  password: admin
  baseUrl: /jhub

### What is the expected behavior?

This is the hub log of a vanila jupyterhub installation using the using the config.yaml 
helm install jhub2 jupyterhub/jupyterhub -n jhub2 -f def_config.yaml --create-namespace

singleuser:
  storage:
    dynamic:
      storageClass: pmax-storage-policy

hub:
  db:
    pvc:
      storageClassName: pmax-storage-policy
  baseUrl: /jhub2
[I 2022-08-18 17:24:00.787 JupyterHub proxy:432] Adding route for Hub: /jhub2/ => http://hub:8081
[I 2022-08-18 17:24:00.789 JupyterHub app:2869] JupyterHub is now running at http://:8000/jhub2/
[I 2022-08-18 17:24:00.895 JupyterHub log:189] 200 GET /jhub2/hub/api/users (cull-idle@::1) 14.60ms
[I 2022-08-18 17:24:30.957 JupyterHub log:189] 302 GET /jhub2 -> /jhub2/hub/ (@::ffff:172.20.5.186) 0.79ms

What do you see instead?

Using the following.

helm install bjhub2 bitnami2/jupyterhub -n bjhub2 -f bitnamiConfig.yaml --create-namespace

See the jhub is missing the /jhub after http://:8000

Also, see some sort of redirect. /bjhub/hub/health -> /hub/bjhub/hub/health and the error 404 as that URL doesn't exist.

[I 2022-08-18 17:28:16.100 JupyterHub proxy:432] Adding route for Hub: / => http://bjhub-jupyterhub-hub:8081
[I 2022-08-18 17:28:16.103 JupyterHub app:2869] JupyterHub is now running at http://:8000
[I 2022-08-18 17:28:16.213 JupyterHub log:189] 200 GET /hub/api/users (cull-idle@::1) 24.12ms
[I 2022-08-18 17:28:25.738 JupyterHub log:189] 302 GET /bjhub/hub/health -> /hub/bjhub/hub/health (@172.20.5.1) 0.82ms
[W 2022-08-18 17:28:25.763 JupyterHub log:189] 404 GET /hub/bjhub/hub/health (@172.20.5.1) 24.14ms

Additional information

FYI. Our httproxy chart for contour is simple and works for the vanilla jhub. It isn't the issue here. Just thought I'd show how we're creating the ingress chart ourselves.

# httpproxy-multiple-paths.yaml
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: jhub-multiple-paths
  namespace: jhub2
  labels:
    app.kubernetes.io/component: httpproxy
    app.kubernetes.io/instance: jhub2
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: jupyterhub
    helm.sh/chart: jupyterhub-1.3.13
spec:
  virtualhost:
    fqdn: <my domain>
  routes:
    - conditions:
      - prefix: /jhub2
      services:
        - name: proxy-public
          port: 80

chrispward avatar Aug 18 '22 18:08 chrispward

Hi @chrispward, I'm afraid that we are not going to be able to implement a fix for this issue, as we have a lot of things on our plate right now.

Please note that we are open for contributions, so feel free and send any contribution that helps in improving the helm chart! We would be more than happy to help with the code review and release.

marcosbc avatar Aug 26 '22 17:08 marcosbc

So.. took you up on that and figured it out for you...

In the configuration section, the baseUrl: is missing. https://github.com/bitnami/charts/blob/master/bitnami/jupyterhub/values.yaml#L101

by adding the following to pick up the baseUrl value which is 13 lines above, it fixes the issue

      baseUrl:  .Values.hub.baseUrl

https://github.com/bitnami/charts/blob/master/bitnami/jupyterhub/values.yaml#L88

should look like...

configuration: |
    Chart:
      Name: {{ .Chart.Name }}
      Version: {{ .Chart.Version }}
    Release:
      Name: {{ .Release.Name }}
      Namespace: {{ .Release.Namespace }}
      Service: {{ .Release.Service }}
    hub:
	baseUrl:  .Values.hub.baseUrl

note: How i tested this... I grabbed the 'values' from the hub secret, decoded it, added value as shown, encoded and reapplyed the secret, then deleted the hub pod and when it came back up.. it worked.!

Please patch the values.yaml file

chrispward avatar Aug 30 '22 18:08 chrispward

@chrispward Since you figured out the issue, would you be up to authoring a contribution with the fix, as a pull request?

marcosbc avatar Sep 05 '22 08:09 marcosbc

sure. I have another 'fix' for the notebook_url as well. (issue is its notebook_url is hardcoded and not using the mount volume properties which causes an issue if you decide to use your own jhub lab image ... which we are ...)

chrispward avatar Sep 06 '22 15:09 chrispward

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

bitnami-bot avatar Sep 22 '22 01:09 bitnami-bot

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

bitnami-bot avatar Sep 27 '22 01:09 bitnami-bot