Coverage for ocp_resources/network_config_openshift_io.py: 0%
29 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, List, Optional
4from ocp_resources.resource import Resource
7class Network(Resource):
8 """
9 Network holds cluster-wide information about Network. The canonical name is `cluster`. It is used to configure the desired network configuration, such as: IP address pools for services/pod IPs, network plugin, etc. Please view network.spec for an explanation on what applies when configuring this resource.
10 Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
11 """
13 api_group: str = Resource.ApiGroup.CONFIG_OPENSHIFT_IO
15 def __init__(
16 self,
17 cluster_network: Optional[List[Any]] = None,
18 external_ip: Optional[Dict[str, Any]] = None,
19 network_diagnostics: Optional[Dict[str, Any]] = None,
20 network_type: Optional[str] = "",
21 service_network: Optional[List[Any]] = None,
22 service_node_port_range: Optional[str] = "",
23 **kwargs: Any,
24 ) -> None:
25 """
26 Args:
27 cluster_network (List[Any]): IP address pool to use for pod IPs. This field is immutable after
28 installation.
30 external_ip (Dict[str, Any]): externalIP defines configuration for controllers that affect
31 Service.ExternalIP. If nil, then ExternalIP is not allowed to be
32 set.
34 network_diagnostics (Dict[str, Any]): networkDiagnostics defines network diagnostics configuration. Takes
35 precedence over spec.disableNetworkDiagnostics in
36 network.operator.openshift.io. If networkDiagnostics is not
37 specified or is empty, and the spec.disableNetworkDiagnostics flag
38 in network.operator.openshift.io is set to true, the network
39 diagnostics feature will be disabled.
41 network_type (str): NetworkType is the plugin that is to be deployed (e.g. OVNKubernetes).
42 This should match a value that the cluster-network-operator
43 understands, or else no networking will be installed. Currently
44 supported values are: - OVNKubernetes This field is immutable
45 after installation.
47 service_network (List[Any]): IP address pool for services. Currently, we only support a single
48 entry here. This field is immutable after installation.
50 service_node_port_range (str): The port range allowed for Services of type NodePort. If not
51 specified, the default of 30000-32767 will be used. Such Services
52 without a NodePort specified will have one automatically allocated
53 from this range. This parameter can be updated after the cluster
54 is installed.
56 """
57 super().__init__(**kwargs)
59 self.cluster_network = cluster_network
60 self.external_ip = external_ip
61 self.network_diagnostics = network_diagnostics
62 self.network_type = network_type
63 self.service_network = service_network
64 self.service_node_port_range = service_node_port_range
66 def to_dict(self) -> None:
67 super().to_dict()
69 if not self.kind_dict and not self.yaml_file:
70 self.res["spec"] = {}
71 _spec = self.res["spec"]
73 if self.cluster_network:
74 _spec["clusterNetwork"] = self.cluster_network
76 if self.external_ip:
77 _spec["externalIP"] = self.external_ip
79 if self.network_diagnostics:
80 _spec["networkDiagnostics"] = self.network_diagnostics
82 if self.network_type:
83 _spec["networkType"] = self.network_type
85 if self.service_network:
86 _spec["serviceNetwork"] = self.service_network
88 if self.service_node_port_range:
89 _spec["serviceNodePortRange"] = self.service_node_port_range
91 # End of generated code