diff --git a/ocs_ci/deployment/deployment.py b/ocs_ci/deployment/deployment.py index d9dd0ec7759..7d1ad5d1b13 100644 --- a/ocs_ci/deployment/deployment.py +++ b/ocs_ci/deployment/deployment.py @@ -1145,6 +1145,10 @@ def deploy_ocs_via_operator(self, image=None): if create_public_net: logger.info("Creating Multus public network") + if config.DEPLOYMENT.get("ipv6"): + constants.MULTUS_PUBLIC_NET_YAML = ( + constants.MULTUS_PUBLIC_NET_IPV6_YAML + ) public_net_data = templating.load_yaml(constants.MULTUS_PUBLIC_NET_YAML) public_net_data["metadata"]["name"] = config.ENV_DATA.get( "multus_public_net_name" @@ -1175,6 +1179,10 @@ def deploy_ocs_via_operator(self, image=None): if create_cluster_net: logger.info("Creating Multus cluster network") + if config.DEPLOYMENT.get("ipv6"): + constants.MULTUS_CLUSTER_NET_YAML = ( + constants.MULTUS_CLUSTER_NET_IPV6_YAML + ) cluster_net_data = templating.load_yaml( constants.MULTUS_CLUSTER_NET_YAML ) diff --git a/ocs_ci/helpers/helpers.py b/ocs_ci/helpers/helpers.py index b0fad161afd..54e0941df78 100644 --- a/ocs_ci/helpers/helpers.py +++ b/ocs_ci/helpers/helpers.py @@ -4870,6 +4870,8 @@ def add_route_public_nad(): ] nad_config_dict_string = json.dumps(nad_config_dict) logger.info("Creating Multus public network") + if config.DEPLOYMENT.get("ipv6"): + constants.MULTUS_PUBLIC_NET_YAML = constants.MULTUS_PUBLIC_NET_IPV6_YAML public_net_data = templating.load_yaml(constants.MULTUS_PUBLIC_NET_YAML) public_net_data["metadata"]["name"] = config.ENV_DATA.get("multus_public_net_name") public_net_data["metadata"]["namespace"] = config.ENV_DATA.get( @@ -4959,6 +4961,15 @@ def configure_node_network_configuration_policy_on_all_worker_nodes(): # This function require changes for compact mode logger.info("Configure NodeNetworkConfigurationPolicy on all worker nodes") worker_node_names = get_worker_nodes() + ip_version = "ipv4" + if ( + config.DEPLOYMENT.get("ipv6") + and config.ENV_DATA.get("platform") == constants.VSPHERE_PLATFORM + ): + constants.NODE_NETWORK_CONFIGURATION_POLICY = ( + constants.NODE_NETWORK_CONFIGURATION_POLICY_IPV6 + ) + ip_version = "ipv6" interface_num = 0 for worker_node_name in worker_node_names: node_network_configuration_policy = templating.load_yaml( @@ -5001,13 +5012,13 @@ def configure_node_network_configuration_policy_on_all_worker_nodes(): ] = f"ceph-public-net-shim-{worker_node_name}" shim_default_ip = node_network_configuration_policy["spec"]["desiredState"][ "interfaces" - ][0]["ipv4"]["address"][0]["ip"] + ][0][ip_version]["address"][0]["ip"] shim_ip = str(ipaddress.ip_address(shim_default_ip) + interface_num) interface_num += 1 node_network_configuration_policy["spec"]["desiredState"]["interfaces"][0][ - "ipv4" + ip_version ]["address"][0]["ip"] = shim_ip node_network_configuration_policy["spec"]["desiredState"]["interfaces"][0][ diff --git a/ocs_ci/ocs/constants.py b/ocs_ci/ocs/constants.py index 97c62d4db6e..02ba43e07b1 100644 --- a/ocs_ci/ocs/constants.py +++ b/ocs_ci/ocs/constants.py @@ -1047,6 +1047,18 @@ NODE_NETWORK_CONFIGURATION_POLICY = os.path.join( TEMPLATE_DEPLOYMENT_DIR, "node_network_configuration_policy.yaml" ) + +MULTUS_PUBLIC_NET_IPV6_YAML = os.path.join( + TEMPLATE_DEPLOYMENT_DIR, "multus-public-net-ipv6.yaml" +) +MULTUS_CLUSTER_NET_IPV6_YAML = os.path.join( + TEMPLATE_DEPLOYMENT_DIR, "multus-cluster-net-ipv6.yaml" +) +NODE_NETWORK_CONFIGURATION_POLICY_IPV6 = os.path.join( + TEMPLATE_DEPLOYMENT_DIR, "node_network_configuration_policy_ipv6.yaml" +) + + NETWORK_ATTACHEMENT_DEFINITION = "network-attachment-definitions.k8s.cni.cncf.io" VSPHERE_MULTUS_INTERFACE = "ens224" diff --git a/ocs_ci/templates/ocs-deployment/multus-cluster-net-ipv6.yaml b/ocs_ci/templates/ocs-deployment/multus-cluster-net-ipv6.yaml new file mode 100644 index 00000000000..c09e3e864b8 --- /dev/null +++ b/ocs_ci/templates/ocs-deployment/multus-cluster-net-ipv6.yaml @@ -0,0 +1,19 @@ +apiVersion: "k8s.cni.cncf.io/v1" +kind: NetworkAttachmentDefinition +metadata: + name: cluster-net + namespace: openshift-storage + labels: {} + annotations: {} +spec: + config: '{ + "cniVersion": "0.3.1", + "type": "macvlan", + "master": "br-ex", + "mode": "bridge", + "ipam": { + "type": "whereabouts", + "range": "fd01:db8:2:1::/96", + "routes": [{"dst": "fd01:db8:3:1::/96"}] + } + }' diff --git a/ocs_ci/templates/ocs-deployment/multus-cluster-net.yaml b/ocs_ci/templates/ocs-deployment/multus-cluster-net.yaml index 0af114dba6b..3e4b40ef47a 100644 --- a/ocs_ci/templates/ocs-deployment/multus-cluster-net.yaml +++ b/ocs_ci/templates/ocs-deployment/multus-cluster-net.yaml @@ -13,6 +13,7 @@ spec: "mode": "bridge", "ipam": { "type": "whereabouts", - "range": "192.168.30.0/24" + "range": "192.168.30.0/24", + "routes": [{"dst": "192.168.252.0/24"}] } }' diff --git a/ocs_ci/templates/ocs-deployment/multus-public-net-ipv6.yaml b/ocs_ci/templates/ocs-deployment/multus-public-net-ipv6.yaml new file mode 100644 index 00000000000..f2b5de7deec --- /dev/null +++ b/ocs_ci/templates/ocs-deployment/multus-public-net-ipv6.yaml @@ -0,0 +1,19 @@ +apiVersion: "k8s.cni.cncf.io/v1" +kind: NetworkAttachmentDefinition +metadata: + name: public-net + namespace: openshift-storage + labels: {} + annotations: {} +spec: + config: '{ + "cniVersion": "0.3.1", + "type": "macvlan", + "master": "br-ex", + "mode": "bridge", + "ipam": { + "type": "whereabouts", + "range": "fd01:db8:1:1::/96", + "routes": [{"dst": "fd01:db8:3:1::/96"}] + } + }' diff --git a/ocs_ci/templates/ocs-deployment/node_network_configuration_policy_ipv6.yaml b/ocs_ci/templates/ocs-deployment/node_network_configuration_policy_ipv6.yaml new file mode 100644 index 00000000000..f41ba994732 --- /dev/null +++ b/ocs_ci/templates/ocs-deployment/node_network_configuration_policy_ipv6.yaml @@ -0,0 +1,31 @@ +apiVersion: nmstate.io/v1 +kind: NodeNetworkConfigurationPolicy +metadata: + name: ceph-public-net-shim-worker-node + namespace: openshift-storage +spec: + nodeSelector: + node-role.kubernetes.io/worker: "" + kubernetes.io/hostname: worker-node + desiredState: + interfaces: + - name: odf-pub-shim + description: Shim interface used to connect host to OpenShift Data Foundation public Multus network + type: mac-vlan + state: up + mac-vlan: + base-iface: enp1s0f1 + mode: bridge + promiscuous: true + ipv6: + enabled: true + dhcp: false + address: + - ip: fd01:db8:3:1::1 # STATIC IP FOR worker node + prefix-length: 96 + routes: + config: + - destination: fd01:db8:1:1::/96 + next-hop-interface: odf-pub-shim + - destination: fd01:db8:2:1::/96 + next-hop-interface: odf-pub-shim