Coverage for ocp_resources/mtq.py: 0%

26 statements  

« 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 

2 

3from typing import Any, Dict, Optional 

4from ocp_resources.resource import Resource 

5 

6 

7class MTQ(Resource): 

8 """ 

9 MTQ is the MTQ Operator CRD 

10 """ 

11 

12 api_group: str = Resource.ApiGroup.MTQ_KUBEVIRT_IO 

13 

14 def __init__( 

15 self, 

16 cert_config: Optional[Dict[str, Any]] = None, 

17 image_pull_policy: Optional[str] = "", 

18 infra: Optional[Dict[str, Any]] = None, 

19 priority_class: Optional[str] = "", 

20 workload: Optional[Dict[str, Any]] = None, 

21 **kwargs: Any, 

22 ) -> None: 

23 """ 

24 Args: 

25 cert_config(Dict[Any, Any]): certificate configuration 

26 

27 FIELDS: 

28 ca <Object> 

29 CA configuration CA certs are kept in the CA bundle as long as they are 

30 valid 

31 

32 server <Object> 

33 Server configuration Certs are rotated and discarded 

34 

35 image_pull_policy(str): PullPolicy describes a policy for if/when to pull a container image 

36 

37 infra(Dict[Any, Any]): Rules on which nodes MTQ infrastructure pods will be scheduled 

38 

39 FIELDS: 

40 affinity <Object> 

41 affinity enables pod affinity/anti-affinity placement expanding the types of 

42 constraints that can be expressed with nodeSelector. affinity is going to be 

43 applied to the relevant kind of pods in parallel with nodeSelector See 

44 https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity 

45 

46 nodeSelector <map[string]string> 

47 nodeSelector is the node selector applied to the relevant kind of pods It 

48 specifies a map of key-value pairs: for the pod to be eligible to run on a 

49 node, the node must have each of the indicated key-value pairs as labels (it 

50 can have additional labels as well). See 

51 https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector 

52 

53 tolerations <[]Object> 

54 tolerations is a list of tolerations applied to the relevant kind of pods 

55 See https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ 

56 for more info. These are additional tolerations other than default ones. 

57 

58 priority_class(str): PriorityClass of the MTQ control plane 

59 

60 workload(Dict[Any, Any]): Restrict on which nodes MTQ workload pods will be scheduled 

61 

62 FIELDS: 

63 affinity <Object> 

64 affinity enables pod affinity/anti-affinity placement expanding the types of 

65 constraints that can be expressed with nodeSelector. affinity is going to be 

66 applied to the relevant kind of pods in parallel with nodeSelector See 

67 https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity 

68 

69 nodeSelector <map[string]string> 

70 nodeSelector is the node selector applied to the relevant kind of pods It 

71 specifies a map of key-value pairs: for the pod to be eligible to run on a 

72 node, the node must have each of the indicated key-value pairs as labels (it 

73 can have additional labels as well). See 

74 https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector 

75 

76 tolerations <[]Object> 

77 tolerations is a list of tolerations applied to the relevant kind of pods 

78 See https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ 

79 for more info. These are additional tolerations other than default ones. 

80 

81 """ 

82 super().__init__(**kwargs) 

83 

84 self.cert_config = cert_config 

85 self.image_pull_policy = image_pull_policy 

86 self.infra = infra 

87 self.priority_class = priority_class 

88 self.workload = workload 

89 

90 def to_dict(self) -> None: 

91 super().to_dict() 

92 

93 if not self.kind_dict and not self.yaml_file: 

94 self.res["spec"] = {} 

95 _spec = self.res["spec"] 

96 

97 if self.cert_config: 

98 _spec["certConfig"] = self.cert_config 

99 

100 if self.image_pull_policy: 

101 _spec["imagePullPolicy"] = self.image_pull_policy 

102 

103 if self.infra: 

104 _spec["infra"] = self.infra 

105 

106 if self.priority_class: 

107 _spec["priorityClass"] = self.priority_class 

108 

109 if self.workload: 

110 _spec["workload"] = self.workload