diff --git a/CNV/Makefile b/CNV/Makefile index c17958e..4ab34f8 100644 --- a/CNV/Makefile +++ b/CNV/Makefile @@ -6,6 +6,7 @@ all: deploy deploy: ./cnv-2.1.0.sh + ./configure-network.sh upgrade: ./cnv-upgrade.sh diff --git a/CNV/cnv-2.1.0.sh b/CNV/cnv-2.1.0.sh index 3432fae..617f2fe 100755 --- a/CNV/cnv-2.1.0.sh +++ b/CNV/cnv-2.1.0.sh @@ -162,3 +162,6 @@ metadata: spec: BareMetalPlatform: true EOF + +echo "Waiting for HCO to get fully deployed" +oc wait -n ${TARGET_NAMESPACE} hyperconverged hyperconverged-cluster --for condition=Available --timeout=10m diff --git a/CNV/configure-network.sh b/CNV/configure-network.sh new file mode 100755 index 0000000..ce84150 --- /dev/null +++ b/CNV/configure-network.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +set -ex + +MACHINE_CIDR=$(grep 'machineCIDR' ../OpenShift/install-config.yaml | sed 's/\(.*\): *\(.*\)/\2/') +BRIDGE_NAME=brext + +export KUBECONFIG=${KUBECONFIG:-../OpenShift/ocp/auth/kubeconfig} + +nodes=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name} {end}') + +echo "Configuring networks on nodes" +for node in $nodes; do + echo "Detecting the default interface" + while ! default_iface=$(oc get nodenetworkstate ${node} -o jsonpath="{.status.currentState.routes.running[?(@.destination==\"${MACHINE_CIDR}\")].next-hop-interface}" | cut -d " " -f 1); do + sleep 10 + done + + if [ "${default_iface}" == "${BRIDGE_NAME}" ]; then + echo "Bridge ${BRIDGE_NAME} seems to be already configured as the default interface on node ${node}, skipping the rest of network setup" + continue + fi + + echo "Detecting MAC address of the default interface" + default_iface_mac=$(oc get nodenetworkstate ${node} -o jsonpath="{.status.currentState.interfaces[?(@.name==\"${default_iface}\")].mac-address}") + + echo "Applying node network configuration policy" + cat < ${BREXT_FILE} - echo "Done creating bridge definition" - else - echo "Bridge already there!" - fi -} - apply_mc(){ # Disable auto reboot hosts in order to apply several mcos at the same time for node_type in master worker; do @@ -229,6 +205,5 @@ function add-machine-ips() { } add-machine-ips -create_bridge create_ntp_config apply_mc diff --git a/OpenShift/assets/post-install/99-brext-master.yaml.template b/OpenShift/assets/post-install/99-brext-master.yaml.template deleted file mode 100644 index d0e6225..0000000 --- a/OpenShift/assets/post-install/99-brext-master.yaml.template +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -metadata: - labels: - machineconfiguration.openshift.io/role: master - name: 99-brext-master -spec: - config: - ignition: - version: 2.2.0 - storage: - files: - - contents: - source: data:text/plain;charset=utf-8;base64,${interface_content} - filesystem: root - mode: 0644 - path: /etc/sysconfig/network-scripts/ifcfg-${interface} - - contents: - source: data:text/plain;charset=utf-8;base64,${bridge_content} - filesystem: root - mode: 0644 - path: /etc/sysconfig/network-scripts/ifcfg-${bridge} diff --git a/OpenShift/assets/post-install/ifcfg-bridge.template b/OpenShift/assets/post-install/ifcfg-bridge.template deleted file mode 100644 index ac4de35..0000000 --- a/OpenShift/assets/post-install/ifcfg-bridge.template +++ /dev/null @@ -1,8 +0,0 @@ -DEVICE=${bridge} -NAME=${bridge} -TYPE=Bridge -ONBOOT=yes -NM_CONTROLLED=yes -BOOTPROTO=dhcp -BRIDGING_OPTS=vlan_filtering=1 -BRIDGE_VLANS="1 pvid untagged,20,300-400 untagged" diff --git a/OpenShift/assets/post-install/ifcfg-interface.template b/OpenShift/assets/post-install/ifcfg-interface.template deleted file mode 100644 index c010bc6..0000000 --- a/OpenShift/assets/post-install/ifcfg-interface.template +++ /dev/null @@ -1,5 +0,0 @@ -DEVICE=${interface} -BRIDGE=${bridge} -ONBOOT=yes -NM_CONTROLLED=yes -BOOTPROTO=none diff --git a/README.md b/README.md index 59bff42..20629aa 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,12 @@ The deployment process will use scripts to perform the following on the configur (#5)](https://github.com/openshift-kni/install-scripts/issues/5) for image storage. 1. [Deploy - CNV](https://github.com/openshift-kni/install-scripts/blob/master/CNV/deploy-cnv.sh). [Configure - a bridge on the `External` interface on OpenShift nodes - (#18)](https://github.com/openshift-kni/install-scripts/issues/18) - to allow VMs access this network. + CNV](https://github.com/openshift-kni/install-scripts/blob/master/CNV/deploy-cnv.sh). +1. [Configure host + networking](https://github.com/openshift-kni/install-scripts/blob/master/CNV/configure-network.sh) + by running `cd CNV && ./configure-network.sh`. That will create a linux + bridge on top of the default interface. Please note that when a new node is + added, the configuration script has to be retriggered. 1. Temporarily install Ripsaw, carry out some performance tests, and capture the results.