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:

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.

menu_images()

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:

RSPImage

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:

RSPImage

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.

Parameters:
  • tag_name – Tag of image.

  • node (str) – Node to which the image was prepulled.

  • image (RSPImage)

Return type:

None

menu_images()

All known images suitable for display in the spawner menu.

Returns:

All known images.

Return type:

list of MenuImage

prepulled_images(nodes)

All known images with their prepulled status in the API model.

Parameters:

nodes (set[str]) – Nodes on which the image must exist to qualify as prepulled.

Returns:

All known images.

Return type:

list of PrepulledImage

async update_images(prepull, node_cache)

Update image information and determine what images to prepull.

Parameters:
Returns:

New collection of images to prepull.

Return type:

RSPImageCollection