ImageSource

class controller.services.source.base.ImageSource(logger)

Bases: object

Base class for image sources.

An image source is a class that wraps a Docker image registry, gathers information about known images, and answers questions about those images. It is used by the image service as the source of truth about remote images.

This is the base class that defines the interface and some common code.

Parameters:

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.

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

abstract async image_for_reference(reference)

Determine the image corresponding to a Docker reference.

Parameters:

reference (DockerReference) – Docker reference, which may or may not have a known digest.

Returns:

Corresponding image.

Return type:

RSPImage

abstract async image_for_tag_name(tag_name)

Determine the image corresponding to a tag.

Assuming that the tag is for our image source, construct the corresponding RSPImage.

Parameters:

tag_name (str) – Tag of the image

Returns:

Corresponding image.

Return type:

RSPImage

abstract 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

abstract menu_images()

All known images suitable for display in the spawner menu.

Returns:

All known images.

Return type:

list of MenuImage

abstract 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

abstract async update_images(prepull, node_cache)

Update image information and determine what images to prepull.

Retrieve the full list of remote images, update their node presence information, and construct the subset to prepull.

Parameters:
Returns:

Collection of images to prepull.

Return type:

RSPImageCollection