Replies: 2 comments 2 replies
-
your |
Beta Was this translation helpful? Give feedback.
-
So this looks to be a bug on FluxCD side and does not have anything to do with HelmRelease itself, faulty or not.
In my case, flux-system kustomization.yaml is unable to create the app1 kustomization resource in flux-system with an error message that seems to indicate an issue with the HelmRelease:
The way I got around this issue was to simply move the content of apps.yaml kustomization to infrastructure.yaml kustomization file, so now infrastructure.yaml contains the previously created app1-mailhog, app1-mysql kustomizations as well as app1 kustomization, which was now also successfully created:
While there is an issue with patches add operation in app1 kustomization, the kustomization itself was created in the cluster, as it should be. After fixing the issues regarding patches add paths, the app1 kustomization resource reported READY as True:
However, the app1 helmrelease resource in app1 namespace is reporting an issue:
This was just to illustrate that issues with HelmRelease are reported by HelmRelease resource, and not by flux-system kustomization resource. Now back to the original issue, after app1 kustomization was successfully created, I removed the app1 yaml from infrastrcuture.yaml, which made flux remove app1 kustomization from the cluster, as it should. Next I added apps.yaml back with the app1 kustomization yaml, meaning I restored the original configuration that caused the error, but this time app1 kustomization resource was successfully created. Meaning that I could not reproduce the issue, maybe because there's some cache still present somewhere in flux-system namespace, I don't really know. Perhaps I can reproduce it by also removing infrastructure.yaml, and adding them back in the same order - first infrastructure.yaml and then apps.yaml, or perhaps a completely removal of flux-system is needed. There seems to be other issues when it comes to flux-system kustomization reading files from the specified directory, for example right now I'm using inline JSON6902 format in apps.yaml file to apply patches, but I originally wanted to use path, like in this example and I created 2 helmrelease yaml files to apply patches from: appconf.yaml and sealedsecrets.yaml, but flux-system kustomization failed and gave this error: So either this is a bug, or undocumented restrictions when it comes to reading .yaml files from the bootstrapped path. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a setup where each application has their own Git repo (app1, app2, etc.), their own custom Helm chart and their own HelmRelease plus any additional .yaml files (wrapped by a kustomization.yaml) for the app and infrastructure separately (similarly to https://github.com/fluxcd/flux2-kustomize-helm-example/tree/main)
There is a separate repository called fluxcd, where I have bootstrapped K8s clusters, for example test cluster is bootstrapped to clusters/test and prod cluster to clusters/production. This is the general structure of the fluxcd repo:
apps.yaml and infrastructure.yaml files are Kustomization files that reference their respective kustomization.yaml files inside the app repos. The HelmRelease yamls for infrastructure use the helm repositories defined in fluxcd project and as they are public repos, the infrastructure HelmRelease deployment works without issues, and the helm charts + other yamls get deployed as they should.
The setup for app deployment is as follows:
In app1 repo I have .helm/app1 directory containing Chart.yaml, values.yaml and templates, aka a normal helm chart structure.
In app1 repo I also have .kubernetes/apps/app1 directory containing a helmrelease.yaml and kustomization.yaml:
(According to documentation, version: parameter is ignored for GitRepository sourceRef, but I added it anyway, hope that didn't cause the issue.)
The referenced git repo is the gitrepository.yaml file defined in fluxcd repo in .clusters/test/app1:
So the source-controller authenticates with the app1 repo using the deploy token with read repo and registry rights.
And finally the apps.yaml file in fluxcd repo that is supposed to actually deploy the HelmRelease to K8s:
The error message I am getting:
2024-03-13T10:54:07.596Z error Kustomization/flux-system.flux-system - Reconciliation failed after 576.420153ms, next try in 10m0s HelmRelease/app1/app1 dry-run failed (Invalid): HelmRelease.helm.toolkit.fluxcd.io "app1" is invalid: [spec.chart: Required value, spec.interval: Required value]
Now my assumption was that the app1 HelmRelease should be able to fetch the chart from the Git repo, as the reconciliation is done inside flux-system namespace, which can read app1 repo via the deploy token secret. Or is it necessary to define another gitrepository.yaml towards the same app1 repo just to be used for helm chart fetching, but with different parameters? Or maybe the issue is something else entirely, it's hard to tell as the error says it requires spec.chart and spec.interval values, which are defined.
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions