FSAdminStorage#
- class controller.storage.kubernetes.fsadmin.FSAdminStorage(*, config, metadata_storage, api_client, logger)#
Bases:
object
Kubernetes storage layer for a filesystem admin pod.
- Parameters:
config (
FSAdminConfig
) – Configuration for fsadmin environment.metadata_storage (
MetadataStorage
) – Holds namespace information.api_client (
ApiClient
) – Kubernetes API client.logger (
BoundLogger
) – Logger to use.
Notes
This class isn’t strictly necessary; instead, the fsadmin service could call the storage layers for individual Kubernetes objects directly. Even though there are not many objects, having a wrapper layer might be easier to follow.
Methods Summary
create
(objects, timeout)Create all of the Kubernetes objects for an fsadmin instance.
delete
(objects, timeout)Delete the fsadmin instance.
get_status
(timeout)Return the status of the fsadmin environment.
Methods Documentation
- async create(objects, timeout)#
Create all of the Kubernetes objects for an fsadmin instance.
Create the objects in Kubernetes and then wait for the fsadmin pod to start.
Returns the time at which the pod went into Running phase.
- Parameters:
objects (
FSAdminObjects
) – Kubernetes objects making up the fsadmin environment.timeout (
Timeout
) – How long to wait for the fsadmin pod to start.
- Returns:
Pod status.
- Return type:
- Raises:
InvalidPodPhaseError – Pod is not in
Running
phase.KubernetesError – Raised if there is some failure in a Kubernetes API call.
PodNotFoundError – Pod does not exist.
TimeoutError – Raised if fsadmin is not ready before the provided timeout expires.
- async delete(objects, timeout)#
Delete the fsadmin instance.
- Parameters:
objects (
FSAdminObjects
) – Kubernetes objects making up the fsadmin environment.timeout (
Timeout
) – Timeout on operation.
- Raises:
KubernetesError – Raised if there is some failure in a Kubernetes API call.
TimeoutError – Raised if fsadmin objects are not deleted within provided timeout.
- Return type:
- async get_status(timeout)#
Return the status of the fsadmin environment.
If it is ready for work, return an FSAdminStatus object with start_time set to the time the pod was created and phase set to PodPhase.RUNNING.
Otherwise raise an exception: either the pod is missing, or the pod is not in
Running
phase.- Parameters:
timeout (
Timeout
) – Timeout on operation.- Returns:
Pod status if ready.
- Return type:
- Raises:
InvalidPodPhaseError – Pod is not in
Running
phase.KubernetesError – Raised if there is some failure in a Kubernetes API call.
PodNotFoundError – Pod does not exist.
TimeoutError – Raised if fsadmin is not ready before the provided timeout expires.