Skip to content

Commit 2b0a2a6

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

8 files changed

+122
-13
lines changed

ocs_ci/deployment/deployment.py

+24-10
Original file line numberDiff line numberDiff line change
@@ -1144,8 +1144,11 @@ def deploy_ocs_via_operator(self, image=None):
11441144
node_obj.exec_oc_debug_cmd(node=node, cmd_list=[ip_link_cmd])
11451145

11461146
if create_public_net:
1147+
nad_to_load = constants.MULTUS_PUBLIC_NET_YAML
11471148
logger.info("Creating Multus public network")
1148-
public_net_data = templating.load_yaml(constants.MULTUS_PUBLIC_NET_YAML)
1149+
if config.DEPLOYMENT.get("ipv6"):
1150+
nad_to_load = constants.MULTUS_PUBLIC_NET_IPV6_YAML
1151+
public_net_data = templating.load_yaml(nad_to_load)
11491152
public_net_data["metadata"]["name"] = config.ENV_DATA.get(
11501153
"multus_public_net_name"
11511154
)
@@ -1157,9 +1160,14 @@ def deploy_ocs_via_operator(self, image=None):
11571160
public_net_config_dict["master"] = config.ENV_DATA.get(
11581161
"multus_public_net_interface"
11591162
)
1160-
public_net_config_dict["ipam"]["range"] = config.ENV_DATA.get(
1161-
"multus_public_net_range"
1162-
)
1163+
if not config.DEPLOYMENT.get("ipv6"):
1164+
public_net_config_dict["ipam"]["range"] = config.ENV_DATA.get(
1165+
"multus_public_net_range"
1166+
)
1167+
else:
1168+
public_net_config_dict["ipam"]["range"] = config.ENV_DATA.get(
1169+
"multus_public_ipv6_net_range"
1170+
)
11631171
public_net_config_dict["type"] = config.ENV_DATA.get(
11641172
"multus_public_net_type"
11651173
)
@@ -1175,6 +1183,10 @@ def deploy_ocs_via_operator(self, image=None):
11751183

11761184
if create_cluster_net:
11771185
logger.info("Creating Multus cluster network")
1186+
if config.DEPLOYMENT.get("ipv6"):
1187+
constants.MULTUS_CLUSTER_NET_YAML = (
1188+
constants.MULTUS_CLUSTER_NET_IPV6_YAML
1189+
)
11781190
cluster_net_data = templating.load_yaml(
11791191
constants.MULTUS_CLUSTER_NET_YAML
11801192
)
@@ -1189,12 +1201,14 @@ def deploy_ocs_via_operator(self, image=None):
11891201
cluster_net_config_dict["master"] = config.ENV_DATA.get(
11901202
"multus_cluster_net_interface"
11911203
)
1192-
cluster_net_config_dict["ipam"]["range"] = config.ENV_DATA.get(
1193-
"multus_cluster_net_range"
1194-
)
1195-
cluster_net_config_dict["type"] = config.ENV_DATA.get(
1196-
"multus_cluster_net_type"
1197-
)
1204+
if not config.DEPLOYMENT.get("ipv6"):
1205+
cluster_net_config_dict["ipam"]["range"] = config.ENV_DATA.get(
1206+
"multus_cluster_net_range"
1207+
)
1208+
else:
1209+
cluster_net_config_dict["type"] = config.ENV_DATA.get(
1210+
"multus_cluster_ipv6_net_type"
1211+
)
11981212
cluster_net_config_dict["mode"] = config.ENV_DATA.get(
11991213
"multus_cluster_net_mode"
12001214
)

ocs_ci/framework/conf/default_config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,15 @@ ENV_DATA:
264264
multus_public_net_namespace: "openshift-storage"
265265
multus_public_net_interface: "br-ex"
266266
multus_public_net_range: "192.168.20.0/24"
267+
multus_public_ipv6_net_range: "fd01:db8:1:1::/96"
267268
multus_public_net_type: "macvlan"
268269
multus_public_net_mode: "bridge"
269270
multus_create_cluster_net: true
270271
multus_cluster_net_name: "private-net"
271272
multus_cluster_net_namespace: "openshift-storage"
272273
multus_cluster_net_interface: "br-ex"
273274
multus_cluster_net_range: "192.168.30.0/24"
275+
multus_cluster__ipv6_net_range: "fd01:db8:2:1::/96"
274276
multus_cluster_net_type: "macvlan"
275277
multus_cluster_net_mode: "bridge"
276278
multus_destination_route: "192.168.252.0/24"

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)