Skip to content

Commit e773c3a

Browse files
committed
Multus ipv6 on vsphere
Signed-off-by: Shay Rozen <[email protected]>
1 parent e865d5e commit e773c3a

7 files changed

+104
-3
lines changed

ocs_ci/deployment/deployment.py

+8
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,10 @@ def deploy_ocs_via_operator(self, image=None):
11451145

11461146
if create_public_net:
11471147
logger.info("Creating Multus public network")
1148+
if config.DEPLOYMENT.get("ipv6"):
1149+
constants.MULTUS_PUBLIC_NET_YAML = (
1150+
constants.MULTUS_PUBLIC_NET_IPV6_YAML
1151+
)
11481152
public_net_data = templating.load_yaml(constants.MULTUS_PUBLIC_NET_YAML)
11491153
public_net_data["metadata"]["name"] = config.ENV_DATA.get(
11501154
"multus_public_net_name"
@@ -1175,6 +1179,10 @@ def deploy_ocs_via_operator(self, image=None):
11751179

11761180
if create_cluster_net:
11771181
logger.info("Creating Multus cluster network")
1182+
if config.DEPLOYMENT.get("ipv6"):
1183+
constants.MULTUS_CLUSTER_NET_YAML = (
1184+
constants.MULTUS_CLUSTER_NET_IPV6_YAML
1185+
)
11781186
cluster_net_data = templating.load_yaml(
11791187
constants.MULTUS_CLUSTER_NET_YAML
11801188
)

ocs_ci/helpers/helpers.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -4870,6 +4870,8 @@ def add_route_public_nad():
48704870
]
48714871
nad_config_dict_string = json.dumps(nad_config_dict)
48724872
logger.info("Creating Multus public network")
4873+
if config.DEPLOYMENT.get("ipv6"):
4874+
constants.MULTUS_PUBLIC_NET_YAML = constants.MULTUS_PUBLIC_NET_IPV6_YAML
48734875
public_net_data = templating.load_yaml(constants.MULTUS_PUBLIC_NET_YAML)
48744876
public_net_data["metadata"]["name"] = config.ENV_DATA.get("multus_public_net_name")
48754877
public_net_data["metadata"]["namespace"] = config.ENV_DATA.get(
@@ -4959,6 +4961,15 @@ def configure_node_network_configuration_policy_on_all_worker_nodes():
49594961
# This function require changes for compact mode
49604962
logger.info("Configure NodeNetworkConfigurationPolicy on all worker nodes")
49614963
worker_node_names = get_worker_nodes()
4964+
ip_version = "ipv4"
4965+
if (
4966+
config.DEPLOYMENT.get("ipv6")
4967+
and config.ENV_DATA.get("platform") == constants.VSPHERE_PLATFORM
4968+
):
4969+
constants.NODE_NETWORK_CONFIGURATION_POLICY = (
4970+
constants.NODE_NETWORK_CONFIGURATION_POLICY_IPV6
4971+
)
4972+
ip_version = "ipv6"
49624973
interface_num = 0
49634974
for worker_node_name in worker_node_names:
49644975
node_network_configuration_policy = templating.load_yaml(
@@ -5001,13 +5012,13 @@ def configure_node_network_configuration_policy_on_all_worker_nodes():
50015012
] = f"ceph-public-net-shim-{worker_node_name}"
50025013
shim_default_ip = node_network_configuration_policy["spec"]["desiredState"][
50035014
"interfaces"
5004-
][0]["ipv4"]["address"][0]["ip"]
5015+
][0][ip_version]["address"][0]["ip"]
50055016

50065017
shim_ip = str(ipaddress.ip_address(shim_default_ip) + interface_num)
50075018
interface_num += 1
50085019

50095020
node_network_configuration_policy["spec"]["desiredState"]["interfaces"][0][
5010-
"ipv4"
5021+
ip_version
50115022
]["address"][0]["ip"] = shim_ip
50125023

50135024
node_network_configuration_policy["spec"]["desiredState"]["interfaces"][0][

ocs_ci/ocs/constants.py

+12
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,18 @@
10471047
NODE_NETWORK_CONFIGURATION_POLICY = os.path.join(
10481048
TEMPLATE_DEPLOYMENT_DIR, "node_network_configuration_policy.yaml"
10491049
)
1050+
1051+
MULTUS_PUBLIC_NET_IPV6_YAML = os.path.join(
1052+
TEMPLATE_DEPLOYMENT_DIR, "multus-public-net-ipv6.yaml"
1053+
)
1054+
MULTUS_CLUSTER_NET_IPV6_YAML = os.path.join(
1055+
TEMPLATE_DEPLOYMENT_DIR, "multus-cluster-net-ipv6.yaml"
1056+
)
1057+
NODE_NETWORK_CONFIGURATION_POLICY_IPV6 = os.path.join(
1058+
TEMPLATE_DEPLOYMENT_DIR, "node_network_configuration_policy_ipv6.yaml"
1059+
)
1060+
1061+
10501062
NETWORK_ATTACHEMENT_DEFINITION = "network-attachment-definitions.k8s.cni.cncf.io"
10511063
VSPHERE_MULTUS_INTERFACE = "ens224"
10521064

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: "k8s.cni.cncf.io/v1"
2+
kind: NetworkAttachmentDefinition
3+
metadata:
4+
name: cluster-net
5+
namespace: openshift-storage
6+
labels: {}
7+
annotations: {}
8+
spec:
9+
config: '{
10+
"cniVersion": "0.3.1",
11+
"type": "macvlan",
12+
"master": "br-ex",
13+
"mode": "bridge",
14+
"ipam": {
15+
"type": "whereabouts",
16+
"range": "fd01:db8:2:1::/96",
17+
"routes": [{"dst": "fd01:db8:3:1::/96"}]
18+
}
19+
}'

ocs_ci/templates/ocs-deployment/multus-cluster-net.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ spec:
1313
"mode": "bridge",
1414
"ipam": {
1515
"type": "whereabouts",
16-
"range": "192.168.30.0/24"
16+
"range": "192.168.30.0/24",
17+
"routes": [{"dst": "192.168.252.0/24"}]
1718
}
1819
}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: "k8s.cni.cncf.io/v1"
2+
kind: NetworkAttachmentDefinition
3+
metadata:
4+
name: public-net
5+
namespace: openshift-storage
6+
labels: {}
7+
annotations: {}
8+
spec:
9+
config: '{
10+
"cniVersion": "0.3.1",
11+
"type": "macvlan",
12+
"master": "br-ex",
13+
"mode": "bridge",
14+
"ipam": {
15+
"type": "whereabouts",
16+
"range": "fd01:db8:1:1::/96",
17+
"routes": [{"dst": "fd01:db8:3:1::/96"}]
18+
}
19+
}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: nmstate.io/v1
2+
kind: NodeNetworkConfigurationPolicy
3+
metadata:
4+
name: ceph-public-net-shim-worker-node
5+
namespace: openshift-storage
6+
spec:
7+
nodeSelector:
8+
node-role.kubernetes.io/worker: ""
9+
kubernetes.io/hostname: worker-node
10+
desiredState:
11+
interfaces:
12+
- name: odf-pub-shim
13+
description: Shim interface used to connect host to OpenShift Data Foundation public Multus network
14+
type: mac-vlan
15+
state: up
16+
mac-vlan:
17+
base-iface: enp1s0f1
18+
mode: bridge
19+
promiscuous: true
20+
ipv6:
21+
enabled: true
22+
dhcp: false
23+
address:
24+
- ip: fd01:db8:3:1::1 # STATIC IP FOR worker node
25+
prefix-length: 96
26+
routes:
27+
config:
28+
- destination: fd01:db8:1:1::/96
29+
next-hop-interface: odf-pub-shim
30+
- destination: fd01:db8:2:1::/96
31+
next-hop-interface: odf-pub-shim

0 commit comments

Comments
 (0)