Skip to content

2026-10-31: Harbor 1.19.4 upgrade timed out, Helm's rollback could not start the old core

Kind: reference (incident report)

Severity: critical · Status: resolved · Resolved by: operator agent · Duration: 14 min 23 s from detection to resolution, 06:13:06–06:27:29 UTC (fault from 06:08:06, 19 min 23 s) · Taskbase task: #2274

Summary

The Harbor chart upgrade 1.19.2 → 1.19.4 (Skatzi/platform#1077, #2216) hit Helm's 5-minute timeout while harbor-jobservice waited for harbor-core, which waited for a restarting database. Helm's remediation rolled back to chart 1.19.2. By then the new core had migrated the database to schema 181, so the old core refused to start, and helm-controller retried the rollback in a loop. The operator agent raised the HelmRelease timeout and forced a one-off upgrade to 1.19.4, which Git already carried. Harbor came back on 1.19.4 and its post-upgrade smoke check passed. No restore was needed.

Impact

  • Services: Harbor (harbor.prod.skatzi.com) did not serve requests while its database was stopped or harbor-core was down, from 06:08:06 to 06:26:36. The registry pods ran, but core, which authenticates every pull and push, was not Ready.
  • Users: no failed image pull from harbor.prod.skatzi.com is recorded in the cluster's events (kubectl get events -A --field-selector reason=Failed at 06:29, none naming Harbor), and no pod was in ImagePullBackOff or ErrImagePull. CI pushes in the window would have failed; none were recorded (last artifact push 05:26:34).
  • Data: none lost. The database kept its data through both restarts, with WAL recovery after each forced stop (4 projects, 19 repositories and 92 artifacts, the newest pushed at 05:26:34). The pre-upgrade gate's verified backup hetzner-mgmt/harbor/preupgrade/20261031T055111Z-1.19.2-to-1.19.4 was not needed, and harbor-rollback stayed suspended.
  • Duration: 14 min 23 s from the UpgradeFailed event (06:13:06) to the HelmRelease Ready on 1.19.4 (06:27:29). The fault began when the upgrade stopped the database at 06:08:06.

Timeline

All times UTC.

Time Event Source
05:50:50 harbor-preupgrade gate starts. It backs up 1.19.2 (20261031T055111Z-1.19.2-to-1.19.4), verifies the backup by restoring it into harbor-scratch, then scales core, jobservice and registry back (jobservice up at 05:58:47) pod harbor-preupgrade-g22r5 log, pod start times
06:07:53 harbor-smoke starts (45-minute window) Job harbor/harbor-smoke
06:08:01 helm-controller: running 'upgrade' action with timeout of 5m0s (Helm revision 4, chart 1.19.4) helm-controller log
06:08:06 harbor-database-0 stopped; Postgres "smart shutdown" waits for its clients until the kubelet kills it at the 120 s grace pod events
06:10:08–06:10:44 New database pod waits for the RWO volume harbor-database-pv to detach and reattach (FailedAttachVolume, then SuccessfulAttachVolume) pod events
06:10:56 Database on harbor-db:v2.15.4 accepts connections; the 2.15.4 core applies migration 181 database log, schema_migrations
06:08:09–06:12:58 New harbor-jobservice (v2.15.4) crash-loops, six starts, backoff growing pod events
06:13:06 Detected: UpgradeFailed: ... timeout waiting for: [Deployment/harbor/harbor-jobservice status: 'InProgress']; task #2274 created 06:13:07 Flux event, Taskbase
06:13:07 Helm remediation: rollback to revision 3 (revision 5, chart 1.19.2); the database is stopped again, killed at 06:15:09, up on harbor-db:v2.15.2 at 06:15:14 helm-controller log, database log
06:16:31 2.15.2 core: [FATAL] failed to migrate the database, error: no migration found for version 181 harbor-core log
06:18:21 Revision 5 fails (timeout waiting for: [Deployment/harbor/harbor-core ...]); helm-controller starts the same rollback again (revision 6) helm history
06:20:00 Agent: HelmRelease spec.timeout 15m (field manager operator-recovery) command log below
06:20:21 Agent: flux reconcile helmrelease harbor -n harbor --force command log below
06:23:35 Revision 6 fails; helm-controller handles the force request: running 'upgrade' action with timeout of 15m0s (revision 7, chart 1.19.4) helm-controller log
06:26:36 harbor-core v2.15.4 Ready; jobservice Ready after five restarts (panic: failed to load configuration while core was down) pod status, jobservice log
06:27:29 Resolved: revision 7 deployed, HelmRelease Ready: Helm upgrade succeeded for release harbor/harbor.v7 with chart harbor@1.19.4 helm history, flux get helmreleases
06:28:18 harbor-smoke Complete: smoke artifact pulled, smoke check passed, collation versions match Job log
06:28:59 flux get kustomizations -A --status-selector ready=false returns nothing flux

Root cause

Chart 1.19.4 changes only image tags (harbor-helm v1.19.2...v1.19.4). It moves Harbor from 2.15.2 to 2.15.4, including harbor-db, so the upgrade restarts the database. Three delays added up past Helm's 5-minute default:

  1. Postgres's smart shutdown waits for its clients to disconnect. The old jobservice and exporter keep their connections during the rolling update, so the database pod used the full terminationGracePeriodSeconds: 120 that the chart sets.
  2. The RWO volume took another 36 s to detach and reattach.
  3. Core could not start without the database, and jobservice panics without core (Get "http://harbor-core:80/api/v2.0/internalconfig": ... connection refused). Both were in crash backoff by the time the database was up, and jobservice was still not Ready at 06:13:06.

Before the timeout, the 2.15.4 core applied Harbor's migration 0181_2.15.3_schema.up.sql, which widens three columns to bigint. 2.15.2 ends at migration 180, and its core refuses a newer schema. So the upgrade.remediation.strategy: rollback that every HelmRelease sets could not succeed: each rollback timed out on harbor-core, and helm-controller remediated the failed release with another rollback instead of retrying the upgrade. Harbor rollback names this case ("the old core may now run on a database the new one migrated"). Its restore by harbor-rollback starts only when harbor-smoke gives up after 45 minutes, here about 06:53.

What the agent did

The ops runbook has no section for this failure (a Helm rollback that fails on a migrated schema), so the agent followed the triage order and Harbor rollback, and rolled forward. 1.19.4 was what Git carried, it had already migrated the database, and the chart diff shows no change other than images.

Read-only checks that decided the steps:

  1. flux get helmreleases -n harbor, helm history harbor -n harbor: revision 4 failed, revision 5 pending-rollback.
  2. kubectl -n harbor get events, kubectl -n harbor logs of core, jobservice and database: the database shutdown and reattach, then the jobservice crash loop.
  3. kubectl -n harbor logs harbor-preupgrade-g22r5: the gate's backup of 1.19.2, verified by restore, as required before any further stateful step.
  4. psql ... 'select version, dirty from schema_migrations': 181|f. Harbor's compare v2.15.2...v2.15.4 adds migration 181; v2.15.2's last is 180.
  5. psql row counts and ls /var/lib/postgresql/data/pgdata: one pg18 directory and the real data, so no empty cluster beside a newer one.
  6. 2.15.2 core log: no migration found for version 181. The Helm rollback could never become Ready.

Writes, one at a time, each checked before the next:

  1. kubectl -n harbor patch helmrelease harbor --type=merge --field-manager=operator-recovery -p '{"spec":{"timeout":"15m"}}' at 06:20:00, to give the forced upgrade room for the database restart. Exit 0, timeout=15m, generation 6. Its own field manager keeps kustomize-controller from undoing it before Git carries the value.
  2. flux reconcile helmrelease harbor -n harbor --force --timeout=20s at 06:20:21, to make helm-controller run the upgrade instead of another rollback. The annotation was set (forceAt=2026-10-31T06:20:21Z); the CLI's own wait timed out, as intended. helm-controller handled it at 06:23:35, when the running rollback ended.
  3. Skatzi/platform#1100: spec.timeout: 15m in components/harbor/base/helmrelease.yaml, so Git matches the cluster. That pull request was closed unmerged on 2026-11-03, so Git still sets no timeout and Helm's 5m default applies. #2442 lands the change.

Resolution and verification

  • helm history harbor -n harbor: revision 7 deployed, chart harbor-1.19.4, app 2.15.4.
  • flux get helmreleases -A --status-selector ready=false and flux get kustomizations -A --status-selector ready=false: empty. harbor and harbor-postupgrade Ready on main@sha1:ebd6e338.
  • Every Harbor Deployment and StatefulSet 1/1 on the v2.15.4 images.
  • harbor-smoke Complete: smoke artifact skatzi/terraform-runner/cache@sha256:5450… pulled (2 blobs), smoke check passed, collation 2.43 = 2.43 for postgres, registry and template1. harbor-rollback still suspended, never run.
  • GET https://harbor.prod.skatzi.com/api/v2.0/health: healthy, every component healthy.

Follow-ups

  • 2278: document this failure and its roll-forward. Done in the ops runbook: Harbor: Helm rollback fails with no migration found for version N.

  • 2442: set spec.timeout: 15m in Git, because #1100 was closed unmerged.

  • 2279: the HelmRelease's jobservice.persistence and redis.internal.persistence are not chart keys (both run on RWO PVCs), and the harbor Kustomization's health-check timeout is shorter than the new 15m HelmRelease timeout. The harbor Kustomization's timeout has since been set to 35m on main (cluster/hetzner-mgmt/harbor/kustomization.yaml, commit 50323a6d).

  • The weekly Harbor restore drill on 2026-11-02 is the first drill of a 1.19.4 backup (post-merge check of #2216).

References

Open questions

  • The 2.15.4 core's log between 06:10:56 and 06:13:06 is gone (the pod restarted, and the cluster keeps no logs), so it is not recorded whether core was briefly Ready on 1.19.4 in the first attempt.