ReplicaManager#
The ReplicaManager is an abstract base class in Piceli designed to unify and simplify the definition of Kubernetes Deployment and StatefulSet objects. It incorporates common properties and methods required for managing replicas and their associated services in a Kubernetes cluster.
Key Features#
restart_policy: Defines the restart policy for the pods. Defaults toAlways.replicas: Specifies the number of pod replicas. Defaults to1.create_service: A boolean indicating whether a service should be automatically created for the replica manager.hpa: An optionalHorizontalPodAutoscalerconfiguration.vpa: An optionalVerticalPodAutoscalerconfiguration.labels: Optional labels to be applied to the replica manager.
Methods#
get_replica_manager(): Abstract method that must be implemented by subclasses to define the specific replica manager (DeploymentorStatefulSet).get_service(): Constructs and returns aServiceobject associated with the replica manager, ifcreate_serviceisTrue.get_hpa(): Retrieves the configuredHorizontalPodAutoscalerobject.get_vpa(): Retrieves the configuredVerticalPodAutoscalerobject.get(): Aggregates and returns a list of Kubernetes objects that need to be created or managed, including the replica manager itself, optional services, HPA, and VPA.
Usage#
ReplicaManager serves as a foundation for Deployment and StatefulSet classes in Piceli, enabling them to inherit and extend its functionalities. It is not meant to be instantiated directly but through its concrete subclasses.