Coverage for ocp_resources/nm_state.py: 0%

32 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, List, Optional 

4from ocp_resources.resource import Resource 

5 

6 

7class NMState(Resource): 

8 """ 

9 NMState is the Schema for the nmstates API 

10 """ 

11 

12 api_group: str = Resource.ApiGroup.NMSTATE_IO 

13 

14 def __init__( 

15 self, 

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

17 infra_affinity: Optional[Dict[str, Any]] = None, 

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

19 infra_tolerations: Optional[List[Any]] = None, 

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

21 self_sign_configuration: Optional[Dict[str, Any]] = None, 

22 tolerations: Optional[List[Any]] = None, 

23 **kwargs: Any, 

24 ) -> None: 

25 """ 

26 Args: 

27 affinity (Dict[str, Any]): Affinity is an optional affinity selector that will be added to 

28 handler DaemonSet manifest. 

29 

30 infra_affinity (Dict[str, Any]): Affinity is an optional affinity selector that will be added to 

31 webhook & certmanager Deployment manifests. 

32 

33 infra_node_selector (Dict[str, Any]): InfraNodeSelector is an optional selector that will be added to 

34 webhook & certmanager Deployment manifests If InfraNodeSelector is 

35 specified, the webhook and certmanager will run only on nodes that 

36 have each of the indicated key-value pairs as labels applied to 

37 the node. 

38 

39 infra_tolerations (List[Any]): InfraTolerations is an optional list of tolerations to be added to 

40 webhook & certmanager Deployment manifests If InfraTolerations is 

41 specified, the webhook and certmanager will be able to be 

42 scheduled on nodes with corresponding taints 

43 

44 node_selector (Dict[str, Any]): NodeSelector is an optional selector that will be added to handler 

45 DaemonSet manifest for both workers and control-plane 

46 (https://github.com/nmstate/kubernetes- 

47 nmstate/blob/main/deploy/handler/operator.yaml). If NodeSelector 

48 is specified, the handler will run only on nodes that have each of 

49 the indicated key-value pairs as labels applied to the node. 

50 

51 self_sign_configuration (Dict[str, Any]): SelfSignConfiguration defines self signed certificate configuration 

52 

53 tolerations (List[Any]): Tolerations is an optional list of tolerations to be added to handler 

54 DaemonSet manifest If Tolerations is specified, the handler 

55 daemonset will be also scheduled on nodes with corresponding 

56 taints 

57 

58 """ 

59 super().__init__(**kwargs) 

60 

61 self.affinity = affinity 

62 self.infra_affinity = infra_affinity 

63 self.infra_node_selector = infra_node_selector 

64 self.infra_tolerations = infra_tolerations 

65 self.node_selector = node_selector 

66 self.self_sign_configuration = self_sign_configuration 

67 self.tolerations = tolerations 

68 

69 def to_dict(self) -> None: 

70 super().to_dict() 

71 

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

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

74 _spec = self.res["spec"] 

75 

76 if self.affinity: 

77 _spec["affinity"] = self.affinity 

78 

79 if self.infra_affinity: 

80 _spec["infraAffinity"] = self.infra_affinity 

81 

82 if self.infra_node_selector: 

83 _spec["infraNodeSelector"] = self.infra_node_selector 

84 

85 if self.infra_tolerations: 

86 _spec["infraTolerations"] = self.infra_tolerations 

87 

88 if self.node_selector: 

89 _spec["nodeSelector"] = self.node_selector 

90 

91 if self.self_sign_configuration: 

92 _spec["selfSignConfiguration"] = self.self_sign_configuration 

93 

94 if self.tolerations: 

95 _spec["tolerations"] = self.tolerations 

96 

97 # End of generated code