gitops-operator
gitops-operator copied to clipboard
Helm with Kustomize uses wrong kubernetes version when templating
Describe the bug I cannot add an application that uses a Helm chart with Kustomize if the Helm has a minimum kubeVersion requirement higher than v1.20.0 even though the cluster is running kubernetes version 1.23.x This is the same issue as described here: https://stackoverflow.com/questions/75008850/kustomize-helm-error-on-chart-semver-requirements
To Reproduce Steps to reproduce the behavior:
- Install the Openshift GitOps operator on a 4.10.36 Openshift cluster
- Edit the
argocd/openshift-gitopsresource in namespaceopenshift-gitopsand addkustomizeBuildOptions: '--enable-helm'to the specs - Create a repo with a kustomize file referencing a helm chart with a minimum kubeVersion requirement higher than v1.20.0. For example:
apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization metadata: name: jira-data-center helmCharts: - name: jira version: 1.8.1 repo: https://atlassian.github.io/data-center-helm-charts valuesFile: values.yaml releaseName: jira-data-center - Add a
values.yamlfile to the repo (this can be the default values.yaml file) - Add an application to ArgoCD referencing the repo
- See error
Expected behavior The application is created
Screenshots Error message:
Unable to create application: application spec for jira-test is invalid: InvalidSpecError: Unable to generate manifests in kustomize/envs/prd: rpc error: code = Unknown desc = Manifest generation error (cached): `kustomize build .kustomize/envs/prd --enable-helm` failed exit status 1: Error: accumulating resources: accumulation err='accumulating resources from '../../base': '.kustomize/base' must resolve to a file': recursed accumulation of path '.kustomize/base': Error: chart requires kubeVersion: >=1.21.x-0 which is incompatible with Kubernetes v1.20.0 Use --debug flag to render out invalid YAML : unable to run: 'helm template jira-data-center .kustomize/base/charts/jira --values /tmp/kustomize-helm-1206483794/jira-kustomize-values.yaml' with env=[HELM_CONFIG_HOME=/tmp/kustomize-helm-1206483794/helm HELM_CACHE_HOME=/tmp/kustomize-helm-1206483794/helm/.cache HELM_DATA_HOME=/tmp/kustomize-helm-1206483794/helm/.data] (is 'helm' installed?)
The folder structure the slightly different here than in the reproduction steps, but the kustomize file in env/prd has base as only resource, so the situation is similar.
Additional context According to the stackoverflow entry mentioned above, it looks like Helm falls back to a default kube version, maybe because it has no reference to the cluster.
The same deployment works with the ArgoCD community operator by the way.