diff --git a/charts/openfga/templates/deployment.yaml b/charts/openfga/templates/deployment.yaml index 5af7dfb..3e604e7 100644 --- a/charts/openfga/templates/deployment.yaml +++ b/charts/openfga/templates/deployment.yaml @@ -15,6 +15,7 @@ spec: selector: matchLabels: {{- include "openfga.selectorLabels" . | nindent 6 }} + app.kubernetes.io/component: server template: metadata: annotations: @@ -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: diff --git a/charts/openfga/templates/job.yaml b/charts/openfga/templates/job.yaml index 3ec2595..da0231f 100644 --- a/charts/openfga/templates/job.yaml +++ b/charts/openfga/templates/job.yaml @@ -8,19 +8,32 @@ 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 + 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: @@ -87,5 +100,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - backoffLimit: 1 {{- end }} diff --git a/charts/openfga/values.yaml b/charts/openfga/values.yaml index 686a1eb..5799783 100644 --- a/charts/openfga/values.yaml +++ b/charts/openfga/values.yaml @@ -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