The 2i2c hubs use a custom hub image that is defined in the helm-charts directory of the infrastructure repository.
The hub image¶
This custom hub image is built on top of the jupyterhub/k8s-hub Docker image and configured based on the needs of 2i2c hubs.
This allows adding and configuring other packages like the jupyterhub
The experimental hub images¶
In addition to the hub image, there are also experimental hub images, that are defined alongside the main hub image in the helm-charts directory of the infrastructure repository, through individual requirements.txt files, named after the experiment that’s being performed.
The experimental hub images and the main hub image are quite similar. They are based off the same Dockerfile, but use different requirements.txt files, because their primary goal is to be used to test changes like new packages, newer package versions, or even unreleased or unmerged versions of them. They are used to deploy such changes just to one or a few specific communities, without having to worry about the instabilities they can generate for other communities.
When to roll out the changes in the experimental images to hub¶
The workflow is the following:
How to create a new hub experimental image¶
You will first need to create a new
.txtfile with a name relevant for the experiment, let’s saynew-experiment-requirements.txt.Then,
chartpressmust be instructed to create a new docker image using thenew-experiment-requirements.txtTo do this, edit thechartpress.yamlfile located at the root of thehelm-chartes/imagesdirectory to add another image under thebasehubchart:
new-experiment:
imageName: quay.io/2i2c/new-experiment
buildArgs:
REQUIREMENTS_FILE: "new-experiment-requirements.txt"
contextPath: "images/hub"
dockerfilePath: images/hub/DockerfileGo to https://
quay .io /new/ and create a new public repository using your 2i2corganizational account. Name it the same with the suffix of the name set underimageNamefromchartpress.yaml. In this example isnew-experiment.
How to install an unreleased version of a package in an experimental hub image¶
To install an unreleased package, we will need to install directly from GitHub and not from PyPI:
Identify the package and commit you wish to install into the hub image
https://github.com/jupyterhub/kubespawner@def501f1d60b8e5629745acb0bcc45b151b1deccUpdate the
.txtfile of this specific experiment, let’s saynew-experiment-requirements.txt, to add this package and commit, prefixed by agit+on a new rowgit+https://github.com/jupyterhub/kubespawner@def501f1d60b8e5629745acb0bcc45b151b1deccCommit the changes
git add helm-charts/images/hub/new-experiment-requirements.txt git commit
How to build and push a new version of the available hub images¶
Rebuild the Docker image and push it to the Quay.io registry
Your
@2i2caddress should give you access to push to the Quay.io registry where the hub image lives, but make sure you are logged into quay.io container registry with the right credentials and these creds are configured to have access to https://quay .io /repository /2i2c /pilot -hub. Please contact someone at 2i2c for access if this is not the case. docker login quay.ioMake sure you have jupyterhub
/chartpress installed. pip install chartpressThis package is also listed under the
devextra in pyproject.toml`, so it should be present if you’ve installed the dev dependencies.Make sure you are in the
helm-chartsdirectory, where thechartpress.yamlis located:cd ./helm-chartsRun chartpress to build the image, push it to the registry and update the basehub helm chart to use the updated image tag
chartpress --pushIf building and pushing the
hubimage, then commit the changes made bychartpresstohelm-charts/basehub/values.yaml, but discard the changes made tohelm-charts/basehub/Chart.yamlas the last may cause problems with thedaskhubdependency mechanism.git add helm-charts/basehub/values.yaml git commitIf building and pushing any of the experimental images, then discard the changes to both
helm-charts/basehub/values.yamlandhelm-charts/basehub/Chart.yaml, because we only want to deploy this image to particular hubs
How to configure a hub to use an experimental new image¶
You will need to put a config similar to the one below in your hub configuration file:
hub:
image:
name: quay.io/2i2c/new-experiment
tag: "0.0.1-0.dev.git.8663.h049aa2c2"