From 2879312e0aa1b4258c6d9616dc533bd955252608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sun, 11 Aug 2024 15:22:10 +0200 Subject: [PATCH] ccruntime: Remove cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not needed anymore for the CC Runtime, as Kata Containers does the cleanup as part of the uninstall. See: https://github.com/kata-containers/kata-containers/commit/8d9bec2e015f20126a84bc474e35ecf748f53d98 Calling the cleanup after calling the uninstall, which has already done the cleanup, could result on a infinite loop. Signed-off-by: Fabiano FidĂȘncio --- .../manifests/cc-operator.clusterserviceversion.yaml | 4 ---- config/samples/ccruntime/base/ccruntime.yaml | 1 - controllers/ccruntime_controller.go | 12 +++++++----- docs/PAYLOAD_IMAGE.md | 1 - 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bundle/manifests/cc-operator.clusterserviceversion.yaml b/bundle/manifests/cc-operator.clusterserviceversion.yaml index c9649c12..3c80a20d 100644 --- a/bundle/manifests/cc-operator.clusterserviceversion.yaml +++ b/bundle/manifests/cc-operator.clusterserviceversion.yaml @@ -17,10 +17,6 @@ metadata: } }, "config": { - "cleanupCmd": [ - "/opt/kata-artifacts/scripts/kata-deploy.sh", - "reset" - ], "debug": false, "defaultRuntimeClassName": "kata-qemu", "environmentVariables": [ diff --git a/config/samples/ccruntime/base/ccruntime.yaml b/config/samples/ccruntime/base/ccruntime.yaml index f18500f0..43aeab90 100644 --- a/config/samples/ccruntime/base/ccruntime.yaml +++ b/config/samples/ccruntime/base/ccruntime.yaml @@ -49,7 +49,6 @@ spec: name: host installCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "install"] uninstallCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "cleanup"] - cleanupCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "reset"] # Uncomment and add the required RuntimeClasses to be created # If this is commented, then the operator creates 3 default runtimeclasses "kata", "kata-clh", "kata-qemu" runtimeClasses: diff --git a/controllers/ccruntime_controller.go b/controllers/ccruntime_controller.go index 8a79cf76..82ffb330 100644 --- a/controllers/ccruntime_controller.go +++ b/controllers/ccruntime_controller.go @@ -604,12 +604,14 @@ func (r *CcRuntimeReconciler) processDaemonset(operation DaemonOperation) *appsv preStopHook := &corev1.Lifecycle{} if operation == InstallOperation { - preStopHook = &corev1.Lifecycle{ - PreStop: &corev1.LifecycleHandler{ - Exec: &corev1.ExecAction{ - Command: r.ccRuntime.Spec.Config.CleanupCmd, + if r.ccRuntime.Spec.Config.CleanupCmd != nil { + preStopHook = &corev1.Lifecycle{ + PreStop: &corev1.LifecycleHandler{ + Exec: &corev1.ExecAction{ + Command: r.ccRuntime.Spec.Config.CleanupCmd, + }, }, - }, + } } containerCommand = r.ccRuntime.Spec.Config.InstallCmd } diff --git a/docs/PAYLOAD_IMAGE.md b/docs/PAYLOAD_IMAGE.md index ac9656f7..c56e3f3d 100644 --- a/docs/PAYLOAD_IMAGE.md +++ b/docs/PAYLOAD_IMAGE.md @@ -59,7 +59,6 @@ Following is an example for Kata runtime depicting the key attributes. name: local-bin installCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "install"] uninstallCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "cleanup"] - cleanupCmd: ["/opt/kata-artifacts/scripts/kata-deploy.sh", "reset"] ``` The installer (`/opt/kata-artifacts/scripts/kata-deploy.sh`) copies the required kata artifacts to