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 does not see values file in chart if it is name is not 'values.yaml'. #574

Open SrDayne opened 1 year ago

SrDayne commented 1 year ago

Describe the bug

After specifying values file name in valuesFiles, helm controller still looks for 'values.yaml' file even if specified file exists in chart(main-values.yaml in my case). Output of kubectl events:

flux-system       6m51s       Warning   ValuesFilesError             helmchart/zino-dev-pr1-dev           values files merge error: failed to merge chart values: no values file found at path 'main-values.yaml'
flux-system       6m11s       Warning   ValuesFilesError             helmchart/zino-dev-pr1-dev           values files merge error: failed to locate values file: values.yaml

Helm release:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: pr1-dev
  namespace: zino-dev
spec:
  interval: 5m
  chart:
    spec:
      chart: zino-helm
      version: '0.0.1' # {"$imagepolicy": "flux-system:helm-update-policy:tag"}
      interval: 1m
      sourceRef:
        kind: HelmRepository
        name: helm-zino
        namespace: flux-system
      valuesFiles:
        - main-values.yaml
  values:
    image:
      repository: example.repo.domain/php_dev_test # {"$imagepolicy": "flux-system:zino-dev-image:name"}
      tag: 17713893.zino # {"$imagepolicy": "flux-system:zino-dev-image:tag"}
      imagePullPolicy: Always

Helm chart structure: ├── cert │ ├── zino.crt │ ├── zino.key ├── config │ ├── nginx.cnf │ ├── vhost.conf └── templates │ ├── certificate.yaml │ ├── configmap-nginx-conf.yaml │ ├── configmap-vhost-conf.yaml │ ├── deployment.yaml │ ├── hpa.yaml │ ├── ingress.yaml │ ├── service.yaml │ ├── service-account.yaml │ ├── post-install.yaml │ ├── post-upgrade.yaml │ ├── secrets.yaml ├── Chart.yaml ├── index.yaml ├── main-values.yaml

Steps to reproduce

Rename values.yaml in chart, specify new name in valuesFiles, try to deploy

Expected behavior

Values from chart applied no matter the name

Screenshots and recordings

No response

OS / Distro

EKS

Flux version

v0.37.0 Flux check

$ flux check ► checking prerequisites ✔ Kubernetes 1.23.13-eks-fb459a0 >=1.20.6-0 ► checking controllers ✔ helm-controller: deployment ready ► ghcr.io/fluxcd/helm-controller:v0.27.0 ✔ image-automation-controller: deployment ready ► ghcr.io/fluxcd/image-automation-controller:v0.27.0 ✔ image-reflector-controller: deployment ready ► ghcr.io/fluxcd/image-reflector-controller:v0.23.0 ✔ kustomize-controller: deployment ready ► ghcr.io/fluxcd/kustomize-controller:v0.31.0 ✔ notification-controller: deployment ready ► ghcr.io/fluxcd/notification-controller:v0.29.0 ✔ source-controller: deployment ready ► ghcr.io/fluxcd/source-controller:v0.32.1 ► checking crds ✔ alerts.notification.toolkit.fluxcd.io/v1beta1 ✔ buckets.source.toolkit.fluxcd.io/v1beta2 ✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2 ✔ helmcharts.source.toolkit.fluxcd.io/v1beta2 ✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1 ✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2 ✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1 ✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1 ✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1 ✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2 ✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2 ✔ providers.notification.toolkit.fluxcd.io/v1beta1 ✔ receivers.notification.toolkit.fluxcd.io/v1beta1 ✔ all checks passed

Git provider

Gitlab self hosted

Container Registry provider

Girlab self hosted

Additional context

No response

Code of Conduct

✔ I agree to follow this project's Code of Conduct

hiddeco commented 1 year ago

As mentioned before in https://github.com/fluxcd/helm-controller/issues/381#issuecomment-993397041, a chart is still expected to contain a values.yaml file.

SrDayne commented 1 year ago

Hello, hiddeco. Thanks for fast responce.

I've already read that issue and found that values.yaml should exist in the chart. But I found not clear what docs says about it: https://fluxcd.io/flux/guides/helmreleases/#refer-to-values-inside-the-chart

And that is why I created discussion: https://github.com/fluxcd/flux2/discussions/3397

In that discussion @stefanprodan mentioned that I can omit values.yaml file and left only values-production.yaml file. And he recommended to open issue.

So, from my understending now, file values.yaml can be replaced only if we have values.yaml inside chart. In this case, I think docs should be improved.