Skip to content

Commit

Permalink
add deployment code
Browse files Browse the repository at this point in the history
Signed-off-by: oviner <[email protected]>
  • Loading branch information
OdedViner committed May 30, 2024
1 parent d88b15c commit 92d0fbe
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ ENV_DATA:
is_multus_enabled: true
multus_public_net_interface: 'enp1s0f1'
multus_cluster_net_interface: 'enp1s0f1'
worker_node_network_configuration: [
["ceph-public-net-shim-argo005","argo005.ceph.redhat.com","192.168.252.1","24","192.168.20.0/24"],
["ceph-public-net-shim-argo006","argo006.ceph.redhat.com","192.168.252.2","24","192.168.20.0/24"],
["ceph-public-net-shim-argo007","argo007.ceph.redhat.com","192.168.252.3","24","192.168.20.0/24"],
]
REPORTING:
polarion:
deployment_id: 'OCS-2510'
36 changes: 36 additions & 0 deletions ocs_ci/deployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,42 @@ def deploy_ocs_via_operator(self, image=None):

# Create Multus Networks
if config.ENV_DATA.get("is_multus_enabled"):
from ocs_ci.deployment.nmstate import NMStateInstaller

logger.info("Install NMState operator and create an instance")
nmstate_obj = NMStateInstaller()
nmstate_obj.running_nmstate()
logger.info("Configure NodeNetworkConfigurationPolicy on all worker nodes")
network_workers = config.ENV_DATA["worker_node_network_configuration"]
for worker_network_configuration in network_workers:
node_network_configuration_policy = templating.load_yaml(
constants.NODE_NETWORK_CONFIGURATION_POLICY
)
node_network_configuration_policy["spec"]["nodeSelector"][
"kubernetes.io/hostname"
] = worker_network_configuration[1]
node_network_configuration_policy["metadata"][
"name"
] = worker_network_configuration[0]
node_network_configuration_policy["spec"]["desiredState"]["interfaces"][
0
]["ipv4"]["address"][0]["ip"] = worker_network_configuration[2]
node_network_configuration_policy["spec"]["desiredState"]["interfaces"][
0
]["ipv4"]["address"][0]["prefix-length"] = worker_network_configuration[
3
]
node_network_configuration_policy["spec"]["desiredState"]["routes"][
"config"
][0]["destination"] = worker_network_configuration[4]
public_net_yaml = tempfile.NamedTemporaryFile(
mode="w+", prefix="multus_public", delete=False
)
templating.dump_data_to_temp_yaml(
node_network_configuration_policy, public_net_yaml.name
)
run_cmd(f"oc create -f {public_net_yaml.name}")

create_public_net = config.ENV_DATA["multus_create_public_net"]
create_cluster_net = config.ENV_DATA["multus_create_cluster_net"]
interfaces = set()
Expand Down
12 changes: 12 additions & 0 deletions ocs_ci/deployment/nmstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,15 @@ def count_nmstate_pods_running(self, count):
logger.info(f"NMState pod {nmstate_pod_name} in running state")
count_running_nmstate_pods += 1
return count_running_nmstate_pods >= count

def running_nmstate(self):
"""
Install NMState operator and create an instance
"""
self.create_nmstate_operator_namespace()
self.create_nmstate_operatorgroup()
self.create_nmstate_subscription()
self.verify_nmstate_csv_status()
self.create_nmstate_instance()
self.verify_nmstate_pods_running()
1 change: 0 additions & 1 deletion ocs_ci/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4727,7 +4727,6 @@ def flatten_multilevel_dict(d):
return leaves_list


<<<<<<< HEAD
def is_rbd_default_storage_class(custom_sc=None):
"""
Check if RDB is a default storageclass for the cluster
Expand Down
3 changes: 3 additions & 0 deletions ocs_ci/ocs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,9 @@
MULTUS_CLUSTER_NET_YAML = os.path.join(
TEMPLATE_DEPLOYMENT_DIR, "multus-cluster-net.yaml"
)
NODE_NETWORK_CONFIGURATION_POLICY = os.path.join(
TEMPLATE_DEPLOYMENT_DIR, "node_network_configuration_policy.yaml"
)
NETWORK_ATTACHEMENT_DEFINITION = "network-attachment-definitions.k8s.cni.cncf.io"


Expand Down
3 changes: 2 additions & 1 deletion ocs_ci/templates/ocs-deployment/multus-public-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
"mode": "bridge",
"ipam": {
"type": "whereabouts",
"range": "192.168.20.0/24"
"range": "192.168.20.0/24",
"routes": [{"dst": "192.168.252.0/24"}]
}
}'

0 comments on commit 92d0fbe

Please sign in to comment.