本文整理汇总了Golang中k8s/io/kubernetes/pkg/kubectl/cmd/util.DefaultSubCommandRun函数的典型用法代码示例。如果您正苦于以下问题:Golang DefaultSubCommandRun函数的具体用法?Golang DefaultSubCommandRun怎么用?Golang DefaultSubCommandRun使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultSubCommandRun函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewCommandMigrate
func NewCommandMigrate(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer, cmds ...*cobra.Command) *cobra.Command {
// Parent command to which all subcommands are added.
cmd := &cobra.Command{
Use: name,
Short: "Migrate data in the cluster",
Long: migrateLong,
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmd.AddCommand(cmds...)
return cmd
}
示例2: NewCmdConfig
func NewCmdConfig(name, fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: name,
Short: "Manage config",
Long: configLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
cmd.AddCommand(NewCmdPatch(PatchRecommendedName, fullName+" "+PatchRecommendedName, f, out))
return cmd
}
示例3: NewCmdCreateSecret
// NewCmdCreateSecret groups subcommands to create various types of secrets
func NewCmdCreateSecret(f cmdutil.Factory, cmdOut, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "secret",
Short: "Create a secret using specified subcommand",
Long: "Create a secret using specified subcommand.",
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, cmdOut))
cmd.AddCommand(NewCmdCreateSecretTLS(f, cmdOut))
cmd.AddCommand(NewCmdCreateSecretGeneric(f, cmdOut))
return cmd
}
示例4: NewCmdTop
func NewCmdTop(f *cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "top",
Short: "Display Resource (CPU/Memory/Storage) usage",
Long: topLong,
Run: cmdutil.DefaultSubCommandRun(errOut),
}
// create subcommands
cmd.AddCommand(NewCmdTopNode(f, out))
cmd.AddCommand(NewCmdTopPod(f, out))
return cmd
}
示例5: NewCmdCreateService
// NewCmdCreateService is a macro command to create a new namespace
func NewCmdCreateService(f *cmdutil.Factory, cmdOut, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "service",
Short: "Create a service using specified subcommand.",
Long: "Create a service using specified subcommand.",
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmd.AddCommand(NewCmdCreateServiceClusterIP(f, cmdOut))
cmd.AddCommand(NewCmdCreateServiceNodePort(f, cmdOut))
cmd.AddCommand(NewCmdCreateServiceLoadBalancer(f, cmdOut))
return cmd
}
示例6: NewCmdServiceAccounts
func NewCmdServiceAccounts(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
cmds := &cobra.Command{
Use: name,
Short: serviceAccountsShort,
Long: serviceAccountsLong,
Aliases: []string{"sa"},
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmds.AddCommand(NewCommandGetServiceAccountToken(GetServiceAccountTokenRecommendedName, fullName+" "+GetServiceAccountTokenRecommendedName, f, out))
cmds.AddCommand(NewCommandNewServiceAccountToken(NewServiceAccountTokenRecommendedName, fullName+" "+NewServiceAccountTokenRecommendedName, f, out))
return cmds
}
示例7: NewCmdCluster
func NewCmdCluster(name, fullName string, f *clientcmd.Factory, out, errout io.Writer) *cobra.Command {
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: fmt.Sprintf("%s ACTION", name),
Short: "Start and stop OpenShift cluster",
Long: clusterLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
cmds.AddCommand(docker.NewCmdUp(docker.CmdUpRecommendedName, fullName+" "+docker.CmdUpRecommendedName, f, out, errout))
cmds.AddCommand(docker.NewCmdDown(docker.CmdDownRecommendedName, fullName+" "+docker.CmdDownRecommendedName, f, out))
cmds.AddCommand(docker.NewCmdStatus(docker.CmdStatusRecommendedName, fullName+" "+docker.CmdStatusRecommendedName, f, out))
return cmds
}
示例8: NewCmdSet
func NewCmdSet(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "set SUBCOMMAND",
Short: "Set specific features on objects",
Long: set_long,
Run: cmdutil.DefaultSubCommandRun(err),
}
// add subcommands
cmd.AddCommand(NewCmdImage(f, out, err))
cmd.AddCommand(NewCmdResources(f, out, err))
return cmd
}
示例9: NewCmdCreateRoute
// NewCmdCreateRoute is a macro command to create a secured route.
func NewCmdCreateRoute(fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "route",
Short: "Expose containers externally via secured routes",
Long: fmt.Sprintf(routeLong, fullName),
Run: kcmdutil.DefaultSubCommandRun(errOut),
}
cmd.AddCommand(NewCmdCreateEdgeRoute(fullName, f, out))
cmd.AddCommand(NewCmdCreatePassthroughRoute(fullName, f, out))
cmd.AddCommand(NewCmdCreateReencryptRoute(fullName, f, out))
return cmd
}
示例10: NewCmdTypes
func NewCmdTypes(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
buf := &bytes.Buffer{}
for _, c := range concepts {
writeConcept(buf, c)
}
cmd := &cobra.Command{
Use: "types",
Short: "An introduction to concepts and types",
Long: fmt.Sprintf(typesLong, buf.String()),
Example: fmt.Sprintf(typesExample, fullName),
Run: kcmdutil.DefaultSubCommandRun(out),
}
return cmd
}
示例11: NewCmdImport
// NewCmdImport exposes commands for modifying objects.
func NewCmdImport(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "import COMMAND",
Short: "Commands that import applications",
Long: importLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
name := fmt.Sprintf("%s import", fullName)
cmd.AddCommand(NewCmdDockerCompose(name, f, in, out, errout))
cmd.AddCommand(NewCmdAppJSON(name, f, in, out, errout))
return cmd
}
示例12: NewCommandPrune
func NewCommandPrune(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: name,
Short: "Remove older versions of resources from the server",
Long: pruneLong,
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmds.AddCommand(NewCmdPruneBuilds(f, fullName, PruneBuildsRecommendedName, out))
cmds.AddCommand(NewCmdPruneDeployments(f, fullName, PruneDeploymentsRecommendedName, out))
cmds.AddCommand(NewCmdPruneImages(f, fullName, PruneImagesRecommendedName, out))
cmds.AddCommand(groups.NewCmdPrune(PruneGroupsRecommendedName, fullName+" "+PruneGroupsRecommendedName, f, out))
return cmds
}
示例13: NewCommandValidate
func NewCommandValidate(name, fullName string, out, errOut io.Writer) *cobra.Command {
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: name,
Short: "Validate configuration file integrity",
Long: validateLong,
Deprecated: validateDeprecationMessage,
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmds.AddCommand(NewCommandValidateMasterConfig(ValidateMasterConfigRecommendedName,
fullName+" "+ValidateMasterConfigRecommendedName, out))
cmds.AddCommand(NewCommandValidateNodeConfig(ValidateNodeConfigRecommendedName,
fullName+" "+ValidateNodeConfigRecommendedName, out))
return cmds
}
示例14: NewCmdPodNetwork
func NewCmdPodNetwork(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer) *cobra.Command {
// Parent command to which all subcommands are added.
cmds := &cobra.Command{
Use: name,
Short: "Manage pod network",
Long: podNetworkLong,
Run: cmdutil.DefaultSubCommandRun(errOut),
}
cmds.AddCommand(NewCmdJoinProjectsNetwork(JoinProjectsNetworkCommandName, fullName+" "+JoinProjectsNetworkCommandName, f, out))
cmds.AddCommand(NewCmdMakeGlobalProjectsNetwork(MakeGlobalProjectsNetworkCommandName, fullName+" "+MakeGlobalProjectsNetworkCommandName, f, out))
cmds.AddCommand(NewCmdIsolateProjectsNetwork(IsolateProjectsNetworkCommandName, fullName+" "+IsolateProjectsNetworkCommandName, f, out))
return cmds
}
示例15: NewCmdSet
// NewCmdSet exposes commands for modifying objects.
func NewCmdSet(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
set := &cobra.Command{
Use: "set COMMAND",
Short: "Commands that help set specific features on objects",
Long: setLong,
Run: cmdutil.DefaultSubCommandRun(errout),
}
name := fmt.Sprintf("%s set", fullName)
groups := templates.CommandGroups{
{
Message: "Replication controllers, deployments, and daemon sets:",
Commands: []*cobra.Command{
NewCmdEnv(name, f, in, out, errout),
NewCmdResources(name, f, out, errout),
NewCmdVolume(name, f, out, errout),
NewCmdProbe(name, f, out, errout),
NewCmdDeploymentHook(name, f, out, errout),
NewCmdImage(name, f, out, errout),
},
},
{
Message: "Manage secrets:",
Commands: []*cobra.Command{
NewCmdBuildSecret(name, f, out, errout),
},
},
{
Message: "Manage application flows:",
Commands: []*cobra.Command{
NewCmdTriggers(name, f, out, errout),
NewCmdBuildHook(name, f, out, errout),
},
},
{
Message: "Control load balancing:",
Commands: []*cobra.Command{
NewCmdRouteBackends(name, f, out, errout),
},
},
}
groups.Add(set)
templates.ActsAsRootCommand(set, []string{"options"}, groups...)
return set
}