RSPImage

class controller.models.domain.rspimage.RSPImage(tag, image_type, version, cycle, display_name, date, registry, repository, digest, size=None, aliases=<factory>, alias_target=None, nodes=<factory>)

Bases: RSPImageTag

A tagged Rubin Science Platform image.

An RSPImage differs from a RSPImageTag by having a reference and digest, potentially additional alias tags, and possibly information discovered from a Kubernetes cluster, such as the image size and the list of nodes on which it is present.

Parameters:

Attributes Summary

alias_target

The tag of the image for which this is an alias, if known.

aliases

Known aliases for this image.

cycle

XML schema version implemented by this image (only for T&S builds).

date

When the image was created, or as close as we can get to that.

digest

Image digest for the image, including prefixes like sha256:.

display_name

Human-readable display name.

image_type

Type (release series) of image identified by this tag.

is_possible_alias

Whether this tag could be an alias.

nodes

Names of nodes on which this image is present.

reference

Docker reference for this image.

reference_with_digest

Docker reference for this image, with the digest.

registry

Docker registry from which this image comes.

repository

Docker repository from which this image comes.

size

Size of the image in bytes if known.

tag

The tag itself, unmodified.

version

Version information as a semantic version.

Methods Summary

from_tag(*, registry, repository, tag, digest)

Construct an image from an existing tag.

resolve_alias(target)

Resolve an alias tag with information about its target.

Attributes Documentation

alias_target: str | None = None

The tag of the image for which this is an alias, if known.

aliases: set[str] = <dataclasses._MISSING_TYPE object>

Known aliases for this image.

This may include other alias tags that all resolve to the same underlying image, other non-alias tags with the same digest, and aliases that are not present in the same collection. It is intended primarily for the use of RSPImageCollection, which contains more sophisticated alias tracking logic that is aware of the contents of the collection.

cycle: int | None = <dataclasses._MISSING_TYPE object>

XML schema version implemented by this image (only for T&S builds).

date: datetime | None = <dataclasses._MISSING_TYPE object>

When the image was created, or as close as we can get to that.

We try to derive this from the tag string: For RSP daily or weekly tags (or experimentals in one of those formats), we can calculate this to within a day or a week, which is good enough for display purposes. Otherwise, we may be able to extract this info from the registry, but even if we can, it may be image upload time rather than creation time.

digest: str = <dataclasses._MISSING_TYPE object>

Image digest for the image, including prefixes like sha256:.

display_name: str = <dataclasses._MISSING_TYPE object>

Human-readable display name.

image_type: RSPImageType = <dataclasses._MISSING_TYPE object>

Type (release series) of image identified by this tag.

is_possible_alias

Whether this tag could be an alias.

nodes: set[str] = <dataclasses._MISSING_TYPE object>

Names of nodes on which this image is present.

reference

Docker reference for this image.

reference_with_digest

Docker reference for this image, with the digest.

registry: str = <dataclasses._MISSING_TYPE object>

Docker registry from which this image comes.

repository: str = <dataclasses._MISSING_TYPE object>

Docker repository from which this image comes.

size: int | None = None

Size of the image in bytes if known.

tag: str = <dataclasses._MISSING_TYPE object>

The tag itself, unmodified.

version: Version | None = <dataclasses._MISSING_TYPE object>

Version information as a semantic version.

Methods Documentation

classmethod from_tag(*, registry, repository, tag, digest)

Construct an image from an existing tag.

Parameters:
  • registry (str) – Docker registry for this image.

  • repository (str) – Docker repository for this image.

  • tag (RSPImageTag) – Tag for this image.

  • digest (str) – Digest for this image.

Returns:

Resulting image object.

Return type:

RSPImage

resolve_alias(target)

Resolve an alias tag with information about its target.

If we discover the target tag of an alias tag, we can improve the alias tag’s display name and cycle information using the information of the underlying tag. This normally happens when ingesting a set of images, including alias images, into an RSPImageCollection.

If the tag was previously an unknown tag but we found another tag with the same digest, assume it is an alias tag and upgrade it.

Parameters:

target (RSPImage) – Another tag with the same digest.

Raises:

ValueError – If this image has a type other than unknown or alias. (Ideally this should be represented in the type system, but that code is tedious and doesn’t add much value.)

Return type:

None