fluxcd / helm-controller

The GitOps Toolkit Helm reconciler, for declarative Helming
https://fluxcd.io
Apache License 2.0
409 stars 164 forks source link

Helm-Controller fails to render all Chart dependencies when using aliases #575

Closed waterbrother closed 1 year ago

waterbrother commented 1 year ago

Describe the bug

When the Flux helm controller renders a Helm chart with aliased Dependencies, only one of the aliased charts is installed to the cluster. It appears to be indeterminate which version of the chart dependency gets installed; the consistent factor is that only one dependency is installed.

Example Chart.yaml:

---
apiVersion: v2
name: my-platform
version: 3.0.0
dependencies:
- name: k8s-version-test
  version: 1.0.8
  repository: https://myrepo
  tags:
  - k8s-version-test
  - 1.0.8
  - master
  - 8809857d2bf0
- name: k8s-version-test
  version: 1.0.9
  repository: https://myrepo
  alias: k8s-version-test-25777e3706f2
  tags:
  - k8s-version-test
  - 1.0.9
  - feature-branch
  - 25777e3706f2

Result from kubectl get deploy -n default:

NAME               READY   UP-TO-DATE   AVAILABLE   AGE
k8s-version-test   1/1     1            1           21h

If the Chart is installed with helm upgrade --install, the Dependencies are installed as expected:

NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
k8s-version-test                        1/1     1            1           98s
k8s-version-test-25777e3706f2           1/1     1            1           98s

Flux is installing the Chart from a Git source:

NAME                            REVISION        SUSPENDED       READY   MESSAGE                                                                        
flux-system                     master/8af5e5a  False           True    stored artifact for revision 'master/8af5e5a1ad12958e30f6a150911e80e1e04d7c32'
my-platform-source-git     devops/8ded594  False           True    stored artifact for revision 'devops/8ded5946623aaae96c958fc01e6494658c116a9a'

Here's the HelmRelease:

NAME                    REVISION                SUSPENDED       READY   MESSAGE                          
my-platform        3.0.0+8ded5946623a      False           True    Release reconciliation succeeded

FluxCD version:

flux: v0.36.0
helm-controller: v0.26.0
kustomize-controller: v0.30.0
notification-controller: v0.28.0
source-controller: v0.31.0

Kubernetes version:

Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.8", GitCommit:"5575935422cc1cf5169dfc8847cb587aa47bac5a", GitTreeState:"clean", BuildDate:"2021-06-16T13:00:45Z", GoVersion:"go1.15.13", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.8", GitCommit:"5575935422cc1cf5169dfc8847cb587aa47bac5a", GitTreeState:"clean", BuildDate:"2021-06-16T12:53:07Z", GoVersion:"go1.15.13", Compiler:"gc", Platform:"linux/amd64"}

Steps to reproduce

  1. Create a Helm Chart with aliased Dependencies
  2. Configure the Git repo as the source
  3. Create a HelmRelease based on the source
  4. Reconcile the HelmRelease

Expected behavior

A set of resources based on the name of the aliased charts is created.

waterbrother commented 1 year ago

I have some information to add to this: if the aliased charts are referencing the chart at the same version, they're rendered correctly. It seems that only one version of a chart dependency can be rendered at a time.

souleb commented 1 year ago

Hi @waterbrother, the bug was in source-controller, which is responsible for reconciling helmCharts custom resources. The fix has been merged and will hopefully be part of the next release.

waterbrother commented 1 year ago

Hi @souleb That makes sense; thank you for the fast fix! When is the next release scheduled, or how can I be notified when this is released?

stefanprodan commented 1 year ago

how can I be notified when this is released?

Subscribe to the https://github.com/fluxcd/flux2 releases by clicking the watch button. Also please setup Flux autoupdate workflow for your bootstrap repos: https://github.com/fluxcd/flux2/tree/main/action#automate-flux-updates

waterbrother commented 1 year ago

Awesome, thanks again!

hiddeco commented 1 year ago

Updated via https://github.com/fluxcd/helm-controller/pull/581, release building. Thanks @waterbrother and @souleb :bow: