Skip to content

Commit dee47a1

Browse files
committed
neonvm-controller: add explicit "node not ready" tolerations with 30s grace period (#1055)
By default they are 300s (5m), which is way too long. Signed-off-by: Oleg Vasilev <[email protected]>
1 parent 498573b commit dee47a1

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pkg/neonvm/controllers/vm_controller.go

+19-1
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,24 @@ func podSpec(
13751375
return nil, fmt.Errorf("marshal VM Status: %w", err)
13761376
}
13771377

1378+
// We have to add tolerations explicitly here.
1379+
// Otherwise, if the k8s node becomes unavailable, the default
1380+
// tolerations will be added, which are 300s (5m) long, which is
1381+
// not acceptable for us.
1382+
tolerations := append([]corev1.Toleration{}, vm.Spec.Tolerations...)
1383+
tolerations = append(tolerations,
1384+
corev1.Toleration{
1385+
Key: "node.kubernetes.io/not-ready",
1386+
TolerationSeconds: lo.ToPtr(int64(30)),
1387+
Effect: "NoExecute",
1388+
},
1389+
corev1.Toleration{
1390+
Key: "node.kubernetes.io/unreachable",
1391+
TolerationSeconds: lo.ToPtr(int64(30)),
1392+
Effect: "NoExecute",
1393+
},
1394+
)
1395+
13781396
pod := &corev1.Pod{
13791397
ObjectMeta: metav1.ObjectMeta{
13801398
Name: vm.Status.PodName,
@@ -1389,7 +1407,7 @@ func podSpec(
13891407
TerminationGracePeriodSeconds: vm.Spec.TerminationGracePeriodSeconds,
13901408
NodeSelector: vm.Spec.NodeSelector,
13911409
ImagePullSecrets: vm.Spec.ImagePullSecrets,
1392-
Tolerations: vm.Spec.Tolerations,
1410+
Tolerations: tolerations,
13931411
ServiceAccountName: vm.Spec.ServiceAccountName,
13941412
SchedulerName: vm.Spec.SchedulerName,
13951413
Affinity: affinity,

0 commit comments

Comments
 (0)