Skip to content

Commit

Permalink
UPSTREAM: <carry>: Add machineconfigs before running e2e tests on OCP
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Stäbler <cstabler@redhat.com>
(cherry picked from commit 4fe0d7a)
(cherry picked from commit 83bd895)
(cherry picked from commit b322f05)
(cherry picked from commit 8c1a3dd)
(cherry picked from commit a991847)
(cherry picked from commit 42479c5)
(cherry picked from commit fa55fa8)
(cherry picked from commit 7b97ef5)
(cherry picked from commit 22bf379)
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
(cherry picked from commit f4d155a)
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
  • Loading branch information
creydr authored and dougsland committed Mar 15, 2023
1 parent bd707db commit 0b432c9
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ test-e2e-upgrade: manifests

test-e2e: test-e2e-operator test-e2e-handler

test-e2e-ocp:
./hack/ocp-e2e-tests.sh

cluster-up:
./cluster/up.sh

Expand Down
16 changes: 16 additions & 0 deletions hack/ocp-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ export PRIMARY_NIC=enp2s0
export FIRST_SECONDARY_NIC=enp3s0
export SECOND_SECONDARY_NIC=enp4s0

if oc get ns openshift-ovn-kubernetes &> /dev/null; then
# We are using OVNKubernetes -> use enp1s0 as primary nic
export PRIMARY_NIC=enp1s0
fi

# Apply machine configs and wait until machine config pools got updated
old_mcp_generation=$(oc get mcp master -o jsonpath={.metadata.generation})
if oc create -f test/e2e/machineconfigs.yaml; then
# If MCs could be created, wait until the MCP are aware of new machine configs
while [ "$old_mcp_generation" -eq "$(oc get mcp master -o jsonpath={.metadata.generation})" ]; do
echo "waiting for MCP update to start...";
sleep 1;
done
fi
while ! oc wait mcp --all --for=condition=Updated --timeout -1s; do sleep 1; done

make cluster-sync-operator
# Will fail on subsequent runs, this is fine.
oc create -f build/_output/manifests/scc.yaml || :
Expand Down
52 changes: 52 additions & 0 deletions test/e2e/machineconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 10-nmstate-hack-master
spec:
config:
ignition:
version: 3.2.0
systemd:
units:
- contents: |
[Unit]
Description=NMState e2e hack
Wants=crio.service
Before=kubelet.service
After=crio.service
[Service]
Type=oneshot
ExecStart=/bin/bash -c "for i in $(nmcli --fields NAME,UUID -t con show | grep 'Wired Connection' | awk -F : '{print $2}'); do nmcli con modify $i match.interface-name '!enp3s0, !enp4s0'; done"
[Install]
WantedBy=multi-user.target
enabled: true
name: nmstate-hack.service
---
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: 10-nmstate-hack-worker
spec:
config:
ignition:
version: 3.2.0
systemd:
units:
- contents: |
[Unit]
Description=NMState e2e hack
Wants=crio.service
Before=kubelet.service
After=crio.service
[Service]
Type=oneshot
ExecStart=/bin/bash -c "for i in $(nmcli --fields NAME,UUID -t con show | grep 'Wired Connection' | awk -F : '{print $2}'); do nmcli con modify $i match.interface-name '!enp3s0, !enp4s0'; done"
[Install]
WantedBy=multi-user.target
enabled: true
name: nmstate-hack.service

0 comments on commit 0b432c9

Please sign in to comment.