Skip to content

Commit 1fe1b66

Browse files
committed
Run migrate job as pre hook with option to auto cleanup
xref: https://x.com/tsaha/status/1805382111844778275 Signed-off-by: Tamal Saha <[email protected]>
1 parent eed5562 commit 1fe1b66

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

charts/openfga/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: openfga
33
description: A Kubernetes Helm chart for the OpenFGA project.
44

55
type: application
6-
version: 0.2.6
6+
version: 0.2.7
77
appVersion: "v1.5.4"
88

99
home: "https://openfga.github.io/helm-charts"

charts/openfga/templates/job.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ metadata:
1313
{{- toYaml . | nindent 4 }}
1414
{{- end }}
1515
spec:
16+
backoffLimit: 3
17+
{{- if ge .Values.migrate.ttlSecondsAfterFinished 0 }}
18+
ttlSecondsAfterFinished: {{ .Values.migrate.ttlSecondsAfterFinished }}
19+
{{- end }}
1620
template:
1721
metadata:
1822
{{- with .Values.migrate.annotations }}
@@ -79,5 +83,4 @@ spec:
7983
tolerations:
8084
{{- toYaml . | nindent 8 }}
8185
{{- end }}
82-
backoffLimit: 1
8386
{{- end }}

charts/openfga/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,12 @@ affinity: {}
320320
sidecars: []
321321
migrate:
322322
sidecars: []
323+
# https://github.com/fluxcd/flux2/discussions/1085#discussioncomment-473271
324+
# https://github.com/helm/helm/issues/9027#issuecomment-1908032461
323325
annotations:
324-
helm.sh/hook: "post-install, post-upgrade, post-rollback, post-delete"
326+
helm.sh/hook: "pre-install, pre-upgrade, pre-rollback, pre-delete"
325327
helm.sh/hook-weight: "-5"
326328
helm.sh/hook-delete-policy: "before-hook-creation"
327329
labels: {}
328330
timeout:
331+
ttlSecondsAfterFinished: -1

0 commit comments

Comments
 (0)