KubernetesObjectCreator¶
- class controller.storage.kubernetes.creator.KubernetesObjectCreator(*, create_method, read_method, object_type, kind, logger)¶
Bases:
Generic
Generic Kubernetes object storage supporting create and read.
This class provides a wrapper around any Kubernetes object type that implements create and read operations with logging and exception conversion.
This class is not meant to be used directly by code outside of the Kubernetes storage layer. Use one of the kind-specific watcher classes built on top of it instead.
- Parameters:
create_method (
Callable
[...
,Awaitable
[Any
]]) – Method to create this type of object.read_method (
Callable
[...
,Awaitable
[Any
]]) – Method to read this type of object.object_type (
type
[TypeVar
(T
, bound=KubernetesModel
)]) – Type of object being acted on.kind (
str
) – Kubernetes kind of object being acted on.logger (
BoundLogger
) – Logger to use.
Methods Summary
create
(namespace, body, timeout)Create a new Kubernetes object.
read
(name, namespace, timeout)Read a Kubernetes object.
Methods Documentation
- async create(namespace, body, timeout)¶
Create a new Kubernetes object.
- Parameters:
namespace (
str
) – Namespace of the object.body (
TypeVar
(T
, bound=KubernetesModel
)) – New object.timeout (
Timeout
) – Timeout on operation.
- Raises:
KubernetesError – Raised for exceptions from the Kubernetes API server.
- Return type:
- async read(name, namespace, timeout)¶
Read a Kubernetes object.