Migrations Job failures
Status: Implemented Issue: none Parent: GitLabCore reconciler
Goal
Each step of a zero-downtime upgrade gates on three Jobs: the pre-deployment migrations, the full migrations, and the batched background migrations wait. A Job retries a failed attempt on its own. The chart restarts a failed container in place, and the Job replaces a pod that failed as a whole, for example an evicted one. An administrator watching the upgrade sees a retry as a retry, and gets what they need to act on a Job that ran out of retries.
Requirements
- A Job of an upgrade has failed only when it reports the condition
Failedwith statusTrue. - A Job retries when its containers restarted in place, or when pods of it failed as a whole. The
instance then stays in phase
Upgrading, and its gate keeps waiting.ProgressingisTrue, with the reasonRetryingPreMigrations,RetryingPostMigrations, orRetryingBatchedMigrationsCheck. - The message of a retry counts the failed attempts against the limits of the Job controller.
Container restarts count against
spec.backoffLimit, and failed pods againstspec.backoffLimit + 1. A failed run counts as soon as it fails, so during its back-off the count is one restart ahead of the Job controller. The message reports the count nearer its limit: the failed attempt, the attempts left, and the last failure, with its reason, exit code, and message. - The message of a restart gives
kubectl -n <namespace> logs job/<name> -c <container> --previous. The message of a failed pod giveskubectl -n <namespace> describe job/<name>. - A retrying upgrade holds its target. It does not move on to a newer patch, and starts no other Job for the gate.
- After the Job of a gate exists, the gate reports it, even while the workloads of the release are not ready. A pod that restarts or a scale-up changes neither the condition nor the phase.
- A Job that reports
FailureTargetwithoutFailedis failing, and its pods may still run. The instance stays in phaseUpgradingand holds its target.Progressingkeeps the reason of the gate, and its message says that the Job is failing and why. - A Job that reports
Failedfails the upgrade: phaseFailed,ProgressingFalsewith the reasonMigrationsJobFailedorBatchedMigrationsCheckFailed. The message carries the reason and message of theFailedcondition, the last failure, andkubectl -n <namespace> describe job/<name>. The last failure is the one a retry recorded, even after the pods are gone, or the evicted or preempted pod that took the failed pods past their limit. The message says that a change to the spec reruns the upgrade with new Jobs. - A pass that sees a failed count rise records one
Warningevent on theGitLabCore,MigrationsRetryingorBatchedMigrationsCheckRetrying. A failure records one,MigrationsFailedorBatchedMigrationsCheckFailed. Other passes record none. - A retry or a failure shows up on the first pass after the Job reports it, at most 30 seconds later.
- The web UI marks a retrying gate apart from a running one, and shows its message. The command of a retrying gate or a failed upgrade is shown as code.
Out of scope
- The deadline of the batched background migrations wait Job.
DeadlineExceededstays terminal. - A procedure to recover a failed upgrade, and the
BYPASS_SCHEMA_VERSIONthe pods keep meanwhile. - Changing
restartPolicy,backoffLimit, or any other part of the chart. - The migrations Job of the deprecated
v1beta1GitLabcontroller. For a defect there, see https://gitlab.com/gitlab-org/cloud-native/gitlab-operator/-/work_items/2309.
FAQ
- Where are the logs of a Job that failed? Often gone. The Job controller deletes the pod when
it gives up, so the condition keeps the last failure, and
kubectl describeshows the events of the Job. For the design, see ADR 45. - How soon does a retry show up? The reconciler does not watch Jobs or pods, so the next pass reports it, at most 30 seconds later.
- How is a failed upgrade retried? A change to the
GitLabCorespec raises the generation, which names new Jobs, so the upgrade runs again from its first gate. An unattended upgrade also moves on to a newer patch of the same minor once one is released.
Was this page helpful?