From 83cada8035a488071ac0542a52a7b24e07660bcf Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Fri, 27 Nov 2026 04:55:07 +0100 Subject: [PATCH] fix(harbor): roll jobservice without a surge jobservice keeps its job log on a ReadWriteOnce volume, but the upstream chart rolls it with the default surge. When the replacement lands on another node it waits on the volume attach for good, and the nested release fails as stalled. The registry credential rotation restarts jobservice on every existing release, so the upgrade would hit this on any multi-node cluster. Only jobservice is changed, through a post-renderer: the chart's own switch to Recreate also applies to the registry, which keeps its data in S3 and should go on rolling without an outage. Assisted-by: LLM Signed-off-by: Andrei Kvapil (cherry picked from commit 4d0331167b5158fa6284517f24b1e21abd8f2167) --- packages/apps/harbor/templates/harbor.yaml | 22 +++++++++++++++++++ .../tests/registry_credentials_test.yaml | 19 ++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/packages/apps/harbor/templates/harbor.yaml b/packages/apps/harbor/templates/harbor.yaml index 5757ac8bb..b8a32cbd5 100644 --- a/packages/apps/harbor/templates/harbor.yaml +++ b/packages/apps/harbor/templates/harbor.yaml @@ -164,6 +164,28 @@ spec: retryInterval: 30s remediation: retries: -1 + {{- /* jobservice mounts a ReadWriteOnce job-log volume, and the upstream + chart rolls it with a surge: a replacement scheduled on another node + waits on the attach for good and the upgrade fails as stalled. With + no surge the old pod goes first and releases the volume. The chart's + own switch, updateStrategy=Recreate, also covers the registry, which + keeps its data in S3 and should keep rolling without an outage. */}} + postRenderers: + - kustomize: + patches: + - target: + group: apps + version: v1 + kind: Deployment + name: {{ .Release.Name }}-jobservice + patch: | + - op: replace + path: /spec/strategy + value: + type: RollingUpdate + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 valuesFrom: - kind: Secret name: cozystack-values diff --git a/packages/apps/harbor/tests/registry_credentials_test.yaml b/packages/apps/harbor/tests/registry_credentials_test.yaml index f3094db32..f0c8ef857 100644 --- a/packages/apps/harbor/tests/registry_credentials_test.yaml +++ b/packages/apps/harbor/tests/registry_credentials_test.yaml @@ -124,3 +124,22 @@ tests: - matchRegex: path: stringData.htpasswd pattern: ^harbor_registry_user:\$2[aby]\$ + + # Rotating the credential restarts jobservice on every existing release; + # with a surge its ReadWriteOnce job-log volume can pin the replacement on + # another node and fail the upgrade as stalled. + - it: rolls jobservice without a surge + documentSelector: + path: kind + value: HelmRelease + asserts: + - equal: + path: spec.postRenderers[0].kustomize.patches[0].target + value: + group: apps + version: v1 + kind: Deployment + name: harbor-test-jobservice + - matchRegex: + path: spec.postRenderers[0].kustomize.patches[0].patch + pattern: "maxSurge: 0"