Skip to content

Commit

Permalink
neonvm-controller: add explicit "node not ready" tolerations with 30s…
Browse files Browse the repository at this point in the history
… grace period (#1055)

By default they are 300s (5m), which is way too long.

Signed-off-by: Oleg Vasilev <[email protected]>
  • Loading branch information
Omrigan committed Oct 15, 2024
1 parent 498573b commit dee47a1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pkg/neonvm/controllers/vm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,24 @@ func podSpec(
return nil, fmt.Errorf("marshal VM Status: %w", err)
}

// We have to add tolerations explicitly here.
// Otherwise, if the k8s node becomes unavailable, the default
// tolerations will be added, which are 300s (5m) long, which is
// not acceptable for us.
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,
Expand All @@ -1389,7 +1407,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,
Expand Down

0 comments on commit dee47a1

Please sign in to comment.