@@ -154,3 +154,70 @@ metadata:
154
154
namespace: "${TARGET_NAMESPACE} "
155
155
spec: {}
156
156
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 " Applying new network configuration on all nodes, one by one, in order to sustain quorum"
162
+ machineCIDR=$( grep ' machineCIDR' ../OpenShift/install-config.yaml | sed ' s/\(.*\): *\(.*\)/\2/' )
163
+ storageCIDR=" 172.22.0.0/24" # TODO: get from a config file
164
+ nodes=$( oc get nodes -o jsonpath=' {range .items[*]}{.metadata.name} {end}' )
165
+ for node in $nodes ; do
166
+ echo " Setting up node ${node} network"
167
+
168
+ while ! default_iface=$( oc get nodenetworkstate ${node} -o jsonpath=" {.status.currentState.routes.running[?(@.destination==\" ${machineCIDR} \" )].next-hop-interface}" | cut -d " " -f 1) ; do
169
+ sleep 10
170
+ done
171
+
172
+ while ! secondary_iface=$( oc get nodenetworkstate ${node} -o jsonpath=" {.status.currentState.routes.running[?(@.destination==\" ${storageCIDR} \" )].next-hop-interface}" | cut -d " " -f 1) ; do
173
+ sleep 10
174
+ done
175
+
176
+ # TODO: break if already configured
177
+
178
+ cat << EOF | oc apply -f -
179
+ apiVersion: nmstate.io/v1alpha1
180
+ kind: NodeNetworkConfigurationPolicy
181
+ metadata:
182
+ name: kni-policy-${node}
183
+ spec:
184
+ nodeSelector:
185
+ kubernetes.io/hostname: ${node}
186
+ desiredState:
187
+ interfaces:
188
+ - name: brext
189
+ type: linux-bridge
190
+ state: up
191
+ ipv4:
192
+ dhcp: true
193
+ enabled: true
194
+ ipv6:
195
+ dhcp: true
196
+ enabled: true
197
+ bridge:
198
+ port:
199
+ - name: ${default_iface}
200
+ - name: vlan20
201
+ type: vlan
202
+ state: up
203
+ vlan:
204
+ base-iface: ${secondary_iface}
205
+ id: 20
206
+ ipv4:
207
+ enabled: false
208
+ # TODO: enable IP config once we know what is the right VLAN and have DHCP server running on it
209
+ # enabled: true
210
+ # dhcp: true
211
+ # auto-gateway: false
212
+ ipv6:
213
+ enabled: false
214
+ # TODO: enable IP config once we know what is the right VLAN and have DHCP server running on it
215
+ # enabled: true
216
+ # dhcp: true
217
+ # auto-gateway: false
218
+ EOF
219
+
220
+ echo " Wait until the configuration is done"
221
+ until [ " $( oc get nodenetworkstate ${node} -o jsonpath=" {.status.currentState.routes.running[?(@.destination==\" ${machineCIDR} \" )].next-hop-interface}" ) " == " brext" ]; do sleep 10; done
222
+ oc wait node ${node} --for condition=Ready --timeout=5m
223
+ done
0 commit comments