From 837f32eb18cc78531f26f1308454761c42099d2f Mon Sep 17 00:00:00 2001 From: Oleg Vasilev Date: Thu, 29 Aug 2024 15:19:01 +0200 Subject: [PATCH] add tolerations Signed-off-by: Oleg Vasilev --- neonvm/controllers/vm_controller.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/neonvm/controllers/vm_controller.go b/neonvm/controllers/vm_controller.go index 97fded725..3b972222b 100644 --- a/neonvm/controllers/vm_controller.go +++ b/neonvm/controllers/vm_controller.go @@ -1373,6 +1373,20 @@ func podSpec( return nil, fmt.Errorf("marshal VM Status: %w", err) } + tolerations := append([]corev1.Toleration{}, vm.Spec.Tolerations...) + tolerations = append(tolerations, + corev1.Toleration{ + Key: "node.kubernetes.io/not-ready", + TolerationSeconds: lo.ToPtr(int64(30)), + Effect: "NoExecute", + }, + corev1.Toleration{ + Key: "node.kubernetes.io/unreachable", + TolerationSeconds: lo.ToPtr(int64(30)), + Effect: "NoExecute", + }, + ) + pod := &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: vm.Status.PodName, @@ -1387,7 +1401,7 @@ func podSpec( TerminationGracePeriodSeconds: vm.Spec.TerminationGracePeriodSeconds, NodeSelector: vm.Spec.NodeSelector, ImagePullSecrets: vm.Spec.ImagePullSecrets, - Tolerations: vm.Spec.Tolerations, + Tolerations: tolerations, ServiceAccountName: vm.Spec.ServiceAccountName, SchedulerName: vm.Spec.SchedulerName, Affinity: affinity,