本文整理汇总了Golang中k8s/io/kubernetes/pkg/kubectl.DescribableResources函数的典型用法代码示例。如果您正苦于以下问题:Golang DescribableResources函数的具体用法?Golang DescribableResources怎么用?Golang DescribableResources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DescribableResources函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewCmdDescribe
func NewCmdDescribe(f *cmdutil.Factory, out io.Writer) *cobra.Command {
options := &DescribeOptions{}
describerSettings := &kubectl.DescriberSettings{}
validArgs := kubectl.DescribableResources()
argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{
Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)",
Short: "Show details of a specific resource or group of resources",
Long: describe_long,
Example: describe_example,
Run: func(cmd *cobra.Command, args []string) {
err := RunDescribe(f, out, cmd, args, options, describerSettings)
cmdutil.CheckErr(err)
},
ValidArgs: validArgs,
ArgAliases: argAliases,
}
usage := "Filename, directory, or URL to a file containing the resource to describe"
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
cmdutil.AddRecursiveFlag(cmd, &options.Recursive)
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
cmd.Flags().Bool("all-namespaces", false, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.")
cmd.Flags().BoolVar(&describerSettings.ShowEvents, "show-events", true, "If true, display events related to the described object.")
cmdutil.AddInclude3rdPartyFlags(cmd)
return cmd
}
示例2: NewCmdDescribe
func NewCmdDescribe(f *cmdutil.Factory, out io.Writer) *cobra.Command {
options := &DescribeOptions{}
validArgs := kubectl.DescribableResources()
argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{
Use: "describe (-f FILENAME | TYPE [NAME_PREFIX | -l label] | TYPE/NAME)",
Short: "Show details of a specific resource or group of resources",
Long: describe_long,
Example: describe_example,
Run: func(cmd *cobra.Command, args []string) {
err := RunDescribe(f, out, cmd, args, options)
cmdutil.CheckErr(err)
},
ValidArgs: validArgs,
ArgAliases: argAliases,
}
usage := "Filename, directory, or URL to a file containing the resource to describe"
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
cmdutil.AddRecursiveFlag(cmd, &options.Recursive)
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
cmdutil.AddInclude3rdPartyFlags(cmd)
return cmd
}
示例3: DescribableResources
// List of all resource types we can describe
func DescribableResources() []string {
// Include describable resources in kubernetes
keys := kctl.DescribableResources()
for k := range describerMap(nil, nil, "") {
resource := strings.ToLower(k)
keys = append(keys, resource)
}
return keys
}
示例4: NewCmdDescribe
func NewCmdDescribe(f *cmdutil.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "describe (TYPE [(NAME_PREFIX | -l label] | TYPE/NAME)",
Short: "Show details of a specific resource or group of resources",
Long: describe_long,
Example: describe_example,
Run: func(cmd *cobra.Command, args []string) {
err := RunDescribe(f, out, cmd, args)
cmdutil.CheckErr(err)
},
ValidArgs: kubectl.DescribableResources(),
}
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
return cmd
}