KubernetesTokenStorage

class gafaelfawr.storage.kubernetes.KubernetesTokenStorage(api_client, logger)

Bases: object

Kubernetes storage layer for service token objects.

This abstracts storage of Gafaelfawr service tokens in Kubernetes objects by wrapping the underlying Kubernetes Python client.

Parameters:
  • api_client (ApiClient) – Kubernetes async client to use.

  • logger (BoundLogger) – Logger to use.

Methods Summary

create_secret(parent, token)

Create a Kubernetes secret from a GafaelfawrServiceToken.

get_secret(parent)

Retrieve the secret corresponding to a GafaelfawrServiceToken.

replace_secret(parent, token)

Replace the token in a Secret.

update_secret_metadata(parent)

Update the metadata for a Secret.

Methods Documentation

async create_secret(parent, token)

Create a Kubernetes secret from a GafaelfawrServiceToken.

The token will always be stored in the data field token.

Parameters:
Returns:

Status information to store in the parent object.

Return type:

KubernetesResourceStatus

async get_secret(parent)

Retrieve the secret corresponding to a GafaelfawrServiceToken.

Parameters:

parent (GafaelfawrServiceToken) – The parent object.

Returns:

The Kubernetes secret, or None if that secret does not exist.

Return type:

kubernetes_asyncio.client.models.V1Secret or None

async replace_secret(parent, token)

Replace the token in a Secret.

Parameters:
Returns:

Status information to store in the parent object.

Return type:

KubernetesResourceStatus

async update_secret_metadata(parent)

Update the metadata for a Secret.

Parameters:

parent (GafaelfawrServiceToken) – The parent object for the Secret.

Return type:

None