KubernetesTokenStorage#
- class gafaelfawr.storage.kubernetes.KubernetesTokenStorage(api_client, logger)#
Bases:
objectKubernetes 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:
parent (
GafaelfawrServiceToken) – The parent object for the secret.token (
Token) – The token to store.
- Returns:
Status information to store in the parent object.
- Return type:
- 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.V1Secret or None
- async replace_secret(parent, token)#
Replace the token in a
Secret.- Parameters:
parent (
GafaelfawrServiceToken) – The parent object for theSecret.token (
Token) – The token to store.
- Returns:
Status information to store in the parent object.
- Return type:
- async update_secret_metadata(parent)#
Update the metadata for a
Secret.- Parameters:
parent (
GafaelfawrServiceToken) – The parent object for theSecret.- Return type: