Coverage for ocp_resources/replica_set.py: 0%
24 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
3from typing import Any, Dict, Optional
4from ocp_resources.resource import NamespacedResource, MissingRequiredArgumentError
7class ReplicaSet(NamespacedResource):
8 """
9 ReplicaSet ensures that a specified number of pod replicas are running at any given time.
10 """
12 api_group: str = NamespacedResource.ApiGroup.APPS
14 def __init__(
15 self,
16 min_ready_seconds: Optional[int] = None,
17 replicas: Optional[int] = None,
18 selector: Optional[Dict[str, Any]] = None,
19 template: Optional[Dict[str, Any]] = None,
20 **kwargs: Any,
21 ) -> None:
22 """
23 Args:
24 min_ready_seconds (int): Minimum number of seconds for which a newly created pod should be
25 ready without any of its container crashing, for it to be
26 considered available. Defaults to 0 (pod will be considered
27 available as soon as it is ready)
29 replicas (int): Replicas is the number of desired replicas. This is a pointer to
30 distinguish between explicit zero and unspecified. Defaults to 1.
31 More info: https://kubernetes.io/docs/concepts/workloads/controlle
32 rs/replicationcontroller/#what-is-a-replicationcontroller
34 selector (Dict[str, Any]): A label selector is a label query over a set of resources. The result
35 of matchLabels and matchExpressions are ANDed. An empty label
36 selector matches all objects. A null label selector matches no
37 objects.
39 template (Dict[str, Any]): PodTemplateSpec describes the data a pod should have when created from
40 a template
42 """
43 super().__init__(**kwargs)
45 self.min_ready_seconds = min_ready_seconds
46 self.replicas = replicas
47 self.selector = selector
48 self.template = template
50 def to_dict(self) -> None:
51 super().to_dict()
53 if not self.kind_dict and not self.yaml_file:
54 if not self.selector:
55 raise MissingRequiredArgumentError(argument="self.selector")
57 self.res["spec"] = {}
58 _spec = self.res["spec"]
60 _spec["selector"] = self.selector
62 if self.min_ready_seconds:
63 _spec["minReadySeconds"] = self.min_ready_seconds
65 if self.replicas:
66 _spec["replicas"] = self.replicas
68 if self.template:
69 _spec["template"] = self.template
71 # End of generated code