Adjust containerd kubelet configuration for crio runtime

Related-Prod: PRODX-3456
Change-Id: Ic5593e606cdf889f5a4a5b4dec571f95a7532ccf
diff --git a/de/heat-templates/scripts/functions.sh b/de/heat-templates/scripts/functions.sh
index 7e089cb..2edb704 100644
--- a/de/heat-templates/scripts/functions.sh
+++ b/de/heat-templates/scripts/functions.sh
@@ -249,24 +249,15 @@
     if [[ $KUBERNETES_CONTAINER_RUNTIME == "crio" ]]; then
         mkdir -p /etc/containerd/
 cat <<EOF> /etc/containerd/config.toml
-disabled_plugins = []
-
-#root = "/var/lib/containerd"
-#state = "/run/containerd"
-#subreaper = true
-#oom_score = 0
-
-#[grpc]
-#  address = "/run/containerd/containerd.sock"
-#  uid = 0
-#  gid = 0
-
-#[debug]
-#  address = "/run/containerd/debug.sock"
-#  uid = 0
-#  gid = 0
-#  level = "info"
+version = 2
+[plugins]
+[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
+  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
+    runtime_type = "io.containerd.runc.v2"
+    [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
+      SystemdCgroup = true
 EOF
+    systemctl restart containerd || /bin/true
     fi
 
 }
@@ -432,7 +423,7 @@
     fi
     kubelet_custom_flags=""
     if [[ $KUBERNETES_CONTAINER_RUNTIME == "crio" ]]; then
-        kubelet_custom_flags='custom_kubelet_flags=["--container-runtime-endpoint=unix:///run/containerd/containerd.sock"]'
+        kubelet_custom_flags='custom_kubelet_flags=["--cgroup-driver=systemd", "--container-runtime-endpoint=unix:///run/containerd/containerd.sock"]'
     fi
     if docker config ls | grep com.docker.ucp.config ; then
         echo "Config com.docker.ucp.config already exists"