Skip to content

Commit

Permalink
Merge branch 'main' into migrate-awi-ciroh
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibson91 authored Jun 21, 2024
2 parents 1ae197d + 3b025c1 commit 02b008a
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/clusters/2i2c/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ hubs:
- enc-imagebuilding-demo.secret.values.yaml
- name: binderhub-ui-demo
display_name: "2i2c Binderhub UI demo"
domain: hub.binderhub-ui-demo-demo.2i2c.cloud
domain: hub.binderhub-ui-demo.2i2c.cloud
helm_chart: basehub
helm_chart_values_files:
- basehub-common.values.yaml
Expand Down
3 changes: 2 additions & 1 deletion config/clusters/2i2c/ucmerced.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jupyterhub:
kubespawner_override:
# From https://github.com/SaiUCM/example-inherit-from-community-image
# See https://2i2c.freshdesk.com/a/tickets/1612
image: quay.io/cirt_ucm/jupyter-scipy-xarray:afab6a519d8b
# See https://2i2c.freshdesk.com/a/tickets/1771
image: quay.io/cirt_ucm/jupyter-scipy-xarray:254e773d6003
# Launch into JupyterLab after the user logs in
default_url: /lab
- display_name: R
Expand Down
5 changes: 5 additions & 0 deletions config/clusters/earthscope/common.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ basehub:
kubespawner_override:
image: "{value}"
choices:
geolab-general:
display_name: GeoLab
slug: geolab-general
kubespawner_override:
image: public.ecr.aws/earthscope-dev/geolab:td-dev-dd5851e6
jupyter-scipy:
display_name: Jupyter
slug: jupyter-scipy
Expand Down
1 change: 1 addition & 0 deletions config/clusters/nasa-ghg/common.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ basehub:
- j08lue
- slesaad
- Jeanne-le-Roux
- amarouane-ABDELHAK
singleuser:
defaultUrl: /lab
profileList:
Expand Down
2 changes: 2 additions & 0 deletions config/clusters/nasa-veda/common.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ basehub:
authenticator_class: github
GitHubOAuthenticator:
allowed_organizations:
- CASI-LIS-Dashboard:dev-veda-jupyterhub
- veda-analytics-access:all-users
- veda-analytics-access:collaborator-access
- CYGNSS-VEDA:cygnss-iwg
Expand All @@ -60,6 +61,7 @@ basehub:
- jsignell
- slesaad
- wildintellect
- amarouane-ABDELHAK
singleuser:
defaultUrl: /lab
initContainers:
Expand Down
2 changes: 1 addition & 1 deletion config/clusters/projectpythia/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hubs:
- enc-prod.secret.values.yaml
- name: pythia-binder
display_name: Binder for use with Project Pythia
domain: binder.pythia.2i2c.cloud
domain: hub.binder.pythia.2i2c.cloud
helm_chart: basehub
helm_chart_values_files:
- common.values.yaml
Expand Down
28 changes: 27 additions & 1 deletion config/clusters/projectpythia/pythia-binder.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,33 @@ jupyterhub:
# The profile list in the common values files needs to be emptied
# otherwise the launching will fail
profileList: []
cmd: jupyter-lab
cmd:
- python3
- "-c"
- |
import os
import sys
try:
import jupyterlab
import jupyterlab.labapp
major = int(jupyterlab.__version__.split(".", 1)[0])
except Exception as e:
print("Failed to import jupyterlab: {e}", file=sys.stderr)
have_lab = False
else:
have_lab = major >= 3
if have_lab:
# technically, we could accept another jupyter-server-based frontend
print("Launching jupyter-lab", file=sys.stderr)
exe = "jupyter-lab"
else:
print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr)
exe = "jupyter-notebook"
# launch the notebook server
os.execvp(exe, sys.argv)
hub:
config:
BinderSpawnerMixin:
Expand Down
28 changes: 27 additions & 1 deletion config/clusters/templates/common/binderhub-ui-hub.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,33 @@ jupyterhub:
initContainers: []
profileList: []
{% if authenticator == "none" %}
cmd: jupyter-lab
cmd:
- python3
- "-c"
- |
import os
import sys
try:
import jupyterlab
import jupyterlab.labapp
major = int(jupyterlab.__version__.split(".", 1)[0])
except Exception as e:
print("Failed to import jupyterlab: {e}", file=sys.stderr)
have_lab = False
else:
have_lab = major >= 3
if have_lab:
# technically, we could accept another jupyter-server-based frontend
print("Launching jupyter-lab", file=sys.stderr)
exe = "jupyter-lab"
else:
print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr)
exe = "jupyter-notebook"
# launch the notebook server
os.execvp(exe, sys.argv)
{% endif %}
hub:
{% if authenticator == "none" %}
Expand Down
22 changes: 18 additions & 4 deletions deployer/commands/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ def deploy_support(
cert_manager_version: str = typer.Option(
"v1.12.1", help="Version of cert-manager to install"
),
debug: bool = typer.Option(
False,
"--debug",
help="When present, the `--debug` flag will be passed to the `helm upgrade` command.",
),
):
"""
Deploy support components to a cluster
Expand All @@ -87,7 +92,9 @@ def deploy_support(

if cluster.support:
with cluster.auth():
cluster.deploy_support(cert_manager_version=cert_manager_version)
cluster.deploy_support(
cert_manager_version=cert_manager_version, debug=debug
)


@app.command()
Expand Down Expand Up @@ -165,7 +172,7 @@ def run_hub_health_check(
print_colour("ERROR: No hubs with this name found!")
sys.exit(1)

# Skip the regular hub health check for hubs with binderhub ui that are also launching user servers
# Skip the regular hub health check for hubs with binderhub ui that are not authenticated
for values_file_name in hub.spec["helm_chart_values_files"]:
if not any(
substr in os.path.basename(values_file_name)
Expand All @@ -179,10 +186,17 @@ def run_hub_health_check(
.get("binderhubUI", {})
.get("enabled")
)
authentication = (
config.get("jupyterhub", {})
.get("hub", {})
.get("config", {})
.get("JupyterHub", {})
.get("authenticator_class", "")
)

if binderhub_ui:
if binderhub_ui and authentication == "null":
print_colour(
f"Skipping hub health check for {hub.spec['name']} because it's a binderhub...",
f"Testing {hub.spec['name']} is not yet supported. Skipping ...",
"yellow",
)
return
Expand Down
5 changes: 4 additions & 1 deletion deployer/infra_components/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def auth(self):
else:
raise ValueError(f'Provider {self.spec["provider"]} not supported')

def deploy_support(self, cert_manager_version):
def deploy_support(self, cert_manager_version, debug):
cert_manager_url = "https://charts.jetstack.io"

print_colour("Provisioning cert-manager...")
Expand Down Expand Up @@ -94,6 +94,9 @@ def deploy_support(self, cert_manager_version):
for values_file in values_files:
cmd.append(f"--values={values_file}")

if debug:
cmd.append("--debug")

print_colour(f"Running {' '.join([str(c) for c in cmd])}")
subprocess.check_call(cmd)

Expand Down
30 changes: 28 additions & 2 deletions docs/howto/features/binderhub-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,40 @@ jupyterhub:

#### 6. Check the singleuser cmd that is used

If the binderhub will be unauthenticated, then we need to replace `jupyterhub.singleuser.jupyterhub-singleuser` with `jupyterhub.singleuser.jupyter-lab`.
If the binderhub will be unauthenticated, then we need to replace `jupyterhub.singleuser.jupyterhub-singleuser` with `jupyterhub.singleuser.jupyter-lab` if available or `jupyterhub.singleuser.jupyter-notebook`.

Otherwise the requests to authorize the user server will get redirected to `/hub/login` which always returns a `403` HTTP response code when using the null authenticator.

```yaml
jupyterhub:
singleuser:
cmd: jupyter-lab
cmd:
- python3
- "-c"
- |
import os
import sys
try:
import jupyterlab
import jupyterlab.labapp
major = int(jupyterlab.__version__.split(".", 1)[0])
except Exception as e:
print("Failed to import jupyterlab: {e}", file=sys.stderr)
have_lab = False
else:
have_lab = major >= 3
if have_lab:
# technically, we could accept another jupyter-server-based frontend
print("Launching jupyter-lab", file=sys.stderr)
exe = "jupyter-lab"
else:
print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr)
exe = "jupyter-notebook"
# launch the notebook server
os.execvp(exe, sys.argv)
```

#### 7. Restrict the repositories that can be built
Expand Down
2 changes: 1 addition & 1 deletion docs/hub-deployment-guide/new-cluster/new-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ If you can't find the workspace you're looking for, double check you've enabled
## Plan and Apply Changes

```{important}
When deploying to Google Cloud, make sure the [Compute Engine](https://console.cloud.google.com/apis/library/compute.googleapis.com), [Kubernetes Engine](https://console.cloud.google.com/apis/library/container.googleapis.com), [Artifact Registry](https://console.cloud.google.com/apis/library/artifactregistry.googleapis.com), and [Cloud Logging](https://console.cloud.google.com/apis/library/logging.googleapis.com) APIs are enabled on the project before deploying!
When deploying to Google Cloud, make sure the [Compute Engine](https://console.cloud.google.com/apis/library/compute.googleapis.com), [Kubernetes Engine](https://console.cloud.google.com/apis/library/container.googleapis.com), [Artifact Registry](https://console.cloud.google.com/apis/library/artifactregistry.googleapis.com), [Cloud Filestore](https://console.cloud.google.com/apis/library/file.googleapis.com), and [Cloud Logging](https://console.cloud.google.com/apis/library/logging.googleapis.com) APIs are enabled on the project before deploying!
```

First, make sure you are in the new workspace that you just created.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ All of the following steps must be followed in order to consider phase 3.1 compl
Please pay attention to all the fields that have been auto-generated for you by this command and change every one that doesn't match the community's requirements or was not rendered correctly before copying-pasting it into the relevant files.
```
```{important}
If you are deploying a binderhub ui style hub, then make sure that in the `cluster.yaml` file **the hub's domain** is entered instead of the binderhub's, for testing purposes.
```
1. **Add the new cluster to CI/CD**
```{important}
Expand Down

0 comments on commit 02b008a

Please sign in to comment.