f.VarP(&inst.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.StringVarP(&inst.name,"name","","","release name. If unspecified, it will autogenerate one for you")
f.BoolVar(&inst.dryRun,"dry-run",false,"simulate an install")
f.BoolVar(&inst.disableHooks,"no-hooks",false,"prevent hooks from running during install")
f.BoolVar(&inst.replace,"replace",false,"re-use the given name, even if that name is already used. This is unsafe in production")
f.StringArrayVar(&inst.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&inst.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringVar(&inst.nameTemplate,"name-template","","specify template used to name the release")
f.BoolVar(&inst.verify,"verify",false,"verify the package before installing it")
f.StringVar(&inst.keyring,"keyring",defaultKeyring(),"location of public keys used for verification")
f.StringVar(&inst.version,"version","","specify the exact chart version to install. If this is not specified, the latest version is installed")
f.Int64Var(&inst.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&inst.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
f.StringVar(&inst.repoURL,"repo","","chart repository url where to locate the requested chart")
f.StringVar(&inst.username,"username","","chart repository username where to locate the requested chart")
f.StringVar(&inst.password,"password","","chart repository password where to locate the requested chart")
f.StringVar(&inst.certFile,"cert-file","","identify HTTPS client using this SSL certificate file")
f.StringVar(&inst.keyFile,"key-file","","identify HTTPS client using this SSL key file")
f.StringVar(&inst.caFile,"ca-file","","verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&inst.devel,"devel",false,"use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&inst.depUp,"dep-up",false,"run helm dependency update before installing the chart")
f.VarP(&o.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.StringVarP(&o.name,"name","","","release name. If unspecified, it will autogenerate one for you")
f.BoolVar(&o.dryRun,"dry-run",false,"simulate an install")
f.BoolVar(&o.disableHooks,"no-hooks",false,"prevent hooks from running during install")
f.BoolVar(&o.replace,"replace",false,"re-use the given name, even if that name is already used. This is unsafe in production")
f.StringArrayVar(&o.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&o.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringVar(&o.nameTemplate,"name-template","","specify template used to name the release")
f.BoolVar(&o.verify,"verify",false,"verify the package before installing it")
f.StringVar(&o.keyring,"keyring",defaultKeyring(),"location of public keys used for verification")
f.StringVar(&o.version,"version","","specify the exact chart version to install. If this is not specified, the latest version is installed")
f.Int64Var(&o.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&o.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
f.StringVar(&o.repoURL,"repo","","chart repository url where to locate the requested chart")
f.StringVar(&o.username,"username","","chart repository username where to locate the requested chart")
f.StringVar(&o.password,"password","","chart repository password where to locate the requested chart")
f.StringVar(&o.certFile,"cert-file","","identify HTTPS client using this SSL certificate file")
f.StringVar(&o.keyFile,"key-file","","identify HTTPS client using this SSL key file")
f.StringVar(&o.caFile,"ca-file","","verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&o.devel,"devel",false,"use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&o.depUp,"dep-up",false,"run helm dependency update before installing the chart")
@ -43,60 +43,57 @@ it will emit [ERROR] messages. If it encounters issues that break with conventio
orrecommendation,itwillemit[WARNING]messages.
`
typelintCmdstruct{
typelintOptionsstruct{
valueFilesvalueFiles
values[]string
sValues[]string
strictbool
paths[]string
outio.Writer
}
funcnewLintCmd(outio.Writer)*cobra.Command{
l:=&lintCmd{
paths:[]string{"."},
out:out,
}
o:=&lintOptions{paths:[]string{"."}}
cmd:=&cobra.Command{
Use:"lint [flags] PATH",
Short:"examines a chart for possible issues",
Long:longLintHelp,
RunE:func(cmd*cobra.Command,args[]string)error{
iflen(args)>0{
l.paths=args
o.paths=args
}
returnl.run()
returno.run(out)
},
}
cmd.Flags().VarP(&l.valueFiles,"values","f","specify values in a YAML file (can specify multiple)")
cmd.Flags().StringArrayVar(&l.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
cmd.Flags().StringArrayVar(&l.sValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
cmd.Flags().BoolVar(&l.strict,"strict",false,"fail on lint warnings")
cmd.Flags().VarP(&o.valueFiles,"values","f","specify values in a YAML file (can specify multiple)")
cmd.Flags().StringArrayVar(&o.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
cmd.Flags().StringArrayVar(&o.sValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
cmd.Flags().BoolVar(&o.strict,"strict",false,"fail on lint warnings")
returncmd
}
varerrLintNoChart=errors.New("No chart found for linting (missing Chart.yaml)")
f.VarP(&pkg.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.StringArrayVar(&pkg.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&pkg.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.BoolVar(&pkg.sign,"sign",false,"use a PGP private key to sign this package")
f.StringVar(&pkg.key,"key","","name of the key to use when signing. Used if --sign is true")
f.StringVar(&pkg.keyring,"keyring",defaultKeyring(),"location of a public keyring")
f.StringVar(&pkg.version,"version","","set the version on the chart to this semver version")
f.StringVar(&pkg.appVersion,"app-version","","set the appVersion on the chart to this version")
f.StringVarP(&pkg.destination,"destination","d",".","location to write the chart.")
f.BoolVarP(&pkg.dependencyUpdate,"dependency-update","u",false,`update dependencies from "requirements.yaml" to dir "charts/" before packaging`)
f.VarP(&o.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.StringArrayVar(&o.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&o.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.BoolVar(&o.sign,"sign",false,"use a PGP private key to sign this package")
f.StringVar(&o.key,"key","","name of the key to use when signing. Used if --sign is true")
f.StringVar(&o.keyring,"keyring",defaultKeyring(),"location of a public keyring")
f.StringVar(&o.version,"version","","set the version on the chart to this semver version")
f.StringVar(&o.appVersion,"app-version","","set the appVersion on the chart to this version")
f.StringVarP(&o.destination,"destination","d",".","location to write the chart.")
f.BoolVarP(&o.dependencyUpdate,"dependency-update","u",false,`update dependencies from "requirements.yaml" to dir "charts/" before packaging`)
f.BoolVar(&rollback.dryRun,"dry-run",false,"simulate a rollback")
f.BoolVar(&rollback.recreate,"recreate-pods",false,"performs pods restart for the resource if applicable")
f.BoolVar(&rollback.force,"force",false,"force resource update through delete/recreate if needed")
f.BoolVar(&rollback.disableHooks,"no-hooks",false,"prevent hooks from running during rollback")
f.Int64Var(&rollback.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&rollback.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
f.BoolVar(&o.dryRun,"dry-run",false,"simulate a rollback")
f.BoolVar(&o.recreate,"recreate-pods",false,"performs pods restart for the resource if applicable")
f.BoolVar(&o.force,"force",false,"force resource update through delete/recreate if needed")
f.BoolVar(&o.disableHooks,"no-hooks",false,"prevent hooks from running during rollback")
f.Int64Var(&o.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&o.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
returncmd
}
func(r *rollbackCmd)run()error{
_,err:=r.client.RollbackRelease(
r.name,
helm.RollbackDryRun(r.dryRun),
helm.RollbackRecreate(r.recreate),
helm.RollbackForce(r.force),
helm.RollbackDisableHooks(r.disableHooks),
helm.RollbackVersion(r.revision),
helm.RollbackTimeout(r.timeout),
helm.RollbackWait(r.wait))
func(o *rollbackOptions)run(outio.Writer)error{
_,err:=o.client.RollbackRelease(
o.name,
helm.RollbackDryRun(o.dryRun),
helm.RollbackRecreate(o.recreate),
helm.RollbackForce(o.force),
helm.RollbackDisableHooks(o.disableHooks),
helm.RollbackVersion(o.revision),
helm.RollbackTimeout(o.timeout),
helm.RollbackWait(o.wait))
iferr!=nil{
returnerr
}
fmt.Fprintf(r.out,"Rollback was a success! Happy Helming!\n")
fmt.Fprintf(out,"Rollback was a success! Happy Helming!\n")
f.StringArrayVarP(&t.renderFiles,"execute","x",[]string{},"only execute the given templates")
f.VarP(&t.valueFiles,"values","f","specify values in a YAML file (can specify multiple)")
f.StringArrayVar(&t.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&t.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringVar(&t.nameTemplate,"name-template","","specify template used to name the release")
f.StringVar(&t.kubeVersion,"kube-version",defaultKubeVersion,"kubernetes version used as Capabilities.KubeVersion.Major/Minor")
f.StringVar(&t.outputDir,"output-dir","","writes the executed templates to files in output-dir instead of stdout")
f.StringArrayVarP(&o.renderFiles,"execute","x",[]string{},"only execute the given templates")
f.VarP(&o.valueFiles,"values","f","specify values in a YAML file (can specify multiple)")
f.StringArrayVar(&o.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&o.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringVar(&o.nameTemplate,"name-template","","specify template used to name the release")
f.StringVar(&o.kubeVersion,"kube-version",defaultKubeVersion,"kubernetes version used as Capabilities.KubeVersion.Major/Minor")
f.StringVar(&o.outputDir,"output-dir","","writes the executed templates to files in output-dir instead of stdout")
returncmd
}
func(o*templateOptions)run(outio.Writer)error{
// verify specified templates exist relative to chart
rf:=[]string{}
varafstring
varerrerror
iflen(t.renderFiles)>0{
for_,f:=ranget.renderFiles{
iflen(o.renderFiles)>0{
for_,f:=rangeo.renderFiles{
if!filepath.IsAbs(f){
af,err=filepath.Abs(filepath.Join(t.chartPath,f))
af,err=filepath.Abs(filepath.Join(o.chartPath,f))
iferr!=nil{
returnfmt.Errorf("could not resolve template path: %s",err)
f.VarP(&upgrade.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.BoolVar(&upgrade.dryRun,"dry-run",false,"simulate an upgrade")
f.BoolVar(&upgrade.recreate,"recreate-pods",false,"performs pods restart for the resource if applicable")
f.BoolVar(&upgrade.force,"force",false,"force resource update through delete/recreate if needed")
f.StringArrayVar(&upgrade.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&upgrade.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.BoolVar(&upgrade.disableHooks,"disable-hooks",false,"disable pre/post upgrade hooks. DEPRECATED. Use no-hooks")
f.BoolVar(&upgrade.verify,"verify",false,"verify the provenance of the chart before upgrading")
f.StringVar(&upgrade.keyring,"keyring",defaultKeyring(),"path to the keyring that contains public signing keys")
f.BoolVarP(&upgrade.install,"install","i",false,"if a release by this name doesn't already exist, run an install")
f.StringVar(&upgrade.version,"version","","specify the exact chart version to use. If this is not specified, the latest version is used")
f.Int64Var(&upgrade.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&upgrade.resetValues,"reset-values",false,"when upgrading, reset the values to the ones built into the chart")
f.BoolVar(&upgrade.reuseValues,"reuse-values",false,"when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.")
f.BoolVar(&upgrade.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
f.StringVar(&upgrade.repoURL,"repo","","chart repository url where to locate the requested chart")
f.StringVar(&upgrade.username,"username","","chart repository username where to locate the requested chart")
f.StringVar(&upgrade.password,"password","","chart repository password where to locate the requested chart")
f.StringVar(&upgrade.certFile,"cert-file","","identify HTTPS client using this SSL certificate file")
f.StringVar(&upgrade.keyFile,"key-file","","identify HTTPS client using this SSL key file")
f.StringVar(&upgrade.caFile,"ca-file","","verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&upgrade.devel,"devel",false,"use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.VarP(&o.valueFiles,"values","f","specify values in a YAML file or a URL(can specify multiple)")
f.BoolVar(&o.dryRun,"dry-run",false,"simulate an upgrade")
f.BoolVar(&o.recreate,"recreate-pods",false,"performs pods restart for the resource if applicable")
f.BoolVar(&o.force,"force",false,"force resource update through delete/recreate if needed")
f.StringArrayVar(&o.values,"set",[]string{},"set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&o.stringValues,"set-string",[]string{},"set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.BoolVar(&o.disableHooks,"disable-hooks",false,"disable pre/post upgrade hooks. DEPRECATED. Use no-hooks")
f.BoolVar(&o.verify,"verify",false,"verify the provenance of the chart before upgrading")
f.StringVar(&o.keyring,"keyring",defaultKeyring(),"path to the keyring that contains public signing keys")
f.BoolVarP(&o.install,"install","i",false,"if a release by this name doesn't already exist, run an install")
f.StringVar(&o.version,"version","","specify the exact chart version to use. If this is not specified, the latest version is used")
f.Int64Var(&o.timeout,"timeout",300,"time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&o.resetValues,"reset-values",false,"when upgrading, reset the values to the ones built into the chart")
f.BoolVar(&o.reuseValues,"reuse-values",false,"when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.")
f.BoolVar(&o.wait,"wait",false,"if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout")
f.StringVar(&o.repoURL,"repo","","chart repository url where to locate the requested chart")
f.StringVar(&o.username,"username","","chart repository username where to locate the requested chart")
f.StringVar(&o.password,"password","","chart repository password where to locate the requested chart")
f.StringVar(&o.certFile,"cert-file","","identify HTTPS client using this SSL certificate file")
f.StringVar(&o.keyFile,"key-file","","identify HTTPS client using this SSL key file")
f.StringVar(&o.caFile,"ca-file","","verify certificates of HTTPS-enabled servers using this CA bundle")
f.BoolVar(&o.devel,"devel",false,"use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")