An endpoint's jupyter-kernel-overrides gives a kernel its own
container-image ("Custom kernel image with interactive endpoint"), and
on EMR on EKS each kernel is a pod of its image. A Floci endpoint ran
every kernel in its gateway's container, whatever image the overrides
named.
- The gateway job tells the gateway program which kernels the
overrides give an image (python3 and spark-python-kubernetes, the
kernels the guide's example names, as "You can't add new kernel image
types"), where it asks Floci for their containers, and a secret Floci
gives that gateway alone.
- EmrContainersKernelContainersRoute takes the gateway's POST and
DELETE on /_aws/emr-containers/kernel-containers/<endpoint>/<kernel>.
The service checks the secret, that the endpoint is ACTIVE and its
overrides give the kernel an image, and the kernel id, response
address and public key, then EmrContainersKernelContainers runs the
kernel's container: the override image, with the gateway's settings
and environment and the kernel's KERNEL_ variables, running the
image's Jupyter Enterprise Gateway launcher (launch_ipykernel.py),
under spark-submit with the %%configure magic for a PySpark kernel.
A launch is admitted under the lock the gateway's end takes, so an
endpoint's kernel containers all stop with its gateway, and a reset
or Floci's shutdown stops every one.
- The gateway program gives such a kernel a jupyter_client provisioner
that speaks the launcher's protocol: it asks Floci for the container
with an RSA public key and a response address, decrypts the
connection the launcher sends back (an AES key, under RSA, over
AES-GCM), and polls, signals and stops the kernel through the
launcher's comm port and Floci. It waits KERNEL_LAUNCH_TIMEOUT
seconds, at most the guide's 400, or 400, and a launch that fails
once the container was asked for stops it.
- Such a kernel's %%configure magic posts to its ENDPOINT_IP, the
gateway, on port 9547 over TLS, with a certificate the image's openssl
makes; the program checks it with the launcher's AES key, which each
launch refreshes. Every restart, the kernels API's, the
auto-restarter's or %%configure's, gives the kernel a new container
with new ports and a new key, and the program moves the kernel's
clients and its activity watch onto them.
- The nightly check gains a method: an endpoint that overrides both
kernels with the release's own image runs each in its own container,
the PySpark one counting an S3 file's lines and taking %%configure.
The docker-runner group's budget grows by its eighteen minutes.