From de028a6408c5f56a8e585bff2bf4c5e7710f8ce8 Mon Sep 17 00:00:00 2001 From: Oleg Vasilev Date: Tue, 5 Nov 2024 14:30:35 +0100 Subject: [PATCH] neonvm-controller: remove runnerUnknown (#1131) corev1.PodUnknown is deprecated, therefore we don't need it. Signed-off-by: Oleg Vasilev --- pkg/neonvm/controllers/vm_controller.go | 31 ------------------- .../controllers/vmmigration_controller.go | 13 -------- 2 files changed, 44 deletions(-) diff --git a/pkg/neonvm/controllers/vm_controller.go b/pkg/neonvm/controllers/vm_controller.go index ca485ac0c..92058f2be 100644 --- a/pkg/neonvm/controllers/vm_controller.go +++ b/pkg/neonvm/controllers/vm_controller.go @@ -501,15 +501,6 @@ func (r *VMReconciler) doReconcile(ctx context.Context, vm *vmv1.VirtualMachine) Reason: "Reconciling", Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) failed", vm.Status.PodName, vm.Name), }) - case runnerUnknown: - vm.Status.Phase = vmv1.VmPending - meta.SetStatusCondition(&vm.Status.Conditions, - metav1.Condition{ - Type: typeAvailableVirtualMachine, - Status: metav1.ConditionUnknown, - Reason: "Reconciling", - Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) in Unknown phase", vm.Status.PodName, vm.Name), - }) default: // do nothing } @@ -629,15 +620,6 @@ func (r *VMReconciler) doReconcile(ctx context.Context, vm *vmv1.VirtualMachine) Reason: "Reconciling", Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) failed", vm.Status.PodName, vm.Name), }) - case runnerUnknown: - vm.Status.Phase = vmv1.VmPending - meta.SetStatusCondition(&vm.Status.Conditions, - metav1.Condition{ - Type: typeAvailableVirtualMachine, - Status: metav1.ConditionUnknown, - Reason: "Reconciling", - Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) in Unknown phase", vm.Status.PodName, vm.Name), - }) default: // do nothing } @@ -692,16 +674,6 @@ func (r *VMReconciler) doReconcile(ctx context.Context, vm *vmv1.VirtualMachine) Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) failed", vm.Status.PodName, vm.Name), }) return nil - case runnerUnknown: - vm.Status.Phase = vmv1.VmPending - meta.SetStatusCondition(&vm.Status.Conditions, - metav1.Condition{ - Type: typeAvailableVirtualMachine, - Status: metav1.ConditionUnknown, - Reason: "Reconciling", - Message: fmt.Sprintf("Pod (%s) for VirtualMachine (%s) in Unknown phase", vm.Status.PodName, vm.Name), - }) - return nil default: // do nothing } @@ -959,7 +931,6 @@ func (r *VMReconciler) doDIMMSlotsScaling(ctx context.Context, vm *vmv1.VirtualM type runnerStatusKind string const ( - runnerUnknown runnerStatusKind = "Unknown" runnerPending runnerStatusKind = "Pending" runnerRunning runnerStatusKind = "Running" runnerFailed runnerStatusKind = "Failed" @@ -986,8 +957,6 @@ func runnerStatus(pod *corev1.Pod) runnerStatusKind { return runnerSucceeded case corev1.PodFailed: return runnerFailed - case corev1.PodUnknown: - return runnerUnknown case corev1.PodRunning: return runnerRunning default: diff --git a/pkg/neonvm/controllers/vmmigration_controller.go b/pkg/neonvm/controllers/vmmigration_controller.go index ff29115e2..0066cdd5a 100644 --- a/pkg/neonvm/controllers/vmmigration_controller.go +++ b/pkg/neonvm/controllers/vmmigration_controller.go @@ -388,19 +388,6 @@ func (r *VirtualMachineMigrationReconciler) Reconcile(ctx context.Context, req c }) migration.Status.Phase = vmv1.VmmFailed return r.updateMigrationStatus(ctx, migration) - case runnerUnknown: - message := fmt.Sprintf("Target Pod (%s) in Unknown phase", targetRunner.Name) - log.Info(message) - r.Recorder.Event(migration, "Warning", "Unknown", message) - meta.SetStatusCondition(&migration.Status.Conditions, - metav1.Condition{ - Type: typeAvailableVirtualMachineMigration, - Status: metav1.ConditionUnknown, - Reason: "Reconciling", - Message: message, - }) - migration.Status.Phase = vmv1.VmmPending - return r.updateMigrationStatus(ctx, migration) default: // not sure what to do, so try rqueue return ctrl.Result{RequeueAfter: time.Second}, nil