Skip to content

Commit

Permalink
FIXME: testing commit which uses katacontainers.io/kata-runtime2=cleanup
Browse files Browse the repository at this point in the history
in order for this to work it requires kata-deploy to set
katacontainers.io/kata-runtime2=cleanup label on cleanup rather than
katacontainers.io/kata-runtime=cleanup which is still being used but
it's set by the operator itself (and must not be set by kata-containers)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
  • Loading branch information
ldoktor committed Jan 14, 2025
1 parent b8b41ea commit d5f66bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/ccruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func handleFinalizers(r *CcRuntimeReconciler) (ctrl.Result, error) {

// Check for nodes with label set by install DS prestop hook.
// If no nodes exist then remove finalizer and reconcile
err, nodes := r.getNodesWithLabels(r.ccRuntime.Spec.Config.UninstallDoneLabel)
err, nodes := r.getNodesWithLabels(map[string]string{"katacontainers.io/kata-runtime2": "cleanup"})
if err != nil {
r.Log.Error(err, "Error in getting list of nodes with uninstallDoneLabel")
return ctrl.Result{}, err
Expand Down Expand Up @@ -248,7 +248,7 @@ func handleFinalizers(r *CcRuntimeReconciler) (ctrl.Result, error) {
// the label is only set after containerd is successfully reconfigured,
// and looking at this function we see we shouldn't reach this part
// before the label is set. However, that's not what we're facing ...
time.Sleep(time.Second * 60)
//time.Sleep(time.Second * 60)

result, err = handlePostUninstall(r)
if !result.Requeue {
Expand Down Expand Up @@ -969,6 +969,9 @@ func (r *CcRuntimeReconciler) removeNodeLabels(nodesList *corev1.NodeList) (ctrl
if val, ok := nodeLabels[KataRuntimeLabel[0]]; ok && val == KataRuntimeLabel[1] {
delete(nodeLabels, KataRuntimeLabel[0])
}
if val, ok := nodeLabels["katacontainers.io/kata-runtime2"]; ok && val == "cleanup" {
delete(nodeLabels, "katacontainers.io/kata-runtime2")
}
node.SetLabels(nodeLabels)
_, err := nodesClient.Update(context.TODO(), &node, metav1.UpdateOptions{
TypeMeta: metav1.TypeMeta{},
Expand Down

0 comments on commit d5f66bb

Please sign in to comment.