Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace migrate hooks with longer timeouts and retries #136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/openfga/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
selector:
matchLabels:
{{- include "openfga.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: server
template:
metadata:
annotations:
Expand All @@ -26,6 +27,7 @@ spec:
prometheus.io/port: "{{ (split ":" .Values.telemetry.metrics.addr)._1 }}"
labels:
{{- include "openfga.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: server
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
25 changes: 20 additions & 5 deletions charts/openfga/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,35 @@ metadata:
{{- with .Values.migrate.labels }}
{{- toYaml . | nindent 4}}
{{- end}}
{{- with .Values.migrate.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.migrate.annotations }}
{{- toYaml . | nindent 4}}
{{- end}}
{{- if .Values.migrate.hook.enable }}
helm.sh/hook: {{ .Values.migrate.hook.hook | quote }}
helm.sh/hook-weight: {{ .Values.migrate.hook.hookWeight | quote }}
helm.sh/hook-delete-policy: {{ .Values.migrate.hook.hookDeletePolicy | quote }}
{{- end}}
spec:
backoffLimit: 3
{{- if ge (int .Values.migrate.ttlSecondsAfterFinished) 0 }}
ttlSecondsAfterFinished: {{ .Values.migrate.ttlSecondsAfterFinished }}
{{- end }}
manualSelector: true
selector:
matchLabels:
{{- include "openfga.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: migrate
template:
metadata:
{{- with .Values.migrate.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.migrate.labels }}
labels:
{{- include "openfga.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: migrate
{{- with .Values.migrate.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
Expand Down Expand Up @@ -87,5 +103,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
backoffLimit: 1
{{- end }}
15 changes: 10 additions & 5 deletions charts/openfga/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,17 @@ migrate:
extraVolumes: []
extraVolumeMounts: []
sidecars: []
annotations:
helm.sh/hook: "post-install, post-upgrade, post-rollback, post-delete"
helm.sh/hook-weight: "-5"
helm.sh/hook-delete-policy: "before-hook-creation"
# https://github.com/fluxcd/flux2/discussions/1085#discussioncomment-473271
# https://github.com/helm/helm/issues/9027#issuecomment-1908032461
hook:
enable: false
hook: "post-install, post-upgrade, post-rollback, post-delete"
hookWeight: "-5"
hookDeletePolicy: "before-hook-creation"
annotations: {}
labels: {}
timeout:
timeout: 10m
ttlSecondsAfterFinished: -1

# -- Array of extra K8s manifests to deploy
## Note: Supports use of custom Helm templates
Expand Down