openfga / helm-charts

Official Helm charts for the OpenFGA project.
https://openfga.dev
Apache License 2.0
24 stars 37 forks source link

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

Open tamalsaha opened 5 months ago

tamalsaha commented 5 months ago

This makes it possible to use this chart with fluxcd

Description

Helm charts and Jobs don't work well together. This is evident from many prs trying to address some aspects of this issue. I try to document the issues as best I can think of here: https://x.com/tsaha/status/1805382111844778275

This pr tries to address this issue as best as possible I think.

If the hooks are used, we can't use fluxcd to install this chart with --wait flag. See here: https://github.com/fluxcd/flux2/discussions/1085#discussioncomment-473271

What seems to work well in our experience is just run the migrate job at the same time as the potential db sub-chart, increase the timeout of the migrate job and increase number of retries. https://github.com/openfga/helm-charts/pull/130 pr ensures that at least one successful run of the migrate job will be considered successful. So, extending the timeout and increasing retries works well even if the db subchart takes unusally long time to be ready.

References

Review Checklist

tamalsaha commented 2 months ago

Tested in ArgoCD using

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: openfga
  namespace: argocd
spec:
  project: default
  source:
    chart: openfga
    repoURL: ghcr.io/appscode-charts
    targetRevision: 0.2.13
    helm:
      releaseName: openfga
      valuesObject:
        datastore:
          engine: postgres
          uri: "postgres://postgres:password@openfga-postgresql.default.svc.cluster.local:5432/postgres?sslmode=disable"
        postgresql:
          enabled: true
          auth:
            postgresPassword: password
            database: postgres
  destination:
    server: "https://kubernetes.default.svc"
    namespace: default