Coverage for ocp_resources/kube_descheduler.py: 0%

38 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 NamespacedResource 

5 

6 

7class KubeDescheduler(NamespacedResource): 

8 """ 

9 KubeDescheduler is the Schema for the deschedulers API 

10 """ 

11 

12 api_group: str = NamespacedResource.ApiGroup.OPERATOR_OPENSHIFT_IO 

13 

14 def __init__( 

15 self, 

16 descheduling_interval_seconds: Optional[int] = None, 

17 log_level: Optional[str] = "", 

18 management_state: Optional[str] = "", 

19 mode: Optional[str] = "", 

20 observed_config: Optional[Any] = None, 

21 operator_log_level: Optional[str] = "", 

22 profile_customizations: Optional[Dict[str, Any]] = None, 

23 profiles: Optional[List[Any]] = None, 

24 unsupported_config_overrides: Optional[Any] = None, 

25 **kwargs: Any, 

26 ) -> None: 

27 """ 

28 Args: 

29 descheduling_interval_seconds (int): DeschedulingIntervalSeconds is the number of seconds between 

30 descheduler runs 

31 

32 log_level (str): logLevel is an intent based logging for an overall component. It does 

33 not give fine grained control, but it is a simple way to manage 

34 coarse grained logging choices that operators have to interpret 

35 for their operands. Valid values are: "Normal", "Debug", 

36 "Trace", "TraceAll". Defaults to "Normal". 

37 

38 management_state (str): managementState indicates whether and how the operator should manage 

39 the component 

40 

41 mode (str): Mode configures the descheduler to either evict pods (Automatic) or to 

42 simulate the eviction (Predictive) 

43 

44 observed_config (Any): observedConfig holds a sparse config that controller has observed from 

45 the cluster state. It exists in spec because it is an input to 

46 the level for the operator 

47 

48 operator_log_level (str): operatorLogLevel is an intent based logging for the operator itself. 

49 It does not give fine grained control, but it is a simple way to 

50 manage coarse grained logging choices that operators have to 

51 interpret for themselves. Valid values are: "Normal", "Debug", 

52 "Trace", "TraceAll". Defaults to "Normal". 

53 

54 profile_customizations (Dict[str, Any]): ProfileCustomizations contains various parameters for modifying the 

55 default behavior of certain profiles 

56 

57 profiles (List[Any]): Profiles sets which descheduler strategy profiles are enabled 

58 

59 unsupported_config_overrides (Any): unsupportedConfigOverrides holds a sparse config that will override 

60 any previously set options. It only needs to be the fields to 

61 override it will end up overlaying in the following order: 1. 

62 hardcoded defaults 2. observedConfig 3. unsupportedConfigOverrides 

63 

64 """ 

65 super().__init__(**kwargs) 

66 

67 self.descheduling_interval_seconds = descheduling_interval_seconds 

68 self.log_level = log_level 

69 self.management_state = management_state 

70 self.mode = mode 

71 self.observed_config = observed_config 

72 self.operator_log_level = operator_log_level 

73 self.profile_customizations = profile_customizations 

74 self.profiles = profiles 

75 self.unsupported_config_overrides = unsupported_config_overrides 

76 

77 def to_dict(self) -> None: 

78 super().to_dict() 

79 

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

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

82 _spec = self.res["spec"] 

83 

84 if self.descheduling_interval_seconds: 

85 _spec["deschedulingIntervalSeconds"] = self.descheduling_interval_seconds 

86 

87 if self.log_level: 

88 _spec["logLevel"] = self.log_level 

89 

90 if self.management_state: 

91 _spec["managementState"] = self.management_state 

92 

93 if self.mode: 

94 _spec["mode"] = self.mode 

95 

96 if self.observed_config: 

97 _spec["observedConfig"] = self.observed_config 

98 

99 if self.operator_log_level: 

100 _spec["operatorLogLevel"] = self.operator_log_level 

101 

102 if self.profile_customizations: 

103 _spec["profileCustomizations"] = self.profile_customizations 

104 

105 if self.profiles: 

106 _spec["profiles"] = self.profiles 

107 

108 if self.unsupported_config_overrides: 

109 _spec["unsupportedConfigOverrides"] = self.unsupported_config_overrides 

110 

111 # End of generated code