Skip to content

Commit 0062de3

Browse files
committed
feat(helm): add Helm hook annotations to migration Job
Add Helm hook annotations to the migration Job template to ensure proper recreation during upgrades and prevent immutable field errors. Changes: - Add helm.sh/hook: pre-install,pre-upgrade to run Job before install/upgrade - Add helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded to remove old Jobs and clean up succeeded ones - Bump chart version to 0.9.1 - Update CHANGELOG with migration job fix details This eliminates upgrade failures caused by Kubernetes rejecting changes to immutable spec.template fields in existing Job resources. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
1 parent f2183b1 commit 0062de3

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

charts/mcp-stack/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
66

77
---
88

9+
## [0.9.1] - 2025-12-03
10+
11+
### Added
12+
* **Helm Hook Support for Migration Job** - enable recreation of the migration Job on every deployment
13+
- helm.sh/hook: pre-install,pre-upgrade — ensures the migration Job runs automatically during installs and upgrades
14+
- helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded — removes old migration Jobs to prevent immutable field errors
15+
- Eliminates upgrade failures caused by changes to spec.template in Kubernetes Jobs
16+
17+
### Changed
18+
* **Chart version** - Bumped to 0.9.1 for migration job fix
19+
920
## [0.9.0] - 2025-11-05
1021

1122
### Added

charts/mcp-stack/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type: application
2222
# * appVersion - upstream application version; shown in UIs but not
2323
# used for upgrade logic.
2424
# --------------------------------------------------------------------
25-
version: 0.9.0
25+
version: 0.9.1
2626
appVersion: "0.9.0"
2727

2828
# Icon shown by registries / dashboards (must be an http(s) URL).

charts/mcp-stack/templates/job-migration.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ metadata:
66
labels:
77
{{- include "mcp-stack.labels" . | nindent 4 }}
88
app.kubernetes.io/component: migration
9+
annotations:
10+
# Run this Job before install/upgrade
11+
"helm.sh/hook": pre-install,pre-upgrade
12+
# Delete old Job before new one and clean up succeeded ones
13+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
914
spec:
1015
# Job configuration
1116
backoffLimit: {{ .Values.migration.backoffLimit }}
@@ -61,16 +66,13 @@ spec:
6166
secretKeyRef:
6267
name: {{ include "mcp-stack.postgresSecretName" . | trim }}
6368
key: POSTGRES_PASSWORD
64-
6569
# ---------- DERIVED URLS ----------
6670
- name: DATABASE_URL
6771
value: >-
6872
postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)
69-
7073
# ---------- LOGGING ----------
7174
- name: LOG_LEVEL
7275
value: "INFO"
73-
7476
# Resource limits
7577
resources:
7678
{{- toYaml .Values.migration.resources | nindent 12 }}

0 commit comments

Comments
 (0)