diff --git a/neonvm/controllers/virtualmachine_controller.go b/neonvm/controllers/virtualmachine_controller.go index 2bb37eb55..74909ffde 100644 --- a/neonvm/controllers/virtualmachine_controller.go +++ b/neonvm/controllers/virtualmachine_controller.go @@ -787,7 +787,11 @@ func (r *VirtualMachineReconciler) doReconcile(ctx context.Context, virtualmachi if shouldRestart { log.Info("Restarting VM runner pod", "VM.Phase", virtualmachine.Status.Phase, "RestartPolicy", virtualmachine.Spec.RestartPolicy) virtualmachine.Status.Phase = vmv1.VmPending // reset to trigger restart - *virtualmachine.Status.RestartCount += 1 // increment restart count + if virtualmachine.Status.RestartCount == nil { + var zero int32 = 0 + virtualmachine.Status.RestartCount = &zero + } + *virtualmachine.Status.RestartCount += 1 // increment restart count r.Metrics.vmRestartCounts.Inc() }