Skip to content

Commit

Permalink
CH-110 jupyterhub update wip
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Jan 20, 2024
1 parent cff3c6b commit 428d83d
Show file tree
Hide file tree
Showing 9 changed files with 6,050 additions and 299 deletions.
26 changes: 17 additions & 9 deletions applications/jupyterhub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
ARG CLOUDHARNESS_BASE
FROM $CLOUDHARNESS_BASE as base

FROM jupyterhub/k8s-hub:1.1.3
FROM quay.io/jupyterhub/k8s-hub:3.2.1
USER root


COPY --from=base libraries/models/requirements.txt /libraries/models/requirements.txt
RUN pip install -r /libraries/models/requirements.txt
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -r /libraries/models/requirements.txt
COPY --from=base libraries/cloudharness-common/requirements.txt /libraries/cloudharness-common/requirements.txt
RUN pip install -r /libraries/cloudharness-common/requirements.txt
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -r /libraries/cloudharness-common/requirements.txt
COPY --from=base libraries/client/cloudharness_cli/requirements.txt /libraries/client/cloudharness_cli/requirements.txt
RUN pip install -r /libraries/client/cloudharness_cli/requirements.txt
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -r /libraries/client/cloudharness_cli/requirements.txt

COPY --from=base libraries/models /libraries/models
RUN pip install -e /libraries/models
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -e /libraries/models

COPY --from=base libraries/cloudharness-common /libraries/cloudharness-common
COPY --from=base libraries/client/cloudharness_cli /libraries/client/cloudharness_cli

#

RUN pip install -e /libraries/cloudharness-common
RUN pip install -e /libraries/client/cloudharness_cli
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -e /libraries/cloudharness-common
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install -e /libraries/client/cloudharness_cli


COPY src src
RUN pip install ./src/harness_jupyter
RUN pip install ./src/chauthenticator
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install ./src/harness_jupyter
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
pip install ./src/chauthenticator

USER jovyan
3 changes: 2 additions & 1 deletion applications/jupyterhub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ TODO: remember to implement/revise this code after you have updated/changed the
The helm chart is based on the [zero-to-jupyterhub](https://github.com/jupyterhub/zero-to-jupyterhub-k8s/) helm chart.

1. Run update.sh [TAG] # Do not use latest!
2. Restore from the diff files with EDIT: CLOUDHARNESS
2. Restore from the diff files with EDIT: CLOUDHARNESS. Use update.patch as a reference
3. 3. Update Dockerfile to use the same base image you see on values.yaml: hub/image

Customize notebook image: quay.io/jupyterhub/k8s-singleuser-sample:[TAG]

Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ def camelCaseify(s):
c.Authenticator.auto_login = True
c.OAuthenticator.client_id = client_id
c.OAuthenticator.client_secret = client_secret
c.OAuthenticator.allow_all = True

c.GenericOAuthenticator.login_service = "CH"
c.GenericOAuthenticator.username_key = "email"
Expand Down
1 change: 1 addition & 0 deletions applications/jupyterhub/deploy/resources/hub/z2jh.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def get_config(key, default=None):
value = value[level]

# EDIT: CLOUDHARNESS START
import re
if value and isinstance(value, str):
replace_var = re.search("{{.*?}}", value)
if replace_var:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ldap.dn.user.useLookupName: LDAPAuthenticator.use_lookup_dn_username
representing the old z2jh config, output the result
in $c.
*/}}
{{- include "jupyterhub.authDep.remapOldToNew.mappable" (list $c .Values.apps.jupyterhub.apps.jupyterhub.global.safeToSho.Values.apps.jupyterhub. }}
{{- include "jupyterhub.authDep.remapOldToNew.mappable" (list $c .Values.apps.jupyterhub.apps.jupyterhub.global.safeToSho.Values.apps.jupyterhub) }}
{{- $class_old_config_key := .Values.apps.jupyterhub.apps.jupyterhub.auth.type | default "" }} {{- /* ldap - github */}}
{{- $class_new_entrypoint := "" }} {{- /* ldapauthenticator.LDAPAuthenticator - github */}}
Expand All @@ -191,7 +191,7 @@ ldap.dn.user.useLookupName: LDAPAuthenticator.use_lookup_dn_username
{{- /* UPDATE c dict explicitly with auth.custom.config */}}
{{- if .Values.apps.jupyterhub.apps.jupyterhub.auth.custom.config }}
{{- $custom_config := merge (dict) .Values.apps.jupyterhub.apps.jupyterhub.auth.custom.config }}
{{- if not .Values.apps.jupyterhub.apps.jupyterhub.global.safeToSho.Values.apps.jupyterhub.}}
{{- if not .Values.apps.jupyterhub.apps.jupyterhub.global.safeToSho.Values.apps.jupyterhub }}
{{- range $key, $val := $custom_config }}
{{- $_ := set $custom_config $key "***" }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion applications/jupyterhub/deploy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ component: {{ include "jupyterhub.componentLabel" . }}
using "toYaml | fromYaml" in order to be able to use normal helm
template functions on it.
*/}}
{{- $jupyterhub_values := .root.Values.apps.jupyterhub.}}
{{- $jupyterhub_values := .root.Values.apps.jupyterhub }}
{{- if ne .root.Chart.Name "jupyterhub" }}
{{- if .root.Values.apps.jupyterhub.jupyterhub }}
{{- $jupyterhub_values = .root.Values.apps.jupyterhub.jupyterhub }}
Expand Down
Loading

0 comments on commit 428d83d

Please sign in to comment.