SealSkin

KubernetesProvider

Launches applications as pods in the server's namespace.

Attributes

attributeorphan_grace
= PENDING_TIMEOUT + BaseProvider.orphan_grace

Functions

funcinspect_self() -> None

Read the server's own pod: its volumes, labels, and owner.

Session storage is resolved against these mounts, so a server path on a volume sessions cannot share is reported here once.

Returns

None
func_volume_for(server_path) -> tuple[dict[str, Any], str] | None

Return the server volume holding server_path and the subPath inside it.

paramserver_pathstr

Returns

tuple[dict[str, typing.Any], str] | None
func_node_bound(volume) -> bool

Tell whether only the server's node can mount this volume alongside the server.

paramvolumedict[str, Any]

Returns

bool
funcdetect_gpus() -> None

Offer the GPUs sessions can request.

PodTemplates labelled sealskin.app/gpu are the options when the namespace has any, each carrying what its GPU needs (a device plugin resource or a DRA claim, node placement); refresh_gpus reads them again whenever the options are offered or used. Otherwise, as nodes are cluster-scoped: the GPU resources schedulable nodes advertise or DRA device classes map, when the server may list them; else those the namespace's quota grants; else the GPUs of the server's own node. Resources a quota covering session pods caps at zero are left out, GPUs handed to virtual machines are skipped, and nodes labelled with their GPUs' model are offered per model. The cluster is scanned once, when the templates are first found missing.

Returns

None
funcrefresh_gpus() -> None

Offer the namespace's GPU PodTemplates as they are now, else the scanned GPUs.

The options offered stand when the templates cannot be listed for any reason but the Role withholding them, so an API server that is slow or restarting neither holds up the launcher nor swaps the templates for the scanned GPUs.

Returns

None
func_scan_gpus() -> list[dict[str, Any]]

Return the GPUs the cluster's nodes and device classes, the quota, or this node offer.

Returns

list[dict[str, typing.Any]]
funcget_local_image_info(image_name) -> dict[str, Any] | None

Return the digest sessions run for an image, once one was pinned.

paramimage_namestr

Returns

dict[str, typing.Any] | None
funcget_remote_image_digest(image_name) -> str | None

Return the digest the image's registry serves now.

paramimage_namestr

Returns

str | None
funcpull_image(image_name) -> Any

Pin the registry's current digest; nodes pull it when a session needs it.

paramimage_namestr

Returns

typing.Any
funcprune_images() -> None

Leave unused images to the kubelet's image garbage collection.

Returns

None
funcregistry_credentials() -> dict[str, tuple[str, str]]

Return the credentials of the pull secrets the session template names, read again each minute.

Returns

dict[str, tuple[str, str]]
funcexport_web_client(image, path) -> bytes

Run tar in a pod of the image and read what it wrote from the pod's log (see BaseProvider).

A log is text, so the pod writes the stream in base64. The pod takes the session template's placement and pull secrets, nothing else.

paramimagestr
parampathstr

Returns

bytes
func_pod_manifest(session_id, env_vars, volumes, gpu_config, template=None, vpn=None) -> dict[str, Any]

Build the session pod over the namespace's session template.

The app's and its template's Docker run options are mapped onto the pod; the PodTemplate's container named app, or its first, is the base of the session container. What NVIDIA sessions get by default, the nvidia RuntimeClass and every driver capability, yields to the templates' own choice. With vpn, a native sidecar from the gateway image joins the pod (see app.vpn_kube): it makes the hub the pod's default route before the app starts, and the pod resolves names at the hub.

paramsession_idstr
paramenv_varsdict[str, str]
paramvolumesdict[str, Any] | None
paramgpu_configdict[str, Any] | None
paramtemplatedict[str, Any] | None
= None
paramvpndict[str, Any] | None
= None

Returns

dict[str, typing.Any]
func_pod_template(name='') -> dict[str, Any] | None

Return the pod template of a PodTemplate, <owner>-session by default, or None without one.

paramnamestr
= ''

Returns

dict[str, typing.Any] | None
func_create(session_id, manifest) -> dict[str, Any]

Create the pod, dropping the nvidia RuntimeClass where the cluster has none.

paramsession_idstr
parammanifestdict[str, Any]

Returns

dict[str, typing.Any]
func_wait_running(session_id, name) -> str

Wait until the pod runs and has an address.

paramsession_idstr
paramnamestr

Returns

str
funclaunch(session_id, env_vars, volumes=None, gpu_config=None, network=None, is_collaboration=False, master_token=None, initial_tokens=None, vpn=None) -> dict[str, Any]

Create the session pod and wait until its web endpoint answers.

The pod is built over the session template, the PodTemplate the app's template names, and the GPU option's PodTemplate, laid over one another in that order, so the GPU a user picked wins over the application's defaults. See BaseProvider.launch for the arguments; network has no meaning here.

paramsession_idstr
paramenv_varsdict[str, str]
paramvolumesdict[str, Any] | None
= None
paramgpu_configdict[str, Any] | None
= None
paramnetworkstr | None
= None
paramis_collaborationbool
= False
parammaster_tokenstr | None
= None
paraminitial_tokensdict[str, Any] | None
= None
paramvpndict[str, Any] | None
= None

Returns

dict[str, typing.Any]
funcstop(instance_id) -> None

Delete a session pod and wait until it is gone, as a Docker stop does.

paraminstance_idstr

Pod name.

Returns

None
funcis_running(instance_id) -> bool

Tell whether a pod exists, is not being deleted, and has not terminated.

paraminstance_idstr

Returns

bool
funcmanaged_instances() -> dict[str, float]

Return this server's session pods with their creation times.

Returns

dict[str, float]