NodeStorage

class controller.storage.kubernetes.node.NodeStorage(api_client, logger)

Bases: object

Storage layer for Kubernetes node objects.

Parameters:
  • api_client (ApiClient) – Kubernetes API client.

  • logger (BoundLogger) – Logger to use.

Methods Summary

get_cached_images(nodes)

Build map of what images are cached on each node.

is_tolerated(node, tolerations)

Determine whether a pod can be placed on a node.

list(node_selector, timeout)

Get data about Kubernetes nodes.

Methods Documentation

get_cached_images(nodes)

Build map of what images are cached on each node.

Parameters:

nodes (list[V1Node]) – List of Kubernetes nodes with their metadata.

Returns:

Mapping of node names to lists of cached images on that node.

Return type:

dict of list

is_tolerated(node, tolerations)

Determine whether a pod can be placed on a node.

Evaluates the node taints against the provided tolerations and determines whether an image with those tolerations can be placed on that node. Nodes with a PreferNoSchedule taint are still tolerated.

Parameters:
  • node (V1Node) – Kubernetes node.

  • tolerations (list[Toleration]) – List of tolerations that the pod will have.

Returns:

Information about whether that image can be placed on that node.

Return type:

NodeToleration

async list(node_selector, timeout)

Get data about Kubernetes nodes.

Parameters:
  • node_selector (dict[str, str]) – Node selector rules to restrict the list of nodes of interest.

  • timeout (Timeout) – Timeout for call.

Returns:

List of node metadata.

Return type:

list of kubernetes_asyncio.client.models.V1Node