Coverage for ocp_resources/network_operator_openshift_io.py: 0%

59 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 Network(Resource): 

8 """ 

9 Network describes the cluster's desired network configuration. It is consumed by the cluster-network-operator. 

10 Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 

11 """ 

12 

13 api_group: str = Resource.ApiGroup.OPERATOR_OPENSHIFT_IO 

14 

15 def __init__( 

16 self, 

17 additional_networks: Optional[List[Any]] = None, 

18 cluster_network: Optional[List[Any]] = None, 

19 default_network: Optional[Dict[str, Any]] = None, 

20 deploy_kube_proxy: Optional[bool] = None, 

21 disable_multi_network: Optional[bool] = None, 

22 disable_network_diagnostics: Optional[bool] = None, 

23 export_network_flows: Optional[Dict[str, Any]] = None, 

24 kube_proxy_config: Optional[Dict[str, Any]] = None, 

25 log_level: Optional[str] = "", 

26 management_state: Optional[str] = "", 

27 migration: Optional[Dict[str, Any]] = None, 

28 observed_config: Optional[Any] = None, 

29 operator_log_level: Optional[str] = "", 

30 service_network: Optional[List[Any]] = None, 

31 unsupported_config_overrides: Optional[Any] = None, 

32 use_multi_network_policy: Optional[bool] = None, 

33 **kwargs: Any, 

34 ) -> None: 

35 """ 

36 Args: 

37 additional_networks (List[Any]): additionalNetworks is a list of extra networks to make available to 

38 pods when multiple networks are enabled. 

39 

40 cluster_network (List[Any]): clusterNetwork is the IP address pool to use for pod IPs. Some network 

41 providers, e.g. OpenShift SDN, support multiple ClusterNetworks. 

42 Others only support one. This is equivalent to the cluster-cidr. 

43 

44 default_network (Dict[str, Any]): defaultNetwork is the "default" network that all pods will receive 

45 

46 deploy_kube_proxy (bool): deployKubeProxy specifies whether or not a standalone kube-proxy 

47 should be deployed by the operator. Some network providers include 

48 kube-proxy or similar functionality. If unset, the plugin will 

49 attempt to select the correct value, which is false when OpenShift 

50 SDN and ovn-kubernetes are used and true otherwise. 

51 

52 disable_multi_network (bool): disableMultiNetwork specifies whether or not multiple pod network 

53 support should be disabled. If unset, this property defaults to 

54 'false' and multiple network support is enabled. 

55 

56 disable_network_diagnostics (bool): disableNetworkDiagnostics specifies whether or not 

57 PodNetworkConnectivityCheck CRs from a test pod to every node, 

58 apiserver and LB should be disabled or not. If unset, this 

59 property defaults to 'false' and network diagnostics is enabled. 

60 Setting this to 'true' would reduce the additional load of the 

61 pods performing the checks. 

62 

63 export_network_flows (Dict[str, Any]): exportNetworkFlows enables and configures the export of network flow 

64 metadata from the pod network by using protocols NetFlow, SFlow or 

65 IPFIX. Currently only supported on OVN-Kubernetes plugin. If 

66 unset, flows will not be exported to any collector. 

67 

68 kube_proxy_config (Dict[str, Any]): kubeProxyConfig lets us configure desired proxy configuration. If not 

69 specified, sensible defaults will be chosen by OpenShift directly. 

70 Not consumed by all network providers - currently only openshift- 

71 sdn. 

72 

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

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

75 coarse grained logging choices that operators have to interpret 

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

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

78 

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

80 the component 

81 

82 migration (Dict[str, Any]): migration enables and configures the cluster network migration. The 

83 migration procedure allows to change the network type and the MTU. 

84 

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

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

87 the level for the operator 

88 

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

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

91 manage coarse grained logging choices that operators have to 

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

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

94 

95 service_network (List[Any]): serviceNetwork is the ip address pool to use for Service IPs 

96 Currently, all existing network providers only support a single 

97 value here, but this is an array to allow for growth. 

98 

99 unsupported_config_overrides (Any): unsupportedConfigOverrides overrides the final configuration that was 

100 computed by the operator. Red Hat does not support the use of this 

101 field. Misuse of this field could lead to unexpected behavior or 

102 conflict with other configuration options. Seek guidance from the 

103 Red Hat support before using this field. Use of this property 

104 blocks cluster upgrades, it must be removed before upgrading your 

105 cluster. 

106 

107 use_multi_network_policy (bool): useMultiNetworkPolicy enables a controller which allows for 

108 MultiNetworkPolicy objects to be used on additional networks as 

109 created by Multus CNI. MultiNetworkPolicy are similar to 

110 NetworkPolicy objects, but NetworkPolicy objects only apply to the 

111 primary interface. With MultiNetworkPolicy, you can control the 

112 traffic that a pod can receive over the secondary interfaces. If 

113 unset, this property defaults to 'false' and MultiNetworkPolicy 

114 objects are ignored. If 'disableMultiNetwork' is 'true' then the 

115 value of this field is ignored. 

116 

117 """ 

118 super().__init__(**kwargs) 

119 

120 self.additional_networks = additional_networks 

121 self.cluster_network = cluster_network 

122 self.default_network = default_network 

123 self.deploy_kube_proxy = deploy_kube_proxy 

124 self.disable_multi_network = disable_multi_network 

125 self.disable_network_diagnostics = disable_network_diagnostics 

126 self.export_network_flows = export_network_flows 

127 self.kube_proxy_config = kube_proxy_config 

128 self.log_level = log_level 

129 self.management_state = management_state 

130 self.migration = migration 

131 self.observed_config = observed_config 

132 self.operator_log_level = operator_log_level 

133 self.service_network = service_network 

134 self.unsupported_config_overrides = unsupported_config_overrides 

135 self.use_multi_network_policy = use_multi_network_policy 

136 

137 def to_dict(self) -> None: 

138 super().to_dict() 

139 

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

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

142 _spec = self.res["spec"] 

143 

144 if self.additional_networks: 

145 _spec["additionalNetworks"] = self.additional_networks 

146 

147 if self.cluster_network: 

148 _spec["clusterNetwork"] = self.cluster_network 

149 

150 if self.default_network: 

151 _spec["defaultNetwork"] = self.default_network 

152 

153 if self.deploy_kube_proxy is not None: 

154 _spec["deployKubeProxy"] = self.deploy_kube_proxy 

155 

156 if self.disable_multi_network is not None: 

157 _spec["disableMultiNetwork"] = self.disable_multi_network 

158 

159 if self.disable_network_diagnostics is not None: 

160 _spec["disableNetworkDiagnostics"] = self.disable_network_diagnostics 

161 

162 if self.export_network_flows: 

163 _spec["exportNetworkFlows"] = self.export_network_flows 

164 

165 if self.kube_proxy_config: 

166 _spec["kubeProxyConfig"] = self.kube_proxy_config 

167 

168 if self.log_level: 

169 _spec["logLevel"] = self.log_level 

170 

171 if self.management_state: 

172 _spec["managementState"] = self.management_state 

173 

174 if self.migration: 

175 _spec["migration"] = self.migration 

176 

177 if self.observed_config: 

178 _spec["observedConfig"] = self.observed_config 

179 

180 if self.operator_log_level: 

181 _spec["operatorLogLevel"] = self.operator_log_level 

182 

183 if self.service_network: 

184 _spec["serviceNetwork"] = self.service_network 

185 

186 if self.unsupported_config_overrides: 

187 _spec["unsupportedConfigOverrides"] = self.unsupported_config_overrides 

188 

189 if self.use_multi_network_policy is not None: 

190 _spec["useMultiNetworkPolicy"] = self.use_multi_network_policy 

191 

192 # End of generated code