KubernetesStorage#

class phalanx.storage.kubernetes.KubernetesStorage#

Bases: object

Storage layer for direct Kubernetes operations.

Used primarily by the installer. This uses kubectl directly rather than one of the Python Kubernetes libraries since it seemed simpler at the time.

Methods Summary

create_generic_secret(name, namespace, keys)

Create a generic Kubernetes Secret resource.

create_namespace(namespace, *[, ignore_fail])

Create a Kubernetes namespace.

wait_for_rollout(name, namespace)

Wait for a Kubernetes rollout to complete.

Methods Documentation

create_generic_secret(name, namespace, keys)#

Create a generic Kubernetes Secret resource.

Parameters:
  • name (str) – Name of the secret.

  • namespace (str) – Namespace of the secret.

  • keys (dict[str, str]) – Key and value pairs to put into the secret.

Return type:

None

create_namespace(namespace, *, ignore_fail=False)#

Create a Kubernetes namespace.

Parameters:
  • namespace (str) – Namespace to create.

  • ignore_fail (bool, default: False) – If True, ignore failures, such as when the namespace already exists.

Raises:

CommandFailedError – Raised if the namespace creation fails, and ignore_fail was not set to True.

Return type:

None

wait_for_rollout(name, namespace)#

Wait for a Kubernetes rollout to complete.

Parameters:
  • name (str) – Name of the rollout. This should be the type of object (usually either deployment or statefulset, followed by a slash and the name of the object.

  • namespace (str) – Namespace in which the rollout is happening.

Return type:

None