GARImageSource¶
- class controller.services.source.gar.GARImageSource(config, gar, logger)¶
Bases:
ImageSource
Image source using a Google Artifact Registry.
Google Artifact Registry has a much nicer API that returns all available images with their aliases and hashes in one request. This means we don’t have to track tags and images separately and the logic is much simpler than
DockerImageSource
.- Parameters:
config (
GARSourceOptions
) – Source configuration for which server, project, and image to use.gar (
GARStorageClient
) – Google Artifact Registry client.logger (
BoundLogger
) – Logger for messages.
Methods Summary
image_for_reference
(reference)Determine the image corresponding to a Docker reference.
image_for_tag_name
(tag_name)Determine the image corresponding to a tag.
mark_prepulled
(image, node)Optimistically mark an image as prepulled to a node.
All known images suitable for display in the spawner menu.
prepulled_images
(nodes)All known images with their prepulled status in the API model.
update_images
(prepull, node_cache)Update image information and determine what images to prepull.
Methods Documentation
- async image_for_reference(reference)¶
Determine the image corresponding to a Docker reference.
- Parameters:
reference (
DockerReference
) – Docker reference.- Returns:
Corresponding image.
- Return type:
- Raises:
InvalidDockerReferenceError – Raised if the Docker reference doesn’t contain a tag. References without a tag are valid references to Docker, but for our purposes we always want to have a tag to use for debugging, status display inside the lab, etc.
UnknownDockerImageError – Raised if this is not one of the remote images we know about.
- async image_for_tag_name(tag_name)¶
Determine the image corresponding to a tag.
Assuming the tag is for our configured image, find the corresponding
RSPImage
.- Parameters:
tag_name (
str
) – Tag of the image- Return type:
- Returns:
Corresponding image.
- Raises:
UnknownDockerImageError – The requested tag is not found.
- mark_prepulled(image, node)¶
Optimistically mark an image as prepulled to a node.
Called by the prepuller after the prepull pod succeeded.
All known images suitable for display in the spawner menu.
- prepulled_images(nodes)¶
All known images with their prepulled status in the API model.
- async update_images(prepull, node_cache)¶
Update image information and determine what images to prepull.
- Parameters:
prepull (
PrepullerOptions
) – Configuration of what images to prepull.node_cache (
Mapping
[str
,list
[KubernetesNodeImage
]]) – Mapping of node names to the list of cached images on that node.
- Returns:
New collection of images to prepull.
- Return type: