ref(action): move AddFlags functions back to cmd

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
pull/5365/head
Matthew Fisher 6 years ago
parent 2b775d693d
commit f185103b60
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -17,10 +17,12 @@ package main
import ( import (
"io" "io"
"os"
"path/filepath" "path/filepath"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/client-go/util/homedir"
"k8s.io/helm/cmd/helm/require" "k8s.io/helm/cmd/helm/require"
"k8s.io/helm/pkg/action" "k8s.io/helm/pkg/action"
"k8s.io/helm/pkg/downloader" "k8s.io/helm/pkg/downloader"
@ -68,7 +70,17 @@ func newDependencyBuildCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddBuildFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures")
f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
return cmd return cmd
} }
// defaultKeyring returns the expanded path to the default keyring.
func defaultKeyring() string {
if v, ok := os.LookupEnv("GNUPGHOME"); ok {
return filepath.Join(v, "pubring.gpg")
}
return filepath.Join(homedir.HomeDir(), ".gnupg", "pubring.gpg")
}

@ -75,7 +75,10 @@ func newDependencyUpdateCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddUpdateFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures")
f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
f.BoolVar(&client.SkipRefresh, "skip-refresh", false, "do not refresh the local repository cache")
return cmd return cmd
} }

@ -55,7 +55,7 @@ func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) cmd.Flags().IntVar(&client.Version, "revision", 0, "get the named release with revision")
cmd.AddCommand(newGetValuesCmd(cfg, out)) cmd.AddCommand(newGetValuesCmd(cfg, out))
cmd.AddCommand(newGetManifestCmd(cfg, out)) cmd.AddCommand(newGetManifestCmd(cfg, out))

@ -52,7 +52,7 @@ func newGetHooksCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) cmd.Flags().IntVar(&client.Version, "revision", 0, "get the named release with revision")
return cmd return cmd
} }

@ -52,7 +52,7 @@ func newGetManifestCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
}, },
} }
client.AddFlags(cmd.Flags()) cmd.Flags().IntVar(&client.Version, "revision", 0, "get the named release with revision")
return cmd return cmd
} }

@ -48,6 +48,8 @@ func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.IntVar(&client.Version, "revision", 0, "get the named release with revision")
f.BoolVarP(&client.AllValues, "all", "a", false, "dump all (computed) values")
return cmd return cmd
} }

@ -61,7 +61,9 @@ func newHistoryCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.StringVarP(&client.OutputFormat, "output", "o", action.Table.String(), "prints the output in the specified format (json|table|yaml)")
f.IntVar(&client.Max, "max", 256, "maximum number of revision to include in history")
return cmd return cmd
} }

@ -22,6 +22,7 @@ import (
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/helm/cmd/helm/require" "k8s.io/helm/cmd/helm/require"
"k8s.io/helm/pkg/action" "k8s.io/helm/pkg/action"
@ -111,11 +112,43 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) addInstallFlags(cmd.Flags(), client)
return cmd return cmd
} }
func addInstallFlags(f *pflag.FlagSet, client *action.Install) {
f.BoolVar(&client.DryRun, "dry-run", false, "simulate an install")
f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during install")
f.BoolVar(&client.Replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production")
f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&client.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.BoolVarP(&client.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)")
f.StringVar(&client.NameTemplate, "name-template", "", "specify template used to name the release")
f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&client.DependencyUpdate, "dependency-update", false, "run helm dependency update before installing the chart")
addValueOptionsFlags(f, &client.ValueOptions)
addChartPathOptionsFlags(f, &client.ChartPathOptions)
}
func addValueOptionsFlags(f *pflag.FlagSet, v *action.ValueOptions) {
f.StringSliceVarP(&v.ValueFiles, "values", "f", []string{}, "specify values in a YAML file or a URL(can specify multiple)")
f.StringArrayVar(&v.Values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&v.StringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
}
func addChartPathOptionsFlags(f *pflag.FlagSet, c *action.ChartPathOptions) {
f.StringVar(&c.Version, "version", "", "specify the exact chart version to install. If this is not specified, the latest version is installed")
f.BoolVar(&c.Verify, "verify", false, "verify the package before installing it")
f.StringVar(&c.Keyring, "keyring", defaultKeyring(), "location of public keys used for verification")
f.StringVar(&c.RepoURL, "repo", "", "chart repository url where to locate the requested chart")
f.StringVar(&c.Username, "username", "", "chart repository username where to locate the requested chart")
f.StringVar(&c.Password, "password", "", "chart repository password where to locate the requested chart")
f.StringVar(&c.CertFile, "cert-file", "", "identify HTTPS client using this SSL certificate file")
f.StringVar(&c.KeyFile, "key-file", "", "identify HTTPS client using this SSL key file")
f.StringVar(&c.CaFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
}
func runInstall(args []string, client *action.Install, out io.Writer) (*release.Release, error) { func runInstall(args []string, client *action.Install, out io.Writer) (*release.Release, error) {
debug("Original chart version: %q", client.Version) debug("Original chart version: %q", client.Version)
if client.Version == "" && client.Devel { if client.Version == "" && client.Devel {

@ -70,7 +70,9 @@ func newLintCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.Strict, "strict", false, "fail on lint warnings")
addValueOptionsFlags(f, &client.ValueOptions)
return cmd return cmd
} }

@ -83,7 +83,21 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVarP(&client.Short, "short", "q", false, "output short (quiet) listing format")
f.BoolVarP(&client.ByDate, "date", "d", false, "sort by release date")
f.BoolVarP(&client.SortDesc, "reverse", "r", false, "reverse the sort order")
f.BoolVarP(&client.All, "all", "a", false, "show all releases, not just the ones marked deployed")
f.BoolVar(&client.Uninstalled, "uninstalled", false, "show uninstalled releases")
f.BoolVar(&client.Superseded, "superseded", false, "show superseded releases")
f.BoolVar(&client.Uninstalling, "uninstalling", false, "show releases that are currently being uninstalled")
f.BoolVar(&client.Deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled")
f.BoolVar(&client.Failed, "failed", false, "show failed releases")
f.BoolVar(&client.Pending, "pending", false, "show pending releases")
f.BoolVar(&client.AllNamespaces, "all-namespaces", false, "list releases across all namespaces")
f.IntVarP(&client.Limit, "max", "m", 256, "maximum number of releases to fetch")
f.IntVarP(&client.Offset, "offset", "o", 0, "next release name in the list, used to offset from start value")
f.StringVarP(&client.Filter, "filter", "f", "", "a regular expression (Perl compatible). Any releases that match the expression will be included in the results")
return cmd return cmd
} }

@ -95,7 +95,15 @@ func newPackageCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.Sign, "sign", false, "use a PGP private key to sign this package")
f.StringVar(&client.Key, "key", "", "name of the key to use when signing. Used if --sign is true")
f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "location of a public keyring")
f.StringVar(&client.Version, "version", "", "set the version on the chart to this semver version")
f.StringVar(&client.AppVersion, "app-version", "", "set the appVersion on the chart to this version")
f.StringVarP(&client.Destination, "destination", "d", ".", "location to write the chart.")
f.BoolVarP(&client.DependencyUpdate, "dependency-update", "u", false, `update dependencies from "Chart.yaml" to dir "charts/" before packaging`)
addValueOptionsFlags(f, &client.ValueOptions)
return cmd return cmd
} }

@ -68,7 +68,13 @@ func newPullCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&client.Untar, "untar", false, "if set to true, will untar the chart after downloading it")
f.BoolVar(&client.VerifyLater, "prov", false, "fetch the provenance file, but don't perform verification")
f.StringVar(&client.UntarDir, "untardir", ".", "if untar is specified, this flag specifies the name of the directory into which the chart is expanded")
f.StringVarP(&client.DestDir, "destination", "d", ".", "location to write the chart. If this and tardir are specified, tardir is appended to this")
addChartPathOptionsFlags(f, &client.ChartPathOptions)
return cmd return cmd
} }

