mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Cleanup resources after shell tests exit
This commit is contained in:
parent
b786c116b6
commit
8ad671b01e
@ -509,7 +509,7 @@ function kube-up {
|
|||||||
|
|
||||||
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||||
local context="${PROJECT}_${INSTANCE_PREFIX}"
|
local context="${PROJECT}_${INSTANCE_PREFIX}"
|
||||||
local user="${INSTANCE_PREFIX}-admin"
|
local user="${context}-admin"
|
||||||
local config_dir="${HOME}/.kube/${context}"
|
local config_dir="${HOME}/.kube/${context}"
|
||||||
|
|
||||||
# TODO: generate ADMIN (and KUBELET) tokens and put those in the master's
|
# TODO: generate ADMIN (and KUBELET) tokens and put those in the master's
|
||||||
|
@ -37,8 +37,9 @@ prepare-e2e
|
|||||||
|
|
||||||
GUESTBOOK="${KUBE_ROOT}/examples/guestbook"
|
GUESTBOOK="${KUBE_ROOT}/examples/guestbook"
|
||||||
|
|
||||||
|
echo "WARNING: this test is a no op that only attempts to launch guestbook resources."
|
||||||
# Launch the guestbook example
|
# Launch the guestbook example
|
||||||
${KUBECTL} create -f "${GUESTBOOK}"
|
${KUBECTL} create -f "${GUESTBOOK}"
|
||||||
|
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
@ -48,9 +49,7 @@ echo "Pods running: ${POD_LIST_1}"
|
|||||||
# TODO make this an actual test. Open up a firewall and use curl to post and
|
# TODO make this an actual test. Open up a firewall and use curl to post and
|
||||||
# read a message via the frontend
|
# read a message via the frontend
|
||||||
|
|
||||||
${KUBECTL} stop rc redis-slave-controller
|
${KUBECTL} stop -f "${GUESTBOOK}"
|
||||||
${KUBECTL} delete services redis-master
|
|
||||||
${KUBECTL} delete pods redis-master
|
|
||||||
|
|
||||||
POD_LIST_2=$(${KUBECTL} get pods -o template '--template={{range.items}}{{.id}} {{end}}')
|
POD_LIST_2=$(${KUBECTL} get pods -o template '--template={{range.items}}{{.id}} {{end}}')
|
||||||
echo "Pods running after shutdown: ${POD_LIST_2}"
|
echo "Pods running after shutdown: ${POD_LIST_2}"
|
||||||
|
@ -59,7 +59,6 @@ function join() {
|
|||||||
svcs_to_clean=()
|
svcs_to_clean=()
|
||||||
function do_teardown() {
|
function do_teardown() {
|
||||||
local svc
|
local svc
|
||||||
return
|
|
||||||
for svc in "${svcs_to_clean[@]:+${svcs_to_clean[@]}}"; do
|
for svc in "${svcs_to_clean[@]:+${svcs_to_clean[@]}}"; do
|
||||||
stop_service "${svc}"
|
stop_service "${svc}"
|
||||||
done
|
done
|
||||||
@ -284,7 +283,7 @@ function verify_from_container() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
trap "do_teardown" EXIT
|
trap do_teardown EXIT
|
||||||
|
|
||||||
# Get node IP addresses and pick one as our test point.
|
# Get node IP addresses and pick one as our test point.
|
||||||
detect-minions
|
detect-minions
|
||||||
|
Loading…
Reference in New Issue
Block a user