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"