source-controller
source-controller copied to clipboard
Failure to package two versions of the same chart as subcharts
It seems that installing a HelmRelease from a GitRepository source will fail to install all subcharts if the helm chart references the same chart with different versions as distinct subcharts using alias.
The issue occurs with source-controller v0.15.3.
Consider for example this chart (Chart.yaml) committed in the the hypothetical repository https://example.org/flux2-subchart-test at the path path/to/chart:
name: flux2-subchart-test
version: 1.0.0
appVersion: 1.0.0
apiVersion: v2
dependencies:
- name: redis
alias: redis-a
version: 14.8.8
repository: https://charts.bitnami.com/bitnami
- name: redis
alias: redis-b
version: 14.8.7
repository: https://charts.bitnami.com/bitnami
Then the chart would be installed making use of the following resources:
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: example-repo
namespace: flux-system
spec:
gitImplementation: go-git
interval: 10m0s
ref:
branch: master
secretRef:
name: git-checkout-cred
timeout: 60s
url: https://example.org/flux2-subchart-test
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: flux2-subchart-test
spec:
interval: 5m
chart:
spec:
sourceRef:
kind: GitRepository
name: example-repo
namespace: flux-system
chart: './path/to/chart'
interval: 1m
The result is that there is one redis charts installed, not two.
From a quick inspection of the helm chart that gets packaged it looks like there is one subchart included as directory in the archive at the path charts/redis. When running helm dependency build in the chart directory there will be instead two subcharts charts/redis-14.8.7.tgz and charts/redis-14.8.8.tgz. It looks like the subcharts not being qualified with their version could be the issue.
If the same version is specified in Chart.yaml for both subcharts, they seem to be installed without problems.
With the helm-operator and flux v1 this used to work.