Skip to content
This repository was archived by the owner on Mar 23, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CNV/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ all: deploy

deploy:
./cnv-2.1.0.sh
./configure-network.sh

upgrade:
./cnv-upgrade.sh
3 changes: 3 additions & 0 deletions CNV/cnv-2.1.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
61 changes: 61 additions & 0 deletions CNV/configure-network.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF | oc apply -f -
apiVersion: nmstate.io/v1alpha1
kind: NodeNetworkConfigurationPolicy
metadata:
name: kni-${node}
spec:
nodeSelector:
kubernetes.io/hostname: ${node}
desiredState:
interfaces:
- name: ${BRIDGE_NAME}
type: linux-bridge
state: up
mac-address: ${default_iface_mac}
ipv4:
dhcp: true
enabled: true
ipv6:
dhcp: true
enabled: true
bridge:
options:
stp:
enabled: false
port:
- name: ${default_iface}
EOF
done

echo "Waiting until the configuration is done, it may take up to 5 minutes until keepalived gets reconfigured"
for node in $nodes; do
until [ "$(oc get nodenetworkstate ${node} -o jsonpath="{.status.currentState.routes.running[?(@.destination==\"${MACHINE_CIDR}\")].next-hop-interface}")" == "${BRIDGE_NAME}" ]; do sleep 10; done
oc wait node ${node} --for condition=Ready --timeout=10m
done
25 changes: 0 additions & 25 deletions OpenShift/99_post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,8 @@ source common.sh
export KUBECONFIG=${KUBECONFIG:-ocp/auth/kubeconfig}
POSTINSTALL_ASSETS_DIR="./assets/post-install"
IFCFG_INTERFACE="${POSTINSTALL_ASSETS_DIR}/ifcfg-interface.template"
IFCFG_BRIDGE="${POSTINSTALL_ASSETS_DIR}/ifcfg-bridge.template"
BREXT_FILE="${POSTINSTALL_ASSETS_DIR}/99-brext-master.yaml"
MACHINE_DATA_PATCH_DIR="../preflight"

export bridge="${bridge:-brext}"

create_bridge(){
echo "Deploying Bridge ${bridge}..."

FIRST_MASTER=$(oc get node -o custom-columns=IP:.status.addresses[0].address --no-headers | head -1)
export interface=$(ssh -q -o StrictHostKeyChecking=no core@$FIRST_MASTER "ip r | grep default | grep -Po '(?<=dev )(\S+)'")
if [ "$interface" == "" ] ; then
echo "Issue detecting interface to use! Leaving..."
exit 1
fi
if [ "$interface" != "$bridge" ] ; then
echo "Using interface $interface"
export interface_content=$(envsubst < ${IFCFG_INTERFACE} | base64 -w0)
export bridge_content=$(envsubst < ${IFCFG_BRIDGE} | base64 -w0)
envsubst < ${BREXT_FILE}.template > ${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
Expand Down Expand Up @@ -229,6 +205,5 @@ function add-machine-ips() {
}

add-machine-ips
create_bridge
create_ntp_config
apply_mc
22 changes: 0 additions & 22 deletions OpenShift/assets/post-install/99-brext-master.yaml.template

This file was deleted.

8 changes: 0 additions & 8 deletions OpenShift/assets/post-install/ifcfg-bridge.template

This file was deleted.

5 changes: 0 additions & 5 deletions OpenShift/assets/post-install/ifcfg-interface.template

This file was deleted.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down