mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-04 09:05:31 -05:00
ci: fix recover test (#2162)
* ci: fix recover test Previously the test failed if not all nodes were recovered by the cli. * ci: refactor recover test
This commit is contained in:
parent
89b342900f
commit
c43210c90b
19
.github/actions/e2e_recover/action.yml
vendored
19
.github/actions/e2e_recover/action.yml
vendored
@ -14,22 +14,24 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Restart worker node
|
- name: Restart worker node
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
||||||
run: |
|
run: |
|
||||||
WORKER_NODE=$(kubectl get nodes --selector='!node-role.kubernetes.io/control-plane' -o json | jq '.items[0].metadata.name' -r)
|
WORKER_NODE=$(kubectl get nodes --selector='!node-role.kubernetes.io/control-plane' -o json | jq '.items[0].metadata.name' -r)
|
||||||
kubectl debug node/$WORKER_NODE --image=ubuntu -- bash -c "echo reboot > reboot.sh && chroot /host < reboot.sh"
|
kubectl debug node/$WORKER_NODE --image=ubuntu -- bash -c "echo reboot > reboot.sh && chroot /host < reboot.sh"
|
||||||
kubectl wait --for=condition=Ready=false --timeout=10m node/$WORKER_NODE
|
kubectl wait --for=condition=Ready=false --timeout=10m node/$WORKER_NODE
|
||||||
kubectl wait --for=condition=Ready=true --timeout=10m --all nodes
|
kubectl wait --for=condition=Ready=true --timeout=10m --all nodes
|
||||||
env:
|
|
||||||
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
||||||
- name: Restart all control plane nodes
|
- name: Restart all control plane nodes
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
||||||
run: |
|
run: |
|
||||||
CONTROL_PLANE_NODES=$(kubectl get nodes --selector='node-role.kubernetes.io/control-plane' -o json | jq '.items[].metadata.name' -r)
|
CONTROL_PLANE_NODES=$(kubectl get nodes --selector='node-role.kubernetes.io/control-plane' -o json | jq '.items[].metadata.name' -r)
|
||||||
for CONTROL_PLANE_NODE in ${CONTROL_PLANE_NODES}; do
|
for CONTROL_PLANE_NODE in ${CONTROL_PLANE_NODES}; do
|
||||||
kubectl debug node/$CONTROL_PLANE_NODE --image=ubuntu -- bash -c "echo reboot > reboot.sh && chroot /host < reboot.sh"
|
kubectl debug node/$CONTROL_PLANE_NODE --image=ubuntu -- bash -c "echo reboot > reboot.sh && chroot /host < reboot.sh"
|
||||||
done
|
done
|
||||||
env:
|
|
||||||
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
||||||
- name: Constellation recover
|
- name: Constellation recover
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@ -42,7 +44,7 @@ runs:
|
|||||||
echo "$output"
|
echo "$output"
|
||||||
i=$(echo "$output" | grep -o "Pushed recovery key." | wc -l | sed 's/ //g')
|
i=$(echo "$output" | grep -o "Pushed recovery key." | wc -l | sed 's/ //g')
|
||||||
recovered=$((recovered+i))
|
recovered=$((recovered+i))
|
||||||
if [[ $recovered -eq ${{ inputs.controlNodesCount }} ]]; then
|
if [[ $recovered -gt ${{ inputs.controlNodesCount }}/2 ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -53,11 +55,14 @@ runs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Did not recover all nodes yet, retrying in 5 seconds [$recovered/${{ inputs.controlNodesCount }}]"
|
echo "Did not recover a quorum (>${{inputs.controlNodesCount}}/2) of control-plane nodes yet, retrying in 5 seconds [$recovered/${{ inputs.controlNodesCount }}]"
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Wait for control plane to get back up
|
- name: Wait for control plane to get back up
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
||||||
run: |
|
run: |
|
||||||
timeout=600
|
timeout=600
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
@ -77,5 +82,3 @@ runs:
|
|||||||
echo "Cannot reach control plane, retrying in 10 seconds"
|
echo "Cannot reach control plane, retrying in 10 seconds"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
env:
|
|
||||||
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user