@ -68,7 +68,9 @@ func newReleaseTestCmd(cfg *action.Configuration, out io.Writer) *cobra.Command
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&client.Cleanup, "cleanup", false, "delete test pods upon completion")
return cmd return cmd
} }

@ -54,7 +54,14 @@ func newRollbackCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.IntVarP(&client.Version, "version", "v", 0, "revision number to rollback to (default: rollback to previous release)")
f.BoolVar(&client.DryRun, "dry-run", false, "simulate a rollback")
f.BoolVar(&client.Recreate, "recreate-pods", false, "performs pods restart for the resource if applicable")
f.BoolVar(&client.Force, "force", false, "force resource update through delete/recreate if needed")
f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during rollback")
f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&client.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")
return cmd return cmd
} }

@ -133,7 +133,7 @@ func newShowCmd(out io.Writer) *cobra.Command {
cmds := []*cobra.Command{showCommand, readmeSubCmd, valuesSubCmd, chartSubCmd} cmds := []*cobra.Command{showCommand, readmeSubCmd, valuesSubCmd, chartSubCmd}
for _, subCmd := range cmds { for _, subCmd := range cmds {
client.AddFlags(subCmd.Flags()) addChartPathOptionsFlags(subCmd.Flags(), &client.ChartPathOptions)
} }
for _, subCmd := range cmds[1:] { for _, subCmd := range cmds[1:] {

@ -83,7 +83,9 @@ func newStatusCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.PersistentFlags()) f := cmd.PersistentFlags()
f.IntVar(&client.Version, "revision", 0, "if set, display the status of the named release with revision")
f.StringVarP(&client.OutputFormat, "output", "o", "", "output the status in the specified format (json or yaml)")
return cmd return cmd
} }

@ -76,7 +76,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) addInstallFlags(cmd.Flags(), client)
return cmd return cmd
} }

@ -61,7 +61,11 @@ func newUninstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVar(&client.DryRun, "dry-run", false, "simulate a uninstall")
f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during uninstallation")
f.BoolVar(&client.Purge, "purge", false, "remove the release from the store and make its name free for later use")
f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
return cmd return cmd
} }

@ -135,7 +135,20 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) f := cmd.Flags()
f.BoolVarP(&client.Install, "install", "i", false, "if a release by this name doesn't already exist, run an install")
f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&client.DryRun, "dry-run", false, "simulate an upgrade")
f.BoolVar(&client.Recreate, "recreate-pods", false, "performs pods restart for the resource if applicable")
f.BoolVar(&client.Force, "force", false, "force resource update through delete/recreate if needed")
f.BoolVar(&client.DisableHooks, "no-hooks", false, "disable pre/post upgrade hooks")
f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&client.ResetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart")
f.BoolVar(&client.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(&client.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.IntVar(&client.MaxHistory, "history-max", 0, "limit the maximum number of revisions saved per release. Use 0 for no limit.")
addChartPathOptionsFlags(f, &client.ChartPathOptions)
addValueOptionsFlags(f, &client.ValueOptions)
return cmd return cmd
} }

@ -48,7 +48,7 @@ func newVerifyCmd(out io.Writer) *cobra.Command {
}, },
} }
client.AddFlags(cmd.Flags()) cmd.Flags().StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
return cmd return cmd
} }

@ -24,7 +24,6 @@ import (
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chart/loader" "k8s.io/helm/pkg/chart/loader"
@ -44,16 +43,6 @@ func NewDependency() *Dependency {
return &Dependency{} return &Dependency{}
} }
func (d *Dependency) AddBuildFlags(f *pflag.FlagSet) {
f.BoolVar(&d.Verify, "verify", false, "verify the packages against signatures")
f.StringVar(&d.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
}
func (d *Dependency) AddUpdateFlags(f *pflag.FlagSet) {
d.AddBuildFlags(f)
f.BoolVar(&d.SkipRefresh, "skip-refresh", false, "do not refresh the local repository cache")
}
// List executes 'helm dependency list'. // List executes 'helm dependency list'.
func (d *Dependency) List(chartpath string, out io.Writer) error { func (d *Dependency) List(chartpath string, out io.Writer) error {
c, err := loader.Load(chartpath) c, err := loader.Load(chartpath)

@ -17,8 +17,6 @@ limitations under the License.
package action package action
import ( import (
"github.com/spf13/pflag"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
) )
@ -42,7 +40,3 @@ func NewGet(cfg *Configuration) *Get {
func (g *Get) Run(name string) (*release.Release, error) { func (g *Get) Run(name string) (*release.Release, error) {
return g.cfg.releaseContent(name, g.Version) return g.cfg.releaseContent(name, g.Version)
} }
func (g *Get) AddFlags(f *pflag.FlagSet) {
f.IntVar(&g.Version, "revision", 0, "get the named release with revision")
}

@ -18,7 +18,6 @@ package action
import ( import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
) )
@ -67,8 +66,3 @@ func (g *GetValues) Run(name string) (string, error) {
return string(resConfig), nil return string(resConfig), nil
} }
func (g *GetValues) AddFlags(f *pflag.FlagSet) {
f.IntVar(&g.Version, "revision", 0, "get the named release with revision")
f.BoolVarP(&g.AllValues, "all", "a", false, "dump all (computed) values")
}

@ -23,7 +23,6 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
@ -136,11 +135,6 @@ func (h *History) Run(name string) (string, error) {
return string(history), nil return string(history), nil
} }
func (h *History) AddFlags(f *pflag.FlagSet) {
f.StringVarP(&h.OutputFormat, "output", "o", Table.String(), "prints the output in the specified format (json|table|yaml)")
f.IntVar(&h.Max, "max", 256, "maximum number of revision to include in history")
}
func getReleaseHistory(rls []*release.Release) (history releaseHistory) { func getReleaseHistory(rls []*release.Release) (history releaseHistory) {
for i := len(rls) - 1; i >= 0; i-- { for i := len(rls) - 1; i >= 0; i-- {
r := rls[i] r := rls[i]

@ -33,8 +33,6 @@ import (
"github.com/Masterminds/sprig" "github.com/Masterminds/sprig"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/client-go/util/homedir"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
@ -487,46 +485,6 @@ func (i *Install) NameAndChart(args []string) (string, string, error) {
return fmt.Sprintf("%s-%d", base, time.Now().Unix()), args[0], nil return fmt.Sprintf("%s-%d", base, time.Now().Unix()), args[0], nil
} }
func (i *Install) AddFlags(f *pflag.FlagSet) {
f.BoolVar(&i.DryRun, "dry-run", false, "simulate an install")
f.BoolVar(&i.DisableHooks, "no-hooks", false, "prevent hooks from running during install")
f.BoolVar(&i.Replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production")
f.Int64Var(&i.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&i.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.BoolVarP(&i.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)")
f.StringVar(&i.NameTemplate, "name-template", "", "specify template used to name the release")
f.BoolVar(&i.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&i.DependencyUpdate, "dependency-update", false, "run helm dependency update before installing the chart")
i.ValueOptions.AddFlags(f)
i.ChartPathOptions.AddFlags(f)
}
func (v *ValueOptions) AddFlags(f *pflag.FlagSet) {
f.StringSliceVarP(&v.ValueFiles, "values", "f", []string{}, "specify values in a YAML file or a URL(can specify multiple)")
f.StringArrayVar(&v.Values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.StringArrayVar(&v.StringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
}
func (c *ChartPathOptions) AddFlags(f *pflag.FlagSet) {
f.StringVar(&c.Version, "version", "", "specify the exact chart version to install. If this is not specified, the latest version is installed")
f.BoolVar(&c.Verify, "verify", false, "verify the package before installing it")
f.StringVar(&c.Keyring, "keyring", defaultKeyring(), "location of public keys used for verification")
f.StringVar(&c.RepoURL, "repo", "", "chart repository url where to locate the requested chart")
f.StringVar(&c.Username, "username", "", "chart repository username where to locate the requested chart")
f.StringVar(&c.Password, "password", "", "chart repository password where to locate the requested chart")
f.StringVar(&c.CertFile, "cert-file", "", "identify HTTPS client using this SSL certificate file")
f.StringVar(&c.KeyFile, "key-file", "", "identify HTTPS client using this SSL key file")
f.StringVar(&c.CaFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
}
// defaultKeyring returns the expanded path to the default keyring.
func defaultKeyring() string {
if v, ok := os.LookupEnv("GNUPGHOME"); ok {
return filepath.Join(v, "pubring.gpg")
}
return filepath.Join(homedir.HomeDir(), ".gnupg", "pubring.gpg")
}
func TemplateName(nameTemplate string) (string, error) { func TemplateName(nameTemplate string) (string, error) {
if nameTemplate == "" { if nameTemplate == "" {
return "", nil return "", nil

@ -23,7 +23,6 @@ import (
"strings" "strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/lint" "k8s.io/helm/pkg/lint"
@ -115,8 +114,3 @@ func lintChart(path string, vals map[string]interface{}, namespace string, stric
return lint.All(chartPath, vals, namespace, strict), nil return lint.All(chartPath, vals, namespace, strict), nil
} }
func (l *Lint) AddFlags(f *pflag.FlagSet) {
f.BoolVar(&l.Strict, "strict", false, "fail on lint warnings")
l.ValueOptions.AddFlags(f)
}

@ -21,7 +21,6 @@ import (
"regexp" "regexp"
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
"k8s.io/helm/pkg/releaseutil" "k8s.io/helm/pkg/releaseutil"
@ -138,23 +137,6 @@ func NewList(cfg *Configuration) *List {
} }
} }
func (l *List) AddFlags(f *pflag.FlagSet) {
f.BoolVarP(&l.Short, "short", "q", false, "output short (quiet) listing format")
f.BoolVarP(&l.ByDate, "date", "d", false, "sort by release date")
f.BoolVarP(&l.SortDesc, "reverse", "r", false, "reverse the sort order")
f.BoolVarP(&l.All, "all", "a", false, "show all releases, not just the ones marked deployed")
f.BoolVar(&l.Uninstalled, "uninstalled", false, "show uninstalled releases")
f.BoolVar(&l.Superseded, "superseded", false, "show superseded releases")
f.BoolVar(&l.Uninstalling, "uninstalling", false, "show releases that are currently being uninstalled")
f.BoolVar(&l.Deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled")
f.BoolVar(&l.Failed, "failed", false, "show failed releases")
f.BoolVar(&l.Pending, "pending", false, "show pending releases")
f.BoolVar(&l.AllNamespaces, "all-namespaces", false, "list releases across all namespaces")
f.IntVarP(&l.Limit, "max", "m", 256, "maximum number of releases to fetch")
f.IntVarP(&l.Offset, "offset", "o", 0, "next release name in the list, used to offset from start value")
f.StringVarP(&l.Filter, "filter", "f", "", "a regular expression (Perl compatible). Any releases that match the expression will be included in the results")
}
func (l *List) SetConfiguration(cfg *Configuration) { func (l *List) SetConfiguration(cfg *Configuration) {
l.cfg = cfg l.cfg = cfg
} }

@ -24,7 +24,6 @@ import (
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
@ -112,17 +111,6 @@ func (p *Package) Run(path string) (string, error) {
return "", err return "", err
} }
func (p *Package) AddFlags(f *pflag.FlagSet) {
f.BoolVar(&p.Sign, "sign", false, "use a PGP private key to sign this package")
f.StringVar(&p.Key, "key", "", "name of the key to use when signing. Used if --sign is true")
f.StringVar(&p.Keyring, "keyring", defaultKeyring(), "location of a public keyring")
f.StringVar(&p.Version, "version", "", "set the version on the chart to this semver version")
f.StringVar(&p.AppVersion, "app-version", "", "set the appVersion on the chart to this version")
f.StringVarP(&p.Destination, "destination", "d", ".", "location to write the chart.")
f.BoolVarP(&p.DependencyUpdate, "dependency-update", "u", false, `update dependencies from "Chart.yaml" to dir "charts/" before packaging`)
p.ValueOptions.AddFlags(f)
}
func setVersion(ch *chart.Chart, ver string) error { func setVersion(ch *chart.Chart, ver string) error {
// Verify that version is a Version, and error out if it is not. // Verify that version is a Version, and error out if it is not.
if _, err := semver.NewVersion(ver); err != nil { if _, err := semver.NewVersion(ver); err != nil {

@ -24,7 +24,6 @@ import (
"strings" "strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/cli" "k8s.io/helm/pkg/cli"
@ -121,12 +120,3 @@ func (p *Pull) Run(chartRef string) (string, error) {
} }
return out.String(), nil return out.String(), nil
} }
func (p *Pull) AddFlags(f *pflag.FlagSet) {
f.BoolVar(&p.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&p.Untar, "untar", false, "if set to true, will untar the chart after downloading it")
f.BoolVar(&p.VerifyLater, "prov", false, "fetch the provenance file, but don't perform verification")
f.StringVar(&p.UntarDir, "untardir", ".", "if untar is specified, this flag specifies the name of the directory into which the chart is expanded")
f.StringVarP(&p.DestDir, "destination", "d", ".", "location to write the chart. If this and tardir are specified, tardir is appended to this")
p.ChartPathOptions.AddFlags(f)
}

@ -18,7 +18,6 @@ package action
import ( import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
reltesting "k8s.io/helm/pkg/releasetesting" reltesting "k8s.io/helm/pkg/releasetesting"
@ -41,11 +40,6 @@ func NewReleaseTesting(cfg *Configuration) *ReleaseTesting {
} }
} }
func (r *ReleaseTesting) AddFlags(f *pflag.FlagSet) {
f.Int64Var(&r.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&r.Cleanup, "cleanup", false, "delete test pods upon completion")
}
// Run executes 'helm test' against the given release. // Run executes 'helm test' against the given release.
func (r *ReleaseTesting) Run(name string) (<-chan *release.TestReleaseResponse, <-chan error) { func (r *ReleaseTesting) Run(name string) (<-chan *release.TestReleaseResponse, <-chan error) {
errc := make(chan error, 1) errc := make(chan error, 1)

@ -23,7 +23,6 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/hooks"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
@ -51,16 +50,6 @@ func NewRollback(cfg *Configuration) *Rollback {
} }
} }
func (r *Rollback) AddFlags(f *pflag.FlagSet) {
f.IntVarP(&r.Version, "version", "v", 0, "revision number to rollback to (default: rollback to previous release)")
f.BoolVar(&r.DryRun, "dry-run", false, "simulate a rollback")
f.BoolVar(&r.Recreate, "recreate-pods", false, "performs pods restart for the resource if applicable")
f.BoolVar(&r.Force, "force", false, "force resource update through delete/recreate if needed")
f.BoolVar(&r.DisableHooks, "no-hooks", false, "prevent hooks from running during rollback")
f.Int64Var(&r.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&r.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")
}
// Run executes 'helm rollback' against the given release. // Run executes 'helm rollback' against the given release.
func (r *Rollback) Run(name string) (*release.Release, error) { func (r *Rollback) Run(name string) (*release.Release, error) {
r.cfg.Log("preparing rollback of %s", name) r.cfg.Log("preparing rollback of %s", name)

@ -21,7 +21,6 @@ import (
"strings" "strings"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
"k8s.io/helm/pkg/chart/loader" "k8s.io/helm/pkg/chart/loader"
@ -73,10 +72,6 @@ func NewShow(output ShowOutputFormat) *Show {
} }
} }
func (s *Show) AddFlags(f *pflag.FlagSet) {
s.ChartPathOptions.AddFlags(f)
}
// Run executes 'helm show' against the given release. // Run executes 'helm show' against the given release.
func (s *Show) Run(chartpath string) (string, error) { func (s *Show) Run(chartpath string) (string, error) {
var out strings.Builder var out strings.Builder

@ -17,8 +17,6 @@ limitations under the License.
package action package action
import ( import (
"github.com/spf13/pflag"
"k8s.io/helm/pkg/release" "k8s.io/helm/pkg/release"
) )
@ -39,11 +37,6 @@ func NewStatus(cfg *Configuration) *Status {
} }
} }
func (s *Status) AddFlags(f *pflag.FlagSet) {
f.IntVar(&s.Version, "revision", 0, "if set, display the status of the named release with revision")
f.StringVarP(&s.OutputFormat, "output", "o", "", "output the status in the specified format (json or yaml)")
}
// Run executes 'helm status' against the given release. // Run executes 'helm status' against the given release.
func (s *Status) Run(name string) (*release.Release, error) { func (s *Status) Run(name string) (*release.Release, error) {
return s.cfg.releaseContent(name, s.Version) return s.cfg.releaseContent(name, s.Version)

@ -23,7 +23,6 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/hooks"
"k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/kube"
@ -50,13 +49,6 @@ func NewUninstall(cfg *Configuration) *Uninstall {
} }
} }
func (u *Uninstall) AddFlags(f *pflag.FlagSet) {
f.BoolVar(&u.DryRun, "dry-run", false, "simulate a uninstall")
f.BoolVar(&u.DisableHooks, "no-hooks", false, "prevent hooks from running during uninstallation")
f.BoolVar(&u.Purge, "purge", false, "remove the release from the store and make its name free for later use")
f.Int64Var(&u.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
}
// Run uninstalls the given release. // Run uninstalls the given release.
func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) { func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) {
if u.DryRun { if u.DryRun {

@ -25,7 +25,6 @@ import (
"time" "time"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/pflag"
"k8s.io/client-go/discovery" "k8s.io/client-go/discovery"
"k8s.io/helm/pkg/chart" "k8s.io/helm/pkg/chart"
@ -72,22 +71,6 @@ func NewUpgrade(cfg *Configuration) *Upgrade {
} }
} }
func (u *Upgrade) AddFlags(f *pflag.FlagSet) {
f.BoolVarP(&u.Install, "install", "i", false, "if a release by this name doesn't already exist, run an install")
f.BoolVar(&u.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
f.BoolVar(&u.DryRun, "dry-run", false, "simulate an upgrade")
f.BoolVar(&u.Recreate, "recreate-pods", false, "performs pods restart for the resource if applicable")
f.BoolVar(&u.Force, "force", false, "force resource update through delete/recreate if needed")
f.BoolVar(&u.DisableHooks, "no-hooks", false, "disable pre/post upgrade hooks")
f.Int64Var(&u.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
f.BoolVar(&u.ResetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart")
f.BoolVar(&u.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(&u.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.IntVar(&u.MaxHistory, "history-max", 0, "limit the maximum number of revisions saved per release. Use 0 for no limit.")
u.ChartPathOptions.AddFlags(f)
u.ValueOptions.AddFlags(f)
}
// Run executes the upgrade on the given release. // Run executes the upgrade on the given release.
func (u *Upgrade) Run(name string, chart *chart.Chart) (*release.Release, error) { func (u *Upgrade) Run(name string, chart *chart.Chart) (*release.Release, error) {
if err := chartutil.ProcessDependencies(chart, u.Values); err != nil { if err := chartutil.ProcessDependencies(chart, u.Values); err != nil {

@ -17,8 +17,6 @@ limitations under the License.
package action package action
import ( import (
"github.com/spf13/pflag"
"k8s.io/helm/pkg/downloader" "k8s.io/helm/pkg/downloader"
) )
@ -34,10 +32,6 @@ func NewVerify() *Verify {
return &Verify{} return &Verify{}
} }
func (v *Verify) AddFlags(f *pflag.FlagSet) {
f.StringVar(&v.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")
}
// Run executes 'helm verify'. // Run executes 'helm verify'.
func (v *Verify) Run(chartfile string) error { func (v *Verify) Run(chartfile string) error {
_, err := downloader.VerifyChart(chartfile, v.Keyring) _, err := downloader.VerifyChart(chartfile, v.Keyring)

Loading…
Cancel
Save