From 9a64644670afaa9ca23fe54d774056db5c8c1927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Wed, 19 Aug 2026 02:13:24 +0200 Subject: [PATCH 1/5] Drop the legacy sleep 30 and bound the hook Jobs The first-deploy migration command no longer sleeps 30 seconds - the shopsys-infra release is installed with wait: true before the hook runs, so readiness is guaranteed. The migration and post-deploy Jobs get configurable activeDeadlineSeconds (1800/600 s defaults) so a stuck Job fails cleanly instead of blocking the deploy until the global helmfile timeout. Closes #11 Co-Authored-By: Claude Fable 5 --- .../templates/hooks/job-migrate-application.yaml | 7 +++++-- .../templates/hooks/job-post-deploy.yaml | 1 + charts/shopsys-app/tests/hooks_test.yaml | 8 +++++++- charts/shopsys-app/values.schema.json | 14 ++++++++++++++ charts/shopsys-app/values.yaml | 3 +++ docs/migrating-from-shopsys-deployment.md | 7 +++++-- .../basic-production/expected/continuous.yaml | 4 ++++ .../expected/first-deploy-with-demo-data.yaml | 6 +++++- .../basic-production/expected/first-deploy.yaml | 6 +++++- .../expected/continuous.yaml | 4 ++++ .../expected/first-deploy-with-demo-data.yaml | 6 +++++- .../expected/first-deploy.yaml | 6 +++++- .../expected/continuous.yaml | 4 ++++ .../expected/first-deploy-with-demo-data.yaml | 6 +++++- .../expected/first-deploy.yaml | 6 +++++- .../escaping-env/expected/continuous.yaml | 4 ++++ .../expected/first-deploy-with-demo-data.yaml | 6 +++++- .../escaping-env/expected/first-deploy.yaml | 6 +++++- .../expected/continuous.yaml | 4 ++++ .../expected/first-deploy-with-demo-data.yaml | 6 +++++- .../expected/first-deploy.yaml | 6 +++++- 21 files changed, 105 insertions(+), 15 deletions(-) diff --git a/charts/shopsys-app/templates/hooks/job-migrate-application.yaml b/charts/shopsys-app/templates/hooks/job-migrate-application.yaml index 08db7d3..03c2cf5 100644 --- a/charts/shopsys-app/templates/hooks/job-migrate-application.yaml +++ b/charts/shopsys-app/templates/hooks/job-migrate-application.yaml @@ -18,9 +18,9 @@ The command variant is selected by deploy.firstDeploy.*: {{- $command := printf "cd /var/www/html && ./phing %s" $targets.continuous }} {{- if .Values.deploy.firstDeploy.enabled }} {{- if .Values.deploy.firstDeploy.loadDemoData }} -{{- $command = printf "cd /var/www/html && sleep 30 && ./phing %s" $targets.firstDeployWithDemoData }} +{{- $command = printf "cd /var/www/html && ./phing %s" $targets.firstDeployWithDemoData }} {{- else }} -{{- $command = printf "cd /var/www/html && sleep 30 && ./phing %s" $targets.firstDeploy }} +{{- $command = printf "cd /var/www/html && ./phing %s" $targets.firstDeploy }} {{- end }} {{- end }} apiVersion: batch/v1 @@ -35,6 +35,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: {{ .Values.deploy.migration.activeDeadlineSeconds }} template: spec: volumes: diff --git a/charts/shopsys-app/templates/hooks/job-post-deploy.yaml b/charts/shopsys-app/templates/hooks/job-post-deploy.yaml index bfa5c40..55c4505 100644 --- a/charts/shopsys-app/templates/hooks/job-post-deploy.yaml +++ b/charts/shopsys-app/templates/hooks/job-post-deploy.yaml @@ -17,6 +17,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: {{ .Values.deploy.postDeploy.activeDeadlineSeconds }} template: spec: volumes: diff --git a/charts/shopsys-app/tests/hooks_test.yaml b/charts/shopsys-app/tests/hooks_test.yaml index 6ce6906..9867f2c 100644 --- a/charts/shopsys-app/tests/hooks_test.yaml +++ b/charts/shopsys-app/tests/hooks_test.yaml @@ -25,6 +25,9 @@ tests: - matchRegex: path: spec.template.spec.containers[0].command[2] pattern: 'db-migrations-count-with-maintenance build-deploy-part-2-db-dependent' + - equal: + path: spec.activeDeadlineSeconds + value: 1800 - it: switches the command on first deploy template: templates/hooks/job-migrate-application.yaml @@ -35,7 +38,7 @@ tests: asserts: - matchRegex: path: spec.template.spec.containers[0].command[2] - pattern: 'sleep 30 && \./phing cluster-first-deploy$' + pattern: 'cd /var/www/html && \./phing cluster-first-deploy$' - it: loads demo data on first deploy when requested template: templates/hooks/job-migrate-application.yaml @@ -77,6 +80,9 @@ tests: - matchRegex: path: spec.template.spec.containers[0].command[2] pattern: 'set -e' + - equal: + path: spec.activeDeadlineSeconds + value: 600 - matchRegex: path: spec.template.spec.containers[0].command[2] pattern: './phing maintenance-off\n' diff --git a/charts/shopsys-app/values.schema.json b/charts/shopsys-app/values.schema.json index 51d2a9c..66e0d78 100644 --- a/charts/shopsys-app/values.schema.json +++ b/charts/shopsys-app/values.schema.json @@ -158,6 +158,20 @@ "enabled": { "type": "boolean" }, "loadDemoData": { "type": "boolean" } } + }, + "migration": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "activeDeadlineSeconds": { "type": "integer", "minimum": 1 } + } + }, + "postDeploy": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" }, + "activeDeadlineSeconds": { "type": "integer", "minimum": 1 } + } } } }, diff --git a/charts/shopsys-app/values.yaml b/charts/shopsys-app/values.yaml index 583efa2..f446bac 100644 --- a/charts/shopsys-app/values.yaml +++ b/charts/shopsys-app/values.yaml @@ -353,9 +353,12 @@ deploy: continuous: "-verbose db-migrations-count-with-maintenance build-deploy-part-2-db-dependent" firstDeploy: "cluster-first-deploy" firstDeployWithDemoData: "cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export" + # Hard bound for the migration Job (seconds); must exceed the longest migration + activeDeadlineSeconds: 1800 resources: {} postDeploy: enabled: true + activeDeadlineSeconds: 600 resources: {} hooks: # kubectlImage is the image used by the cron-suspend hook Job; pinned tag on purpose diff --git a/docs/migrating-from-shopsys-deployment.md b/docs/migrating-from-shopsys-deployment.md index c2e2d1f..083d7a1 100644 --- a/docs/migrating-from-shopsys-deployment.md +++ b/docs/migrating-from-shopsys-deployment.md @@ -84,8 +84,11 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. `domains-urls-hook` copy because pre-install hooks run before regular resources exist. 8. **Namespace** is created by the wrapper/helmfile, not applied as a manifest. It is named `-` (replaces the "PROJECT_NAME must contain a dash" rule). -9. **`sleep 30`** in the first-deploy migration command is kept verbatim for parity even - though the infra release already guarantees readiness. +9. **The legacy `sleep 30`** in the first-deploy migration command is removed — the + shopsys-infra release is installed with `wait: true` before the migration hook runs, so + readiness is guaranteed without a delay. The migration and post-deploy Jobs are + additionally bounded by `deploy.migration.activeDeadlineSeconds` (default 1800 s) and + `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). 10. **DISPLAY_FINAL_CONFIGURATION** prints one `helmfile template` output instead of two kustomize sections. 11. **`orchestration/kubernetes/` file overrides and the composer `merge` step are gone** — diff --git a/tests/golden/scenarios/basic-production/expected/continuous.yaml b/tests/golden/scenarios/basic-production/expected/continuous.yaml index fda309d..62b6bf4 100644 --- a/tests/golden/scenarios/basic-production/expected/continuous.yaml +++ b/tests/golden/scenarios/basic-production/expected/continuous.yaml @@ -1742,6 +1742,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1810,6 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml index 4fa723f..565cef4 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml @@ -1742,6 +1742,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1751,7 +1754,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] envFrom: - secretRef: name: app-secret-env-hook @@ -1810,6 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml index 6e59144..49cfd05 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml @@ -1742,6 +1742,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1751,7 +1754,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] envFrom: - secretRef: name: app-secret-env-hook @@ -1810,6 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml index d7a06fd..88393de 100644 --- a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml @@ -1519,6 +1519,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1587,6 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml index f24e535..aaf370d 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml @@ -1519,6 +1519,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1528,7 +1531,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] envFrom: - secretRef: name: app-secret-env-hook @@ -1587,6 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml index c742794..dd4ad0b 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml @@ -1519,6 +1519,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1528,7 +1531,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] envFrom: - secretRef: name: app-secret-env-hook @@ -1587,6 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml index 49a4eb4..88ddb2c 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml @@ -1573,6 +1573,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1641,6 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml index 2fe4f09..f471859 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1573,6 +1573,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1582,7 +1585,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] envFrom: - secretRef: name: app-secret-env-hook @@ -1641,6 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml index ebcc1ea..18b061c 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml @@ -1573,6 +1573,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1582,7 +1585,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] envFrom: - secretRef: name: app-secret-env-hook @@ -1641,6 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/continuous.yaml b/tests/golden/scenarios/escaping-env/expected/continuous.yaml index f7d5168..e6099fe 100644 --- a/tests/golden/scenarios/escaping-env/expected/continuous.yaml +++ b/tests/golden/scenarios/escaping-env/expected/continuous.yaml @@ -1769,6 +1769,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1839,6 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml index 10aa7d7..62dc8db 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml @@ -1769,6 +1769,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1778,7 +1781,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] envFrom: - secretRef: name: app-secret-env-hook @@ -1839,6 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml index 050be36..765822f 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml @@ -1769,6 +1769,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1778,7 +1781,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] envFrom: - secretRef: name: app-secret-env-hook @@ -1839,6 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml index e15485e..00a720c 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml @@ -1874,6 +1874,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1942,6 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml index ba649cd..55fc7f9 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1874,6 +1874,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1883,7 +1886,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export"] envFrom: - secretRef: name: app-secret-env-hook @@ -1942,6 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml index 370b55e..94be774 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml @@ -1874,6 +1874,9 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + # Bound the migration - a stuck Job otherwise blocks the deploy until the global + # helmfile timeout and stays running in the cluster + activeDeadlineSeconds: 1800 template: spec: volumes: @@ -1883,7 +1886,7 @@ spec: containers: - name: migrate-application image: "v1.0.0" - command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] envFrom: - secretRef: name: app-secret-env-hook @@ -1942,6 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 + activeDeadlineSeconds: 600 template: spec: volumes: From 44e4ee794e4b953cbe00c659d174e4416ac4770b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Thu, 20 Aug 2026 12:49:53 +0200 Subject: [PATCH 2/5] Address review: stale sleep-30 docs, deadline caveats, log fallback Review follow-ups on the sleep-30 removal / hook-bounding PR: - Purge the remaining stale sleep-30 references the diff left behind: the migrate-application template header comment, the deploy-flow.md flow diagram and the CLAUDE.md "preserved oddity" example (now points at the deviations register instead of a removed example). - State the readiness guarantee precisely in deviation entry 9: Redis readiness is probe-backed, RabbitMQ has no default readinessProbe so the infra wait only guarantees a Running broker container. - Document the activeDeadlineSeconds keys in docs/values.md and expand the values.yaml comments: first deploys with demo data may need much more than 1800 s, and the value must stay below DEPLOY_TIMEOUT so a stuck migration fails as a DeadlineExceeded Job that the wrapper's recovery path handles. - A deadline-killed Job has its pod deleted, so `kubectl logs job/...` finds nothing exactly when logs matter most - print_job_logs now falls back to `kubectl describe job` (conditions + events). No rendered-manifest changes (comment-only template edit), golden snapshots unchanged. Co-Authored-By: Claude Fable 5 --- CLAUDE.md | 5 +++-- .../templates/hooks/job-migrate-application.yaml | 4 ++-- charts/shopsys-app/values.yaml | 6 +++++- deploy/deploy.sh | 6 +++++- docs/deploy-flow.md | 2 +- docs/migrating-from-shopsys-deployment.md | 13 +++++++++---- docs/values.md | 12 ++++++++++-- 7 files changed, 35 insertions(+), 13 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 03308a4..8069a07 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,8 +10,9 @@ Kubernetes. It is a **generic, reusable package** consumed by multiple projects. Phase 1 (done) is a faithful 1:1 port: the deploy **order** and all **end states** of the legacy pipeline are preserved. Phase 2 (planned) is manifest modernization — until then, -manifests intentionally keep their legacy shape (including oddities like the `sleep 30` in -the first-deploy migration command). Do not "improve" manifest content without being asked. +manifests intentionally keep their legacy shape; the few intentional exceptions are +registered in `docs/migrating-from-shopsys-deployment.md`. Do not "improve" manifest +content without being asked. **Helm 4 only** — no Helm 3 backward compatibility (e.g. `helm plugin install` uses `--verify=false`, which Helm 3 does not know). Keep CI's `HELM_VERSION` in sync with the diff --git a/charts/shopsys-app/templates/hooks/job-migrate-application.yaml b/charts/shopsys-app/templates/hooks/job-migrate-application.yaml index 03c2cf5..ae88710 100644 --- a/charts/shopsys-app/templates/hooks/job-migrate-application.yaml +++ b/charts/shopsys-app/templates/hooks/job-migrate-application.yaml @@ -9,8 +9,8 @@ it at the start of the next deploy (legacy "Delete previous migration pod" step) The command variant is selected by deploy.firstDeploy.*: - continuous deploy: check migrations + enable maintenance + run db-dependent build phase -- first deploy: full first deploy of the cluster (the sleep 30 is kept from the legacy - package to let infrastructure services settle) +- first deploy: full first deploy of the cluster (the legacy sleep 30 was dropped - the + shopsys-infra release is waited on before this hook runs, see the deviations doc) - first deploy with demo data: first deploy + demo data import */}} {{- if .Values.deploy.migration.enabled }} diff --git a/charts/shopsys-app/values.yaml b/charts/shopsys-app/values.yaml index f446bac..aa1da2f 100644 --- a/charts/shopsys-app/values.yaml +++ b/charts/shopsys-app/values.yaml @@ -353,11 +353,15 @@ deploy: continuous: "-verbose db-migrations-count-with-maintenance build-deploy-part-2-db-dependent" firstDeploy: "cluster-first-deploy" firstDeployWithDemoData: "cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export" - # Hard bound for the migration Job (seconds); must exceed the longest migration + # Hard bound for the migration Job (seconds); must exceed the longest migration - + # first deploys with demo data (elasticsearch-export) may need a much higher value. + # Keep it below the helmfile timeout (DEPLOY_TIMEOUT, default 2700) so a stuck + # migration fails as a DeadlineExceeded Job instead of a Helm client timeout. activeDeadlineSeconds: 1800 resources: {} postDeploy: enabled: true + # Hard bound for the post-deploy Job (seconds) activeDeadlineSeconds: 600 resources: {} hooks: diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 9b94c07..e216fe7 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -87,7 +87,11 @@ print_job_logs() { local job="$1" title="$2" if kubectl -n "${NAMESPACE}" get "job/${job}" > /dev/null 2>&1; then section_start "${job//-/_}_logs" "${title}" - kubectl logs "job/${job}" --namespace="${NAMESPACE}" || true + if ! kubectl logs "job/${job}" --namespace="${NAMESPACE}" 2> /dev/null; then + # A deadline-killed Job (activeDeadlineSeconds) has its pod deleted, so no + # logs exist - fall back to the Job description (conditions + events) + kubectl describe "job/${job}" --namespace="${NAMESPACE}" || true + fi section_end "${job//-/_}_logs" fi } diff --git a/docs/deploy-flow.md b/docs/deploy-flow.md index 7df31f5..3156cc6 100644 --- a/docs/deploy-flow.md +++ b/docs/deploy-flow.md @@ -27,7 +27,7 @@ For the legacy behavior itself see [original-deployment.md](original-deployment. │ ├─ hook pre-install,pre-upgrade (w10): migrate-application Job │ │ continuous: phing db-migrations-count-with-maintenance │ │ build-deploy-part-2-db-dependent -│ │ first: sleep 30 && phing cluster-first-deploy [+ demo targets] +│ │ first: phing cluster-first-deploy [+ demo targets] │ │ └─ FAILS → whole apply aborts, old release stays │ ├─ manifests apply + rollout wait (webserver, storefront, cron on the │ │ new image – the `date` label forces a new pod, consumers, ingresses, diff --git a/docs/migrating-from-shopsys-deployment.md b/docs/migrating-from-shopsys-deployment.md index 083d7a1..9e89c1a 100644 --- a/docs/migrating-from-shopsys-deployment.md +++ b/docs/migrating-from-shopsys-deployment.md @@ -85,10 +85,15 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. 8. **Namespace** is created by the wrapper/helmfile, not applied as a manifest. It is named `-` (replaces the "PROJECT_NAME must contain a dash" rule). 9. **The legacy `sleep 30`** in the first-deploy migration command is removed — the - shopsys-infra release is installed with `wait: true` before the migration hook runs, so - readiness is guaranteed without a delay. The migration and post-deploy Jobs are - additionally bounded by `deploy.migration.activeDeadlineSeconds` (default 1800 s) and - `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). + shopsys-infra release is installed with `wait: true` before the migration hook runs + (Redis readiness is probe-backed; RabbitMQ has no default readinessProbe, so the wait + guarantees a Running broker container, not yet an accepting broker). The migration and + post-deploy Jobs are additionally bounded by `deploy.migration.activeDeadlineSeconds` + (default 1800 s — first deploys with demo data may need much more, see + [values.md](values.md)) and `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). + When a deadline fires, the Job controller deletes the running pod — the Job fails as + `DeadlineExceeded` (the wrapper's recovery path still triggers), but the pod logs are + gone; the wrapper then falls back to `kubectl describe job` output. 10. **DISPLAY_FINAL_CONFIGURATION** prints one `helmfile template` output instead of two kustomize sections. 11. **`orchestration/kubernetes/` file overrides and the composer `merge` step are gone** — diff --git a/docs/values.md b/docs/values.md index fd69463..d2de7dd 100644 --- a/docs/values.md +++ b/docs/values.md @@ -84,8 +84,9 @@ rabbitmq: # infra component + auth/persistence/management deploy: timestamp: "" # injected by the wrapper (forces a new cron pod) firstDeploy: { enabled: false, loadDemoData: false } - migration: { enabled, targets: {continuous, firstDeploy, firstDeployWithDemoData}, resources } - postDeploy: { enabled, resources } + migration: { enabled, targets: {continuous, firstDeploy, firstDeployWithDemoData}, + resources, activeDeadlineSeconds } # hard Job bound, default 1800 s + postDeploy: { enabled, resources, activeDeadlineSeconds } # hard Job bound, default 600 s hooks: { kubectlImage, serviceAccountName } extraManifests: [] # raw manifests (rendered through tpl) — escape hatch @@ -100,6 +101,13 @@ entries take precedence over `envFrom` in Kubernetes — never define the same k Lists (e.g. `security.whitelistIps`, `domains`) **replace** the base value when overridden by an environment file — they are not merged. Maps merge deeply. +`deploy.migration.activeDeadlineSeconds` must exceed the longest migration variant of the +project — first deploys with demo data (`elasticsearch-export` on real data volumes) may +need a much higher value than the 1800 s default. Keep it below the helmfile timeout +(`DEPLOY_TIMEOUT`, default 2700 s, raise both together) so a stuck migration fails as a +`DeadlineExceeded` Job — which the wrapper's recovery path handles — instead of the Helm +client timing out. + ## Legacy env var → values mapping | Legacy env var | New location | From b4da8edb507dad464349f4cf55e3e218f4bc6583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Thu, 20 Aug 2026 13:08:10 +0200 Subject: [PATCH 3/5] Raise the migration deadline default to 3600 s Maintainer decision from the PR review discussion: one hour covers real first-deploy migrations better than 30 minutes. DEPLOY_TIMEOUT's default rises to 5400 s in step, preserving the designed failure semantics - the Job's DeadlineExceeded (handled by the wrapper's recovery path) must fire before the helmfile client timeout. Co-Authored-By: Claude Fable 5 --- charts/shopsys-app/tests/hooks_test.yaml | 2 +- charts/shopsys-app/values.yaml | 4 ++-- docs/deploy-flow.md | 2 +- docs/migrating-from-shopsys-deployment.md | 4 ++-- docs/values.md | 6 +++--- helmfile.yaml.gotmpl | 2 +- .../scenarios/basic-production/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/basic-production/expected/first-deploy.yaml | 2 +- .../development-single-domain/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-single-domain/expected/first-deploy.yaml | 2 +- .../development-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-with-cloudflare/expected/first-deploy.yaml | 2 +- .../golden/scenarios/escaping-env/expected/continuous.yaml | 2 +- .../escaping-env/expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/escaping-env/expected/first-deploy.yaml | 2 +- .../production-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../production-with-cloudflare/expected/first-deploy.yaml | 2 +- 21 files changed, 25 insertions(+), 25 deletions(-) diff --git a/charts/shopsys-app/tests/hooks_test.yaml b/charts/shopsys-app/tests/hooks_test.yaml index 9867f2c..3457559 100644 --- a/charts/shopsys-app/tests/hooks_test.yaml +++ b/charts/shopsys-app/tests/hooks_test.yaml @@ -27,7 +27,7 @@ tests: pattern: 'db-migrations-count-with-maintenance build-deploy-part-2-db-dependent' - equal: path: spec.activeDeadlineSeconds - value: 1800 + value: 3600 - it: switches the command on first deploy template: templates/hooks/job-migrate-application.yaml diff --git a/charts/shopsys-app/values.yaml b/charts/shopsys-app/values.yaml index aa1da2f..70020fb 100644 --- a/charts/shopsys-app/values.yaml +++ b/charts/shopsys-app/values.yaml @@ -355,9 +355,9 @@ deploy: firstDeployWithDemoData: "cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export" # Hard bound for the migration Job (seconds); must exceed the longest migration - # first deploys with demo data (elasticsearch-export) may need a much higher value. - # Keep it below the helmfile timeout (DEPLOY_TIMEOUT, default 2700) so a stuck + # Keep it below the helmfile timeout (DEPLOY_TIMEOUT, default 5400) so a stuck # migration fails as a DeadlineExceeded Job instead of a Helm client timeout. - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 resources: {} postDeploy: enabled: true diff --git a/docs/deploy-flow.md b/docs/deploy-flow.md index 3156cc6..4646790 100644 --- a/docs/deploy-flow.md +++ b/docs/deploy-flow.md @@ -76,7 +76,7 @@ Both are the **same** `helmfile apply`. On the very first deploy: | 9 kustomize variant selection | `deploy.firstDeploy.enabled/loadDemoData` values (set from `FIRST_DEPLOY` env by `runtime.yaml.gotmpl`) | | 10 DISPLAY_FINAL_CONFIGURATION | wrapper: `helmfile template` in a collapsible section | | 11 apply migrate batch | infra release (redis/rabbitmq) + migrate hook Job | -| 12 wait for the job | `helm --wait-for-jobs` (bounded by `DEPLOY_TIMEOUT`, default 45 min — the legacy loop was unbounded) | +| 12 wait for the job | `helm --wait-for-jobs` (bounded by `DEPLOY_TIMEOUT`, default 90 min — the legacy loop was unbounded) | | 13 migration failure recovery | wrapper failure branch (scale cron back to 1, maintenance-off, logs, slack, exit 1) | | 14 apply cron | regular resource in the main apply; the `date` pod label (from `deploy.timestamp`) forces a new pod | | 15+18 HPA delete/re-apply dance | HPAs are permanent; the Deployments omit `replicas` when autoscaling is enabled, so there is nothing to fight (and no transient scale-down) | diff --git a/docs/migrating-from-shopsys-deployment.md b/docs/migrating-from-shopsys-deployment.md index 9e89c1a..c120079 100644 --- a/docs/migrating-from-shopsys-deployment.md +++ b/docs/migrating-from-shopsys-deployment.md @@ -70,7 +70,7 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. `ENABLE_AUTOSCALING` split into independent `webserver.autoscaling.enabled` and `storefront.autoscaling.enabled`. 3. **Bounded waits**: the legacy migration polling loop and cron-watch wait were unbounded; - now `DEPLOY_TIMEOUT` (default 45 min) bounds the apply and + now `DEPLOY_TIMEOUT` (default 90 min) bounds the apply and `cron.terminationGracePeriodSeconds` (default 3600 s) bounds the cron drain. 4. **Cron locking** happens inside the terminating pod (preStop) instead of `kubectl exec` into a pod that stayed alive through the migration. Net effect is identical: no crons run @@ -89,7 +89,7 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. (Redis readiness is probe-backed; RabbitMQ has no default readinessProbe, so the wait guarantees a Running broker container, not yet an accepting broker). The migration and post-deploy Jobs are additionally bounded by `deploy.migration.activeDeadlineSeconds` - (default 1800 s — first deploys with demo data may need much more, see + (default 3600 s — first deploys with demo data may need much more, see [values.md](values.md)) and `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). When a deadline fires, the Job controller deletes the running pod — the Job fails as `DeadlineExceeded` (the wrapper's recovery path still triggers), but the pod logs are diff --git a/docs/values.md b/docs/values.md index d2de7dd..b6c04bc 100644 --- a/docs/values.md +++ b/docs/values.md @@ -85,7 +85,7 @@ deploy: timestamp: "" # injected by the wrapper (forces a new cron pod) firstDeploy: { enabled: false, loadDemoData: false } migration: { enabled, targets: {continuous, firstDeploy, firstDeployWithDemoData}, - resources, activeDeadlineSeconds } # hard Job bound, default 1800 s + resources, activeDeadlineSeconds } # hard Job bound, default 3600 s postDeploy: { enabled, resources, activeDeadlineSeconds } # hard Job bound, default 600 s hooks: { kubectlImage, serviceAccountName } @@ -103,8 +103,8 @@ an environment file — they are not merged. Maps merge deeply. `deploy.migration.activeDeadlineSeconds` must exceed the longest migration variant of the project — first deploys with demo data (`elasticsearch-export` on real data volumes) may -need a much higher value than the 1800 s default. Keep it below the helmfile timeout -(`DEPLOY_TIMEOUT`, default 2700 s, raise both together) so a stuck migration fails as a +need a much higher value than the 3600 s default. Keep it below the helmfile timeout +(`DEPLOY_TIMEOUT`, default 5400 s, raise both together) so a stuck migration fails as a `DeadlineExceeded` Job — which the wrapper's recovery path handles — instead of the Helm client timing out. diff --git a/helmfile.yaml.gotmpl b/helmfile.yaml.gotmpl index 33f19e8..bb48109 100644 --- a/helmfile.yaml.gotmpl +++ b/helmfile.yaml.gotmpl @@ -46,7 +46,7 @@ releases: - {{ $namespace }}/shopsys-infra wait: true waitForJobs: true - timeout: {{ env "DEPLOY_TIMEOUT" | default 2700 }} + timeout: {{ env "DEPLOY_TIMEOUT" | default 5400 }} values: - {{ toYaml .Values | nindent 8 }} - project: diff --git a/tests/golden/scenarios/basic-production/expected/continuous.yaml b/tests/golden/scenarios/basic-production/expected/continuous.yaml index 62b6bf4..37456a7 100644 --- a/tests/golden/scenarios/basic-production/expected/continuous.yaml +++ b/tests/golden/scenarios/basic-production/expected/continuous.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml index 565cef4..6e78a0e 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml index 49cfd05..c4f46aa 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml index 88393de..0e549ca 100644 --- a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml index aaf370d..e998961 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml index dd4ad0b..3d8fc8a 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml index 88ddb2c..b296404 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml index f471859..70358cb 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml index 18b061c..b116a73 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/continuous.yaml b/tests/golden/scenarios/escaping-env/expected/continuous.yaml index e6099fe..2171cea 100644 --- a/tests/golden/scenarios/escaping-env/expected/continuous.yaml +++ b/tests/golden/scenarios/escaping-env/expected/continuous.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml index 62dc8db..661d58c 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml index 765822f..4c92b89 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml index 00a720c..9447910 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml index 55fc7f9..3528ee7 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml index 94be774..6956794 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 1800 + activeDeadlineSeconds: 3600 template: spec: volumes: From f802912069246b8dc72f1163ae99fb5a76e6d971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Thu, 20 Aug 2026 13:13:08 +0200 Subject: [PATCH 4/5] Revert "Raise the migration deadline default to 3600 s" This reverts commit b4da8edb507dad464349f4cf55e3e218f4bc6583. --- charts/shopsys-app/tests/hooks_test.yaml | 2 +- charts/shopsys-app/values.yaml | 4 ++-- docs/deploy-flow.md | 2 +- docs/migrating-from-shopsys-deployment.md | 4 ++-- docs/values.md | 6 +++--- helmfile.yaml.gotmpl | 2 +- .../scenarios/basic-production/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/basic-production/expected/first-deploy.yaml | 2 +- .../development-single-domain/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-single-domain/expected/first-deploy.yaml | 2 +- .../development-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-with-cloudflare/expected/first-deploy.yaml | 2 +- .../golden/scenarios/escaping-env/expected/continuous.yaml | 2 +- .../escaping-env/expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/escaping-env/expected/first-deploy.yaml | 2 +- .../production-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../production-with-cloudflare/expected/first-deploy.yaml | 2 +- 21 files changed, 25 insertions(+), 25 deletions(-) diff --git a/charts/shopsys-app/tests/hooks_test.yaml b/charts/shopsys-app/tests/hooks_test.yaml index 3457559..9867f2c 100644 --- a/charts/shopsys-app/tests/hooks_test.yaml +++ b/charts/shopsys-app/tests/hooks_test.yaml @@ -27,7 +27,7 @@ tests: pattern: 'db-migrations-count-with-maintenance build-deploy-part-2-db-dependent' - equal: path: spec.activeDeadlineSeconds - value: 3600 + value: 1800 - it: switches the command on first deploy template: templates/hooks/job-migrate-application.yaml diff --git a/charts/shopsys-app/values.yaml b/charts/shopsys-app/values.yaml index 70020fb..aa1da2f 100644 --- a/charts/shopsys-app/values.yaml +++ b/charts/shopsys-app/values.yaml @@ -355,9 +355,9 @@ deploy: firstDeployWithDemoData: "cluster-first-deploy db-fixtures-demo plugin-demo-data-load friendly-urls-generate domains-urls-replace elasticsearch-export" # Hard bound for the migration Job (seconds); must exceed the longest migration - # first deploys with demo data (elasticsearch-export) may need a much higher value. - # Keep it below the helmfile timeout (DEPLOY_TIMEOUT, default 5400) so a stuck + # Keep it below the helmfile timeout (DEPLOY_TIMEOUT, default 2700) so a stuck # migration fails as a DeadlineExceeded Job instead of a Helm client timeout. - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 resources: {} postDeploy: enabled: true diff --git a/docs/deploy-flow.md b/docs/deploy-flow.md index 4646790..3156cc6 100644 --- a/docs/deploy-flow.md +++ b/docs/deploy-flow.md @@ -76,7 +76,7 @@ Both are the **same** `helmfile apply`. On the very first deploy: | 9 kustomize variant selection | `deploy.firstDeploy.enabled/loadDemoData` values (set from `FIRST_DEPLOY` env by `runtime.yaml.gotmpl`) | | 10 DISPLAY_FINAL_CONFIGURATION | wrapper: `helmfile template` in a collapsible section | | 11 apply migrate batch | infra release (redis/rabbitmq) + migrate hook Job | -| 12 wait for the job | `helm --wait-for-jobs` (bounded by `DEPLOY_TIMEOUT`, default 90 min — the legacy loop was unbounded) | +| 12 wait for the job | `helm --wait-for-jobs` (bounded by `DEPLOY_TIMEOUT`, default 45 min — the legacy loop was unbounded) | | 13 migration failure recovery | wrapper failure branch (scale cron back to 1, maintenance-off, logs, slack, exit 1) | | 14 apply cron | regular resource in the main apply; the `date` pod label (from `deploy.timestamp`) forces a new pod | | 15+18 HPA delete/re-apply dance | HPAs are permanent; the Deployments omit `replicas` when autoscaling is enabled, so there is nothing to fight (and no transient scale-down) | diff --git a/docs/migrating-from-shopsys-deployment.md b/docs/migrating-from-shopsys-deployment.md index c120079..9e89c1a 100644 --- a/docs/migrating-from-shopsys-deployment.md +++ b/docs/migrating-from-shopsys-deployment.md @@ -70,7 +70,7 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. `ENABLE_AUTOSCALING` split into independent `webserver.autoscaling.enabled` and `storefront.autoscaling.enabled`. 3. **Bounded waits**: the legacy migration polling loop and cron-watch wait were unbounded; - now `DEPLOY_TIMEOUT` (default 90 min) bounds the apply and + now `DEPLOY_TIMEOUT` (default 45 min) bounds the apply and `cron.terminationGracePeriodSeconds` (default 3600 s) bounds the cron drain. 4. **Cron locking** happens inside the terminating pod (preStop) instead of `kubectl exec` into a pod that stayed alive through the migration. Net effect is identical: no crons run @@ -89,7 +89,7 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. (Redis readiness is probe-backed; RabbitMQ has no default readinessProbe, so the wait guarantees a Running broker container, not yet an accepting broker). The migration and post-deploy Jobs are additionally bounded by `deploy.migration.activeDeadlineSeconds` - (default 3600 s — first deploys with demo data may need much more, see + (default 1800 s — first deploys with demo data may need much more, see [values.md](values.md)) and `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). When a deadline fires, the Job controller deletes the running pod — the Job fails as `DeadlineExceeded` (the wrapper's recovery path still triggers), but the pod logs are diff --git a/docs/values.md b/docs/values.md index b6c04bc..d2de7dd 100644 --- a/docs/values.md +++ b/docs/values.md @@ -85,7 +85,7 @@ deploy: timestamp: "" # injected by the wrapper (forces a new cron pod) firstDeploy: { enabled: false, loadDemoData: false } migration: { enabled, targets: {continuous, firstDeploy, firstDeployWithDemoData}, - resources, activeDeadlineSeconds } # hard Job bound, default 3600 s + resources, activeDeadlineSeconds } # hard Job bound, default 1800 s postDeploy: { enabled, resources, activeDeadlineSeconds } # hard Job bound, default 600 s hooks: { kubectlImage, serviceAccountName } @@ -103,8 +103,8 @@ an environment file — they are not merged. Maps merge deeply. `deploy.migration.activeDeadlineSeconds` must exceed the longest migration variant of the project — first deploys with demo data (`elasticsearch-export` on real data volumes) may -need a much higher value than the 3600 s default. Keep it below the helmfile timeout -(`DEPLOY_TIMEOUT`, default 5400 s, raise both together) so a stuck migration fails as a +need a much higher value than the 1800 s default. Keep it below the helmfile timeout +(`DEPLOY_TIMEOUT`, default 2700 s, raise both together) so a stuck migration fails as a `DeadlineExceeded` Job — which the wrapper's recovery path handles — instead of the Helm client timing out. diff --git a/helmfile.yaml.gotmpl b/helmfile.yaml.gotmpl index bb48109..33f19e8 100644 --- a/helmfile.yaml.gotmpl +++ b/helmfile.yaml.gotmpl @@ -46,7 +46,7 @@ releases: - {{ $namespace }}/shopsys-infra wait: true waitForJobs: true - timeout: {{ env "DEPLOY_TIMEOUT" | default 5400 }} + timeout: {{ env "DEPLOY_TIMEOUT" | default 2700 }} values: - {{ toYaml .Values | nindent 8 }} - project: diff --git a/tests/golden/scenarios/basic-production/expected/continuous.yaml b/tests/golden/scenarios/basic-production/expected/continuous.yaml index 37456a7..62b6bf4 100644 --- a/tests/golden/scenarios/basic-production/expected/continuous.yaml +++ b/tests/golden/scenarios/basic-production/expected/continuous.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml index 6e78a0e..565cef4 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml index c4f46aa..49cfd05 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml @@ -1744,7 +1744,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml index 0e549ca..88393de 100644 --- a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml index e998961..aaf370d 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml index 3d8fc8a..dd4ad0b 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml @@ -1521,7 +1521,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml index b296404..88ddb2c 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml index 70358cb..f471859 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml index b116a73..18b061c 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml @@ -1575,7 +1575,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/continuous.yaml b/tests/golden/scenarios/escaping-env/expected/continuous.yaml index 2171cea..e6099fe 100644 --- a/tests/golden/scenarios/escaping-env/expected/continuous.yaml +++ b/tests/golden/scenarios/escaping-env/expected/continuous.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml index 661d58c..62dc8db 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml index 4c92b89..765822f 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml @@ -1771,7 +1771,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml index 9447910..00a720c 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml index 3528ee7..55fc7f9 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml index 6956794..94be774 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml @@ -1876,7 +1876,7 @@ spec: backoffLimit: 0 # Bound the migration - a stuck Job otherwise blocks the deploy until the global # helmfile timeout and stays running in the cluster - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 1800 template: spec: volumes: From aee673cd45da38ac9808efe51f5af9a81deb8b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Thu, 20 Aug 2026 13:24:26 +0200 Subject: [PATCH 5/5] Raise the post-deploy Job deadline default to 1800 s Maintainer decision: post-deploy targets (cache cleanups, part-3) can legitimately run long. The two hook bounds together can now exceed DEPLOY_TIMEOUT - acceptable, both hitting their ceiling in one deploy is not a normal scenario. Co-Authored-By: Claude Fable 5 --- charts/shopsys-app/tests/hooks_test.yaml | 2 +- charts/shopsys-app/values.yaml | 6 ++++-- docs/migrating-from-shopsys-deployment.md | 4 +++- docs/values.md | 2 +- .../scenarios/basic-production/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/basic-production/expected/first-deploy.yaml | 2 +- .../development-single-domain/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-single-domain/expected/first-deploy.yaml | 2 +- .../development-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../development-with-cloudflare/expected/first-deploy.yaml | 2 +- .../golden/scenarios/escaping-env/expected/continuous.yaml | 2 +- .../escaping-env/expected/first-deploy-with-demo-data.yaml | 2 +- .../scenarios/escaping-env/expected/first-deploy.yaml | 2 +- .../production-with-cloudflare/expected/continuous.yaml | 2 +- .../expected/first-deploy-with-demo-data.yaml | 2 +- .../production-with-cloudflare/expected/first-deploy.yaml | 2 +- 19 files changed, 24 insertions(+), 20 deletions(-) diff --git a/charts/shopsys-app/tests/hooks_test.yaml b/charts/shopsys-app/tests/hooks_test.yaml index 9867f2c..3fae5ae 100644 --- a/charts/shopsys-app/tests/hooks_test.yaml +++ b/charts/shopsys-app/tests/hooks_test.yaml @@ -82,7 +82,7 @@ tests: pattern: 'set -e' - equal: path: spec.activeDeadlineSeconds - value: 600 + value: 1800 - matchRegex: path: spec.template.spec.containers[0].command[2] pattern: './phing maintenance-off\n' diff --git a/charts/shopsys-app/values.yaml b/charts/shopsys-app/values.yaml index aa1da2f..71c801d 100644 --- a/charts/shopsys-app/values.yaml +++ b/charts/shopsys-app/values.yaml @@ -361,8 +361,10 @@ deploy: resources: {} postDeploy: enabled: true - # Hard bound for the post-deploy Job (seconds) - activeDeadlineSeconds: 600 + # Hard bound for the post-deploy Job (seconds). Together with the migration bound this + # can exceed DEPLOY_TIMEOUT (2700 s) - acceptable, both hitting their ceiling in one + # deploy is not a normal scenario. + activeDeadlineSeconds: 1800 resources: {} hooks: # kubectlImage is the image used by the cron-suspend hook Job; pinned tag on purpose diff --git a/docs/migrating-from-shopsys-deployment.md b/docs/migrating-from-shopsys-deployment.md index 9e89c1a..1a5e6d9 100644 --- a/docs/migrating-from-shopsys-deployment.md +++ b/docs/migrating-from-shopsys-deployment.md @@ -90,7 +90,9 @@ Intentional differences of the phase-1 rewrite; everything else is a 1:1 port. guarantees a Running broker container, not yet an accepting broker). The migration and post-deploy Jobs are additionally bounded by `deploy.migration.activeDeadlineSeconds` (default 1800 s — first deploys with demo data may need much more, see - [values.md](values.md)) and `deploy.postDeploy.activeDeadlineSeconds` (default 600 s). + [values.md](values.md)) and `deploy.postDeploy.activeDeadlineSeconds` (default 1800 s; + the two bounds together can exceed `DEPLOY_TIMEOUT` — acceptable, both hitting their + ceiling in one deploy is not a normal scenario). When a deadline fires, the Job controller deletes the running pod — the Job fails as `DeadlineExceeded` (the wrapper's recovery path still triggers), but the pod logs are gone; the wrapper then falls back to `kubectl describe job` output. diff --git a/docs/values.md b/docs/values.md index d2de7dd..ddd0f12 100644 --- a/docs/values.md +++ b/docs/values.md @@ -86,7 +86,7 @@ deploy: firstDeploy: { enabled: false, loadDemoData: false } migration: { enabled, targets: {continuous, firstDeploy, firstDeployWithDemoData}, resources, activeDeadlineSeconds } # hard Job bound, default 1800 s - postDeploy: { enabled, resources, activeDeadlineSeconds } # hard Job bound, default 600 s + postDeploy: { enabled, resources, activeDeadlineSeconds } # hard Job bound, default 1800 s hooks: { kubectlImage, serviceAccountName } extraManifests: [] # raw manifests (rendered through tpl) — escape hatch diff --git a/tests/golden/scenarios/basic-production/expected/continuous.yaml b/tests/golden/scenarios/basic-production/expected/continuous.yaml index 62b6bf4..753e900 100644 --- a/tests/golden/scenarios/basic-production/expected/continuous.yaml +++ b/tests/golden/scenarios/basic-production/expected/continuous.yaml @@ -1813,7 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml index 565cef4..5b12854 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy-with-demo-data.yaml @@ -1813,7 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml index 49cfd05..5db65ff 100644 --- a/tests/golden/scenarios/basic-production/expected/first-deploy.yaml +++ b/tests/golden/scenarios/basic-production/expected/first-deploy.yaml @@ -1813,7 +1813,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml index 88393de..0caab72 100644 --- a/tests/golden/scenarios/development-single-domain/expected/continuous.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/continuous.yaml @@ -1590,7 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml index aaf370d..8419d4b 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy-with-demo-data.yaml @@ -1590,7 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml index dd4ad0b..7ec9cd1 100644 --- a/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-single-domain/expected/first-deploy.yaml @@ -1590,7 +1590,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml index 88ddb2c..fa3dc8b 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/continuous.yaml @@ -1644,7 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml index f471859..8aaac29 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1644,7 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml index 18b061c..eb1164d 100644 --- a/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/development-with-cloudflare/expected/first-deploy.yaml @@ -1644,7 +1644,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/continuous.yaml b/tests/golden/scenarios/escaping-env/expected/continuous.yaml index e6099fe..6d00e93 100644 --- a/tests/golden/scenarios/escaping-env/expected/continuous.yaml +++ b/tests/golden/scenarios/escaping-env/expected/continuous.yaml @@ -1842,7 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml index 62dc8db..0fc45a9 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy-with-demo-data.yaml @@ -1842,7 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml index 765822f..777e939 100644 --- a/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml +++ b/tests/golden/scenarios/escaping-env/expected/first-deploy.yaml @@ -1842,7 +1842,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml index 00a720c..0ad3466 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/continuous.yaml @@ -1945,7 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml index 55fc7f9..c264a41 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy-with-demo-data.yaml @@ -1945,7 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: diff --git a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml index 94be774..cca513b 100644 --- a/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml +++ b/tests/golden/scenarios/production-with-cloudflare/expected/first-deploy.yaml @@ -1945,7 +1945,7 @@ metadata: helm.sh/hook-delete-policy: before-hook-creation spec: backoffLimit: 0 - activeDeadlineSeconds: 600 + activeDeadlineSeconds: 1800 template: spec: volumes: