github.com/argoproj/argo-cd/v2@v2.10.9/util/helm/helmver.go (about) 1 package helm 2 3 import ( 4 "os" 5 "path" 6 ) 7 8 var ( 9 // HelmV3 represents helm V3 specific settings 10 HelmV3 = HelmVer{ 11 binaryName: "helm", 12 templateNameArg: "--name-template", 13 kubeVersionSupported: true, 14 showCommand: "show", 15 pullCommand: "pull", 16 initSupported: false, 17 getPostTemplateCallback: cleanupChartLockFile, 18 includeCrds: true, 19 insecureSkipVerifySupported: true, 20 helmPassCredentialsSupported: true, 21 } 22 ) 23 24 // workaround for Helm3 bug. Remove after https://github.com/helm/helm/issues/6870 is fixed. 25 // The `helm template` command generates Chart.lock after which `helm dependency build` does not work 26 // As workaround removing lock file unless it exists before running helm template 27 func cleanupChartLockFile(chartPath string) (func(), error) { 28 exists := true 29 lockPath := path.Join(chartPath, "Chart.lock") 30 if _, err := os.Stat(lockPath); err != nil { 31 if os.IsNotExist(err) { 32 exists = false 33 } else { 34 return nil, err 35 } 36 } 37 return func() { 38 if !exists { 39 _ = os.Remove(lockPath) 40 } 41 }, nil 42 } 43 44 // HelmVer contains Helm version specific settings such as helm binary and command names 45 type HelmVer struct { 46 binaryName string 47 initSupported bool 48 templateNameArg string 49 showCommand string 50 pullCommand string 51 kubeVersionSupported bool 52 getPostTemplateCallback func(chartPath string) (func(), error) 53 includeCrds bool 54 insecureSkipVerifySupported bool 55 helmPassCredentialsSupported bool 56 }