mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-31 16:36:38 +00:00
kata-deploy: Add reset_cri_runtime()
This will help to avoid code duplication on what's needed on the helm and non-helm cases. The reason it's not been added as part of the commit which adds the post-delete hook is simply for helping the reviewer (as the diff would be less readable with this change). Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
This commit is contained in:
@@ -552,6 +552,18 @@ function remove_artifacts() {
|
||||
fi
|
||||
}
|
||||
|
||||
function restart_cri_runtime() {
|
||||
local runtime="${1}"
|
||||
|
||||
if [ "${runtime}" == "k0s-worker" ] || [ "${runtime}" == "k0s-controller" ]; then
|
||||
# do nothing, k0s will automatically unload the config on the fly
|
||||
:
|
||||
else
|
||||
host_systemctl daemon-reload
|
||||
host_systemctl restart "${runtime}"
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_cri_runtime() {
|
||||
case $1 in
|
||||
crio)
|
||||
@@ -565,13 +577,7 @@ function cleanup_cri_runtime() {
|
||||
[ "${HELM_POST_DELETE_HOOK}" == "false" ] && return
|
||||
|
||||
# Only run this code in the HELM_POST_DELETE_HOOK
|
||||
if [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then
|
||||
# do nothing, k0s will automatically unload the config on the fly
|
||||
:
|
||||
else
|
||||
host_systemctl daemon-reload
|
||||
host_systemctl restart "$1"
|
||||
fi
|
||||
restart_cri_runtime "$1"
|
||||
}
|
||||
|
||||
function cleanup_crio() {
|
||||
@@ -590,13 +596,7 @@ function cleanup_containerd() {
|
||||
|
||||
function reset_runtime() {
|
||||
kubectl label node "$NODE_NAME" katacontainers.io/kata-runtime-
|
||||
if [ "$1" == "k0s-worker" ] || [ "$1" == "k0s-controller" ]; then
|
||||
# do nothing, k0s will auto restart
|
||||
:
|
||||
else
|
||||
host_systemctl daemon-reload
|
||||
host_systemctl restart "$1"
|
||||
fi
|
||||
restart_cri_runtime "$1"
|
||||
|
||||
if [ "$1" == "crio" ] || [ "$1" == "containerd" ]; then
|
||||
host_systemctl restart kubelet
|
||||
|
Reference in New Issue
Block a user