-
Notifications
You must be signed in to change notification settings - Fork 624
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
Error while running post render on files when using HelmRelease with local alias dependencies #4368
Comments
I suspect that something like |
Nope, please dont make me repeat myself. I said Whats more following steps I described in To make sure there are not duplicates I went with the command you proposed. Here is the output:
|
The reason I am asking this, is because historically any bug reported like this ended up being some mistake in the chart, and not a problem with the helm-controller. The fact that One other thing that comes to mind is that you may have some empty document defined in the final
If that is not the case either, I can not provide more help without being able to reproduce the issue myself (using e.g. your chart, or the output from |
Ok, so I created a repo for this purpose with sample source files. Combining it together gives following error:
while its clear that there are only two resources and none of them is a duplicate:
|
Are there any estimations for this bug? |
Hi! I have exactly the same issue, with the following flux versions:
I have a chart using a subchart, and the subchart is instanciated multiple times with aliases - exactly like @kgreczka-iteo mentioned. My gut feeling is that Flux generates unique IDs for every resource, but when a Helm chart has subcharts with aliases, it uses the subchart name instead of its alias when generating the ID, thus leading into a conflict. I don't have a fix (yet) but I wanted to confirm that this wasn't an isolated issue :) |
This PR introduces a new fluxcd-kustomize.sh script that can be used as post-processor for helm for adding a common fluxcd labels. This is very useful for `make diff`, so it will not include diff between these labels anymore Also for debugging specific kustomize cases, eg: - fluxcd/helm-controller#283 - fluxcd/flux2#4368 Signed-off-by: Andrei Kvapil <[email protected]>
+1 on this issue. I have the same versions as @jpetazzo |
@kgreczka-iteo thanks for the repo, I was able to reproduce the issue locally. The bug is (somewhere) in source-controller, the chart artifact produced after consuming the GitRepository source looks very different from the original, check the screenshots below. Original chart in the git repo: Output from Click to expand YAML---
# Source: sample-flux-fail/charts/just-one-pod1/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod2/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80 Chart produced by source-controller after consuming the git repo: Output from Click to expand YAML---
# Source: sample-flux-fail/charts/just-one-pod1/charts/just-one-pod1/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod1/charts/just-one-pod2/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod1/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod2/charts/just-one-pod1/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod1
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod2/charts/just-one-pod2/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
# Source: sample-flux-fail/charts/just-one-pod2/templates/pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod2
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80 The pods are duplicated indeed |
By the way, there is a small bug in the example @kgreczka-iteo, the name of the subchart is In any case, the source-controller bug still happens even after fixing this. |
I found the issue, the chart name is not taken into account for resolving a local dependency: |
We ran into exact the same issue yesterday, will report back, if this fixes it! |
Describe the bug
When using a HelmRelease with Chart downloaded from Git Source, that have local alias dependencies we are experiencing strange behaviour. The outcome error is
helm-controller reconciliation failed: Helm install failed: error while running post render on files: may not add resource with an already registered id:
.We could not find the root cause of the issue. While
helm install
andhelm template
thenkubectl apply
works perfectly, Flux cant make it work. There is some config that helps mitigating it, but that is a very wide workaround:{{- if .Values.enabled }}
statement to each resource in template.values.yaml
, set tofalse
.false
.The "enabled" value can only be overridden (i.e., set to true) in the HelmRelease step. If this value is enabled at any step closer to the subchart, it will trigger the error.
Steps to reproduce
Expected behavior
The chart should be processed just like
helm template
orhelm install
does. There are no duplicates or resources with exact same id.Screenshots and recordings
No response
OS / Distro
EKS
Flux version
v2.1.1
Flux check
flux check
► checking prerequisites
✗ flux 2.1.1 <2.1.2 (new version is available, please upgrade)
✔ Kubernetes 1.27.6-eks-f8587cb >=1.25.0-0
► checking controllers
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.35.0
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.35.0
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.29.1
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v1.0.1
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v1.0.0
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v1.0.1
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta2
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta2
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed
Git provider
GitHub
Container Registry provider
No response
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: