本文整理匯總了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
}