helmfile: .Capabilities.APIVersions returns wrong results

The helm built-in object Capabilities.APIVersions returns incorrect results when running with helmfile in my cluster.

For demonstration purposes, I have the following test.yaml file, which prints the results from APIVersions using incubator/raw:

templates:
- |
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: test
    labels:
      test: |
        {{ .Capabilities.APIVersions }}

Here is a helmfile.yaml using this template:

repositories:
- name: incubator
  url: https://kubernetes-charts-incubator.storage.googleapis.com
  
releases:
- name: test
  namespace: monitoring
  chart: incubator/raw
  version: 0.2.3
  values:
  - test.yaml

When I run helm install test incubator/raw -f test.yaml --dry-run I get the correct list of API Versions available in my cluster. helmfile template outputs a different set of Versions with many entries missing.

helmfile version v0.94.1
# kubectl version (AWS EKS)
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:23:11Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.8-eks-b8860f", GitCommit:"b8860f6c40640897e52c143f1b9f011a503d6e46", GitTreeState:"clean", BuildDate:"2019-11-25T00:55:38Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
# helm version
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Upon further investigation, helm template seems to be the culprit.

The documentation of this command says:

Any values that would normally be looked up or retrieved in-cluster will be
faked locally. Additionally, none of the server-side testing of chart validity
(e.g. whether an API is supported) is done.

In my case, I was running helmfile apply, which (if I understand correctly) first executes helm diff to detect if there are any changes, which probably is based on helm template. In the chart I was installing, there is a check on the API Versions, and this check did not return the expected results, so no changes were detected by helmfile. If I run helmfile sync, the chart gets installed with the correctly rendered templates.

Any ideas how the user experience could be improved for this use case?

It turned out that the issue was actually our fault; another team member had set disableValidation: true in some releases in our helmfiles, but I was unaware of that. After replacing that configuration with the disableValidationOnInstall: true parameter you introduced in https://github.com/roboll/helmfile/issues/1600#issuecomment-772904291, the incorrect rendering went away. Even with using KubeVersion and without using HELM_DIFF_USE_UPGRADE_DRY_RUN. Thank you!