Internal Nublado API#
The Nublado controller and the command-line tools are built as a Docker image intended for deployment in a Kubernetes cluster using Phalanx and is not supported as an installed Python module. This documentation therefore exists only to assist developers and code analysis and does not define a supported API.
nublado.config.base Module#
Pydantic settings class that prioritizes environment variables.
Classes#
Base class for Pydantic settings with environment overrides. |
Class Inheritance Diagram#

nublado.config.images Module#
Configuration for the image management command-line tool.
Classes#
Configuration for a Docker source. |
|
Configuration for a Google Artifact Registry source. |
|
Configuration for Nublado image management. |
Variables#
Type alias. |
Class Inheritance Diagram#

nublado.constants Module#
Constants for Nublado. Overrideable for testing.
Variables#
Name of environment variable specifying Slack alert webhook. |
|
Default path to the Docker API secrets. |
|
Prefix for environment variables governing Nublado behavior. |
|
How long to wait between Google Artifact Registry retries. |
|
How many total times to attempt Google Artifact Registry calls. |
|
Root logger name. |
nublado.controller.background Module#
Nublado controller background processing.
Classes#
|
Manage Nublado controller background tasks. |
Class Inheritance Diagram#

nublado.controller.config Module#
Global configuration parsing.
Classes#
Source of a volume to be mounted in the lab. |
|
Nublado controller configuration. |
|
Docker image that may be run as a container. |
|
Configuration when user file servers are disabled. |
|
|
Where space for emptyDirs (e.g. |
Empty directory shared between all Pod containers. |
|
Configuration for enabled user file servers. |
|
Configuration for filesystem administration environment. |
|
Base configuration for user file servers. |
|
Path on Kubernetes node to mount in the container. |
|
Configuration for spawning user labs. |
|
A container to run as an init container before the user's lab. |
|
Rules for |
|
A secret to make available to lab containers. |
|
Possible size of lab. |
|
NFS volume to mount in the container. |
|
Resources for a persistent volume claim. |
|
A PVC to create to materialize the volume to mount in the container. |
|
Configuration for the prepuller. |
|
|
Algorithm for building a user's home directory path. |
A volume that may be mounted inside a container. |
|
The mount of a volume inside a container. |
Class Inheritance Diagram#

nublado.controller.constants Module#
Global constants.
Variables#
Annotations to add to most created objects. |
|
Default path to controller configuration. |
|
Default path to the Docker API secrets. |
|
Used in the lab form for |
|
Regex matching all valid group names. |
|
Pattern matching valid Kubernetes names. |
|
How long to wait for generic sequences of Kubernetes API calls. |
|
Ratio of maximum memory size to maximum size of |
|
Default path to injected pod metadata. |
|
Environment variables reserved to the controller or JupyterHub. |
|
Paths within the lab that are reserved for special purposes. |
|
Regex matching all valid usernames. |
nublado.controller.dependencies.config Module#
Config dependency.
Classes#
|
Dependency to manage a cached Nublado controller configuration. |
Variables#
The dependency that will return the global configuration. |
Class Inheritance Diagram#

nublado.controller.dependencies.context Module#
Request context management.
ContextDependency is an all-in-one dependency, because managing individual
dependencies turned out to be a real pain. It’s designed to capture the
context of any request. It requires that a Config
object has been loaded before it can be instantiated.
Classes#
Provide a per-request context as a FastAPI dependency. |
|
|
Holds the incoming request and its surrounding context. |
Variables#
The dependency that will return the per-request context. |
Class Inheritance Diagram#

nublado.controller.dependencies.user Module#
User and authentication dependencies for FastAPI.
Functions#
|
Return the validated user for the given request. |
|
Validate and return the username in the request path. |
nublado.controller.events Module#
Metrics events for the Nublado controller.
Classes#
Current count of the number of active labs. |
|
Event publishers for Nublado controller events about labs. |
|
Common lab metadata for events. |
|
A lab spawn failed. |
|
A lab spawn succeeded. |
Class Inheritance Diagram#

nublado.controller.exceptions Module#
Exceptions for the Nublado lab controller.
Classes#
|
Wraps |
|
Multiple Kubernetes objects were found when one was expected. |
|
Unable to parse the reply from Gafaelfawr. |
|
An API call to Gafaelfawr failed. |
|
The user's quota is insufficient to satisfy this request. |
|
Docker reference does not contain a tag. |
|
The provided lab size is not one of the configured sizes. |
|
The pod was not in a valid phase. |
|
The delegated user token is invalid. |
|
An API call to Kubernetes failed. |
|
An error occurred when deleting a lab. |
|
Lab creation was attempted for a user with an active lab. |
|
An expected Kubernetes object is missing. |
|
Secret specified in the controller configuration was not found. |
|
No operation was in progress when attempting to wait. |
|
An attempt was made to use a disabled service. |
|
Attempt to perform an operation when another is in progress. |
|
Attempt to access a restricted resource. |
|
Pod could not be found. |
|
Cannot find a Docker image matching the requested parameters. |
|
No resource has been created for this user. |
Class Inheritance Diagram#

nublado.controller.factory Module#
Component factory and global and per-request context management.
Classes#
|
Build lab controller components. |
|
Per-process global application state. |
Class Inheritance Diagram#

nublado.controller.main Module#
The main application factory for the Nublado controller service.
Functions#
|
Create the FastAPI application. |
nublado.controller.models.domain.docker Module#
Domain models for talking to the Docker API.
Classes#
|
Parses a Docker reference. |
Class Inheritance Diagram#

nublado.controller.models.domain.fileserver Module#
Models for the fileserver state.
Classes#
|
All of the Kubernetes objects making up a user's fileserver. |
|
Kubernetes objects used for inspecting the state of a fileserver. |
Class Inheritance Diagram#

nublado.controller.models.domain.fsadmin Module#
Models for the file system admin pod state.
Classes#
|
All of the Kubernetes objects making up an fsadmin instance. |
Class Inheritance Diagram#

nublado.controller.models.domain.gafaelfawr Module#
Models for talking to Gafaelfawr.
Classes#
User information from Gafaelfawr supplemented with the user's token. |
Class Inheritance Diagram#

nublado.controller.models.domain.image Module#
Internal models returned by image service methods.
Classes#
A single spawnable image. |
|
All available spawnable images. |
|
|
Cached data about a Kubernetes node. |
Class Inheritance Diagram#

nublado.controller.models.domain.kubernetes Module#
Data types for interacting with Kubernetes.
Classes#
Pod affinity rules. |
|
|
Protocol for Kubernetes object models. |
|
A cached image on a Kubernetes node. |
Rule for matching labels of pods or namespaces. |
|
|
Match operations for label selectors. |
Single rule for label matching. |
|
Node affinity rules. |
|
Matching terms for nodes. |
|
|
Match operations for node selectors. |
Individual match rule for nodes. |
|
Term to match nodes. |
|
|
Whether a single node is tolerated. |
Pod affinity rules. |
|
Base class for pod affinity rules. |
|
Pod matching term for pod affinity. |
|
Pod anti-affinity rules. |
|
|
Represents a change (not creation or deletion) of a pod. |
|
One of the valid phases reported in the status section of a Pod. |
Scheduling term with a weight, used to find preferred nodes. |
|
|
Possible values for the |
|
Pull policy for Docker images in Kubernetes. |
|
Possible effects of a pod toleration. |
Represents a single pod toleration rule. |
|
|
Possible operators for a toleration. |
|
Access mode for a persistent volume. |
|
Possible values of the |
Pod matching term for pod affinity with an associated weight. |
Class Inheritance Diagram#

nublado.controller.models.domain.lab Module#
Internal models related to user labs.
Classes#
One lab operation event for a user. |
|
|
Type of message. |
|
Names for the key Kubernetes objects making up a user's lab. |
|
All of the Kubernetes objects making up a user's lab. |
|
All of the Kubernetes objects required to reconstruct lab state. |
Class Inheritance Diagram#

nublado.controller.models.domain.volumes Module#
Models for mounted volumes.
Classes#
|
Represents a volume along with its corresponding mount. |
Class Inheritance Diagram#

nublado.controller.models.index Module#
Top-level request models for the Nublado controller.
Classes#
Metadata returned by the external root URL of the application. |
Class Inheritance Diagram#

nublado.controller.models.v1.fileserver Module#
API-visible models for user file servers.
Classes#
Status of a user's file server. |
Class Inheritance Diagram#

nublado.controller.models.v1.fsadmin Module#
API-visible model for fsadmin.
Classes#
Command to start the file system admin pod. |
|
Status for a running file system admin pod. |
Class Inheritance Diagram#

nublado.controller.models.v1.lab Module#
API-visible models for user lab environments.
Classes#
Options shared by both the input and output model for lab options. |
|
|
Supported classes of images. |
Options for the lab, specified at creation time. |
|
User-provided lab configuration options. |
|
Resource requests and limits for a lab. |
|
|
Allowable names for pod sizes. |
Specification of lab to spawn, sent by the JupyterHub spawner. |
|
Current state of the user's lab. |
|
|
Possible states the user's lab may be in. |
A Kubernetes resource request or limit. |
|
Group membership. |
|
Metadata about the user who owns the lab. |
Class Inheritance Diagram#

nublado.controller.models.v1.prepuller Module#
Models for prepuller.
Classes#
A single Docker image that is available or prepulled. |
|
Information about available images on a single Kubernetes node. |
|
An available image present on at least some Kubernetes nodes. |
|
Used to display available images. |
|
Status of the images being prepulled. |
|
Options for the prepuller. |
|
Status of the image prepuller. |
|
Images known to the Nublado controller and available for spawning. |
Class Inheritance Diagram#

nublado.controller.services.builder.fileserver Module#
Construction of Kubernetes objects for user fileservers.
Classes#
|
Construct Kubernetes objects for user file servers. |
Class Inheritance Diagram#

nublado.controller.services.builder.fsadmin Module#
Construction of Kubernetes objects for user fileservers.
Classes#
|
Construct Kubernetes objects for file system administrative pods. |
Class Inheritance Diagram#

nublado.controller.services.builder.lab Module#
Construction of Kubernetes objects for user lab environments.
Classes#
|
Construct Kubernetes objects for user lab environments. |
Class Inheritance Diagram#

nublado.controller.services.builder.prepuller Module#
Construct Kubernetes objects used by the prepuller.
Classes#
|
Construct Kubernetes objects used by the prepuller. |
Class Inheritance Diagram#

nublado.controller.services.builder.volumes Module#
Construction of Kubernetes objects for volumes and volume mounts.
Classes#
Construct Kubernetes objects for volumes and volume mounts. |
Class Inheritance Diagram#

nublado.controller.services.fileserver Module#
Service to manage user fileservers.
Classes#
|
Manage user file servers. |
Class Inheritance Diagram#

nublado.controller.services.fsadmin Module#
Service to manage administrative filesystem environment.
Classes#
|
Manage filesystem admin environment. |
Class Inheritance Diagram#

nublado.controller.services.image Module#
Container image service.
Classes#
|
Service to track the available images for Jupyter labs. |
Class Inheritance Diagram#

nublado.controller.services.lab Module#
Service to manage user lab environments.
Classes#
|
Manage user labs. |
Class Inheritance Diagram#

nublado.controller.services.prepuller Module#
Prepull images to Kubernetes nodes.
Classes#
|
Prepull images to Kubernetes nodes. |
Class Inheritance Diagram#

nublado.controller.services.source.base Module#
Base class for image sources.
Classes#
|
Base class for image sources. |
Class Inheritance Diagram#

nublado.controller.services.source.docker Module#
Image source using a Docker Registry.
Classes#
|
Image source using a Docker Registry. |
Class Inheritance Diagram#

nublado.controller.services.source.gar Module#
Image source using a Google Artifact Registry.
Classes#
|
Image source using a Google Artifact Registry. |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.creator Module#
Generic Kubernetes object storage supporting only create and read.
Provides a generic Kubernetes object management class and instantiations of that class for Kubernetes object types that only support create and read. This is sufficient for a lot of object types the lab controller manipulates. Storage classes for object types that only need those operations are provided here.
For object types that need to support other operations, see
KubernetesObjectDeleter, which
subclasses KubernetesObjectCreator and adds list and delete support, and its
subclasses.
Classes#
|
Storage layer for |
|
Generic Kubernetes object storage supporting create and read. |
|
Storage layer for |
|
Storage layer for |
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.custom Module#
Storage layer for Kubernetes custom objects objects.
Classes#
|
Storage layer for Kubernetes custom objects. |
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.deleter Module#
Generic Kubernetes object storage including list and delete.
Provides a generic Kubernetes object management class and instantiations of that class for Kubernetes object types that support list and delete (as well as create and read, provided by the superclass). Storage classes for object types that only need those operations are provided here; more complex storage classes with other operations are defined in their own modules.
Classes#
|
Storage layer for |
|
Generic Kubernetes object storage supporting list and delete. |
|
Storage layer for |
|
Storage layer for |
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.fileserver Module#
Kubernetes storage layer for user fileservers.
Classes#
|
Kubernetes storage layer for file servers. |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.fsadmin Module#
Kubernetes storage layer for filesystem administration pod.
Classes#
|
Kubernetes storage layer for a filesystem admin pod. |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.ingress Module#
Storage layer for Ingress objects.
Functions#
|
Check whether an ingress has an IP address assigned. |
Classes#
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.lab Module#
Kubernetes storage layer for user labs.
Classes#
|
Kubernetes storage layer for user labs. |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.namespace Module#
Storage layer for Namespace objects.
Classes#
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.node Module#
Storage layer for Kubernetes node objects.
Classes#
|
Storage layer for Kubernetes node objects. |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.pod Module#
Storage layer for Pod objects.
Classes#
|
Storage layer for |
Class Inheritance Diagram#

nublado.controller.storage.kubernetes.watcher Module#
Watch a Kubernetes namespace or cluster for events.
Classes#
|
Watch Kubernetes for events. |
|
Parsed event from a Kubernetes watch. |
Class Inheritance Diagram#

nublado.controller.storage.metadata Module#
Storage layer for pod metadata.
Classes#
|
Storage layer for pod metadata for the running pod. |
Class Inheritance Diagram#

nublado.controller.templates Module#
Template management.
Provides a shared Jinja template environment used whenever the Nublado controller generates responses based on templates.
Variables#
The template manager. |
nublado.controller.timeout Module#
Timeout class for Kubernetes operations.
Classes#
|
Track a cumulative timeout on a series of operations. |
Class Inheritance Diagram#

nublado.controller.units Module#
Unit conversions for the Nublado controller.
Functions#
|
Convert a number of bytes into a human-readable SI string. |
|
Convert a Kubernetes CPU resource value to a float number of cores. |
|
Convert a string representation of memory to a number of bytes. |
nublado.exceptions Module#
Exceptions used by Nublado.
Classes#
|
An API call to a Docker Registry failed. |
|
An invalid link was encountered while retrieving tag results. |
Class Inheritance Diagram#

nublado.factory Module#
Factories for Nublado tools.
Classes#
|
Factory for Nublado image management. |
Class Inheritance Diagram#

nublado.inithome.provisioner Module#
Provisioner for user home directories.
Classes#
The home directory already exists but is not acceptable. |
|
|
Create the user's home directory if it doesn't exist. |
Class Inheritance Diagram#

nublado.landingpage.exceptions Module#
Exceptions for the CST landing page provisioner.
Classes#
The destination target exists and cannot be replaced safely. |
|
The destination target exists and is a directory. |
|
Initial input-files-and-home-directory sanity check failed. |
Class Inheritance Diagram#

nublado.landingpage.provisioner Module#
A tool to set up user directories to hold what will be the default page for “science” sites, to allow those sites to load a tutorial document on startup.
It has two phases: first, it creates copies of the landing page and supporting files, and second, if the user default for opening the file is not the Markdown Viewer already, it writes out configuration for that.
The files must be somewhere that the Notebook container can open them, and must be writeable files (not symlinks to a read-only target) if the Save-All or Save-And-Quit functionality is to work.
The tool is expected to be running in the context of the current user, as part of an initContainer running after the user home directories are provisioned, but before the user lab container begins to start.
Classes#
|
Ensure user environment is ready to open tutorial landing page. |
Class Inheritance Diagram#

nublado.models.docker Module#
Models for managing Docker credentials.
Classes#
|
Read and write the |
|
Holds the credentials for one Docker API server. |
Class Inheritance Diagram#

nublado.models.images Package#
Models for referring to and managing Nublado lab images.
Classes#
Docker Registry from which to get images. |
|
Google Artifact Registry from which to get images. |
|
Policy for images to display within a given category. |
|
Configuration for display of RSP images. |
|
|
A tagged Rubin Science Platform image. |
|
Provides operations on a collection of |
|
A sortable image tag for a Rubin Science Platform image. |
|
Hold and perform operations on a set of |
|
The type (generally, release series) of the identified image. |
Variables#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
Type alias. |
Class Inheritance Diagram#

nublado.purger.config Module#
Application configuration for the purger.
Classes#
Configuration for the purger. |
|
Base class for Pydantic settings with environment overrides. |
Class Inheritance Diagram#

nublado.purger.constants Module#
Constants for rsp-scratchpurger. Overrideable for testing.
Variables#
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
Path subclass for non-Windows systems. |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
|
Path subclass for non-Windows systems. |
|
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str |
nublado.purger.exceptions Module#
Exceptions for the purger.
Classes#
|
An operation needing a Plan was requested, but no Plan is ready. |
|
A purge encountered errors. |
Class Inheritance Diagram#

nublado.purger.models.plan Module#
Object representing files to be purged, and why.
Classes#
|
Whether a file is large or small. |
|
Whether a file is to be purged on access, creation, or modification time grounds. |
A file to be purged, and why. |
|
List of files to be purged, and why. |
Class Inheritance Diagram#

nublado.purger.models.v1.policy Module#
Model for purger policy.
Classes#
Policy for purging objects from a directory and its children. |
|
Intervals specify how long it must have been since a filesystem object was accessed, created, or modified before that object will be considered for purging. |
|
|
Utility for intermediate results in HumanSizeBytes conversion. |
Policy for purging objects across multiple directory trees. |
|
Container to hold intervals for purging large and small files. |
Variables#
Parse an input indicating a number of bytes into an int. |
Class Inheritance Diagram#

nublado.purger.purger Module#
The Purger class provides mechanisms for setting its policy, planning actions according to its policy, reporting its plans, and executing its plans.
Classes#
|
Object to plan and execute filesystem purges. |
Class Inheritance Diagram#

nublado.services.images Package#
Image managers for different backends.
Classes#
|
Manage Nublado images using the Docker API. |
|
Manage Nublado images using the Google Artifact Registry API. |
Base class defining the shared API for images managers. |
Class Inheritance Diagram#

nublado.startup.constants Module#
Constants for RSP startup.
Variables#
Application name, used for logging. |
|
Configuration directory, usually /etc, but overrideable for tests. |
|
Constants used in Lab startup invocation. |
|
Maximum number of output lines to display in a Jupyter notebook cell. |
|
sha256 sums of previous iterations of |
|
Directory for lab startup files, overrideable for tests. |
nublado.startup.exceptions Module#
Exceptions for the LabRunner startup service.
Classes#
|
Execution of a command failed. |
|
Execution of a command failed. |
|
New Error codes for RSP Startup. |
|
RSPStartupError is a subclass of OSError that is designed to be more portable than the standard OSError, since we are throwing it to a client that could, potentially, be running on a different architecture or OS, and whose numeric error codes might therefore not match (e.g. |
Class Inheritance Diagram#

nublado.startup.services.credentials Module#
Manage merging site Butler credentials with user-specific credentials.
Classes#
|
Merge site credentials with user-specific credentials. |
Class Inheritance Diagram#

nublado.startup.services.dask Module#
Set up Dask proxy configuration, needed by lsdb.
Classes#
|
Configure dask proxy for lsdb. |
Class Inheritance Diagram#

nublado.startup.services.environment Module#
Handles updates to the runtime environment.
Classes#
|
Set up runtime environment for the Lab. |
Class Inheritance Diagram#

nublado.startup.services.homedir Module#
Tasks around ensuring the home directory is working correctly.
Classes#
|
Ensure homedir is working correctly. |
Class Inheritance Diagram#

nublado.startup.services.preparer Module#
RSP Lab preparer.
Classes#
|
Class to prepare for JupyterLab launch by modifying the filesystem and writing out a file representing the runtime environment, to be used by the launcher. |
Class Inheritance Diagram#

nublado.startup.storage.command Module#
Wrapper around executing external commands.
Classes#
|
Wrapper around executing external commands. |
Class Inheritance Diagram#

nublado.startup.utils Module#
Utility functions for starting LSST JupyterLab notebook environment.
Functions#
Return the digest of the current Docker image. |
|
Return the directory where Jupyterlab configuration is stored. |
|
Return the directory where Nublado runtime info is mounted. |
nublado.storage.docker Module#
Client for the Docker v2 API.
Classes#
|
Client to query the Docker API for image information. |
Class Inheritance Diagram#

nublado.storage.gar Module#
Client for Google Artifact Registry.
Classes#
|
Client for Google Artifact Registry. |
Class Inheritance Diagram#
