Skip to content
This repository was archived by the owner on Mar 23, 2020. It is now read-only.

Commit 9a2e696

Browse files
committed
configure linux bridge as the default network interface
Signed-off-by: Petr Horacek <[email protected]>
1 parent 61ea368 commit 9a2e696

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

CNV/cnv-2.1.0.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,47 @@ metadata:
154154
namespace: "${TARGET_NAMESPACE}"
155155
spec: {}
156156
EOF
157+
158+
echo "Waiting for HCO to get fully deployed"
159+
oc wait -n ${TARGET_NAMESPACE} hyperconverged hyperconverged-cluster --for condition=Available --timeout=10m
160+
161+
echo "Configuring network on nodes"
162+
163+
echo "Detecting the default interface"
164+
machineCIDR=$(grep 'machineCIDR' ../OpenShift/install-config.yaml | sed 's/\(.*\): *\(.*\)/\2/')
165+
while ! default_iface=$(oc get nodenetworkstate ${node} -o jsonpath="{.items[0].status.currentState.routes.running[?(@.destination==\"${machineCIDR}\")].next-hop-interface}" | cut -d " " -f 1); do
166+
sleep 10
167+
done
168+
169+
echo "Applying node network configuration policy"
170+
cat <<EOF | oc apply -f -
171+
apiVersion: nmstate.io/v1alpha1
172+
kind: NodeNetworkConfigurationPolicy
173+
metadata:
174+
name: kni-policy
175+
spec:
176+
desiredState:
177+
interfaces:
178+
- name: brext
179+
type: linux-bridge
180+
state: up
181+
ipv4:
182+
dhcp: true
183+
enabled: true
184+
ipv6:
185+
dhcp: true
186+
enabled: true
187+
bridge:
188+
options:
189+
stp:
190+
enabled: false
191+
port:
192+
- name: ${default_iface}
193+
EOF
194+
195+
echo "Waiting until the configuration is done"
196+
nodes=$(oc get nodes -o jsonpath='{range .items[*]}{.metadata.name} {end}')
197+
for node in $nodes; do
198+
until [ "$(oc get nodenetworkstate ${node} -o jsonpath="{.status.currentState.routes.running[?(@.destination==\"${machineCIDR}\")].next-hop-interface}")" == "brext" ]; do sleep 10; done
199+
done
200+
oc wait node --all --for condition=Ready --timeout=10m

0 commit comments

Comments
 (0)