travisghansen / argo-cd-helmfile

Integration between argo-cd and helmfile
MIT License
213 stars 55 forks source link

Not installing crds in folder of helm chart #54

Closed ausias-armesto closed 6 months ago

ausias-armesto commented 6 months ago

I'm trying to install the helm chart for redis operator with this helmfile:

repositories:
 - name: ot-container-kit
   url: https://ot-container-kit.github.io/helm-charts/
releases:
- name: redis-operator
  namespace: redis
  chart: ot-container-kit/redis-operator
  version: 0.15.9
  disableValidation: false
  disableValidationOnInstall: false
  disableOpenAPIValidation: false

with this Argocd app:

---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: redis-operator
  namespace: argocd
spec:
  destination:
    namespace: redis
    server: https://kubernetes.default.svc
  source:
    path: helm-charts/redis-operator
    repoURL: <GITHUB_REPO_URL>
    targetRevision: master
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: true
    syncOptions:
      - CreateNamespace=true
      - PruneLast=true

And I get this error in the deployed application

{"level":"error","ts":1708348036.8567078,"logger":"controller.redisreplication","msg":"Could not wait for Cache to sync","reconciler group":"redis.redis.opstreelabs.in","reconciler kind":"RedisReplication", "error":"failed to wait for redisreplication caches to sync: timed out waiting for cache to be synced","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:208\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/internal/controller/controller.go:234\nsigs.k8s.io/controller-runtime/pkg/manager.(*runnableGroup).reconcile.func1\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.0/pkg/manager/runnable_group.go:218"}  

If I execute this command kubectl get crds | grep redis.opstreelabs I get an empty list

If I install the helm-chart using directly helmfile with this command helmfile sync, then it installs the required CRDS.

➜  kubectl get crds | grep redis.opstreelabs
redis.redis.redis.opstreelabs.in                  2024-02-19T15:05:06Z
redisclusters.redis.redis.opstreelabs.in          2024-02-19T15:05:01Z
redisreplications.redis.redis.opstreelabs.in      2024-02-19T15:05:04Z
redissentinels.redis.redis.opstreelabs.in         2024-02-19T15:05:05Z

This issue seems to be related to https://github.com/roboll/helmfile/issues/1353

Why the arg-cd-helmfile plugin does not install the CRDS?

travisghansen commented 6 months ago

Try something like this in your argocd app definition:

              env:
              ...
              - name: HELMFILE_TEMPLATE_OPTIONS
                value: '--include-crds'
              - name: HELM_TEMPLATE_OPTIONS
                value: '--skip-tests'
              ...
ausias-armesto commented 6 months ago

Thanks, it worked