Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.11] Fix helm version check #5726

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions cmd/ctl/pkg/install/install.go
Expand Up @@ -29,6 +29,7 @@ import (
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/cli/values"
"helm.sh/helm/v3/pkg/getter"
Expand Down Expand Up @@ -191,12 +192,22 @@ func (o *InstallOptions) runInstall(ctx context.Context) (*release.Release, erro
}

// Dryrun template generation (used for rendering the CRDs in /templates)
o.client.DryRun = true // Do not apply install
o.client.ClientOnly = true // Do not validate against cluster (otherwise double CRDs can cause error)
o.client.DryRun = true // Do not apply install
o.client.ClientOnly = true // Do not validate against cluster (otherwise double CRDs can cause error)
// Kube version to be used in dry run template generation which does not
// talk to kube apiserver. This is to ensure that template generation
// does not fail because our Kubernetes minimum version requirement is
// higher than that hardcoded in Helm codebase for client-only runs
o.client.KubeVersion = &chartutil.KubeVersion{
Version: "v999.999.999",
Major: "999",
Minor: "999",
}
chartValues[installCRDsFlagName] = true // Make sure to render CRDs
dryRunResult, err := o.client.Run(chart, chartValues)
if err != nil {
return nil, err

}

if o.DryRun {
Expand Down Expand Up @@ -239,6 +250,7 @@ func (o *InstallOptions) runInstall(ctx context.Context) (*release.Release, erro
// Install chart
o.client.DryRun = false // Apply DryRun cli flags
o.client.ClientOnly = false // Perform install against cluster
o.client.KubeVersion = nil

o.client.Wait = o.Wait // Wait for resources to be ready
// If part of the install fails and the Atomic option is set to True,
Expand Down