Skip to content

Commit

Permalink
Merge pull request #1351 from rsteube/kubectl-updates-v1.25.2
Browse files Browse the repository at this point in the history
kubectl: updates from v1.25.2
  • Loading branch information
rsteube authored Oct 8, 2022
2 parents 4eb7c24 + 5ba22cd commit 953b2c7
Show file tree
Hide file tree
Showing 111 changed files with 1,170 additions and 859 deletions.
17 changes: 17 additions & 0 deletions completers/kubectl_completer/cmd/alpha_auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var alpha_authCmd = &cobra.Command{
Use: "auth",
Short: "Inspect authorization",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alpha_authCmd).Standalone()
alphaCmd.AddCommand(alpha_authCmd)
}
21 changes: 21 additions & 0 deletions completers/kubectl_completer/cmd/alpha_auth_whoami.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var alpha_auth_whoamiCmd = &cobra.Command{
Use: "whoami",
Short: "Experimental: Check self subject attributes",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alpha_auth_whoamiCmd).Standalone()
alpha_auth_whoamiCmd.Flags().Bool("allow-missing-template-keys", true, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
alpha_auth_whoamiCmd.Flags().StringP("output", "o", "", "Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).")
alpha_auth_whoamiCmd.Flags().Bool("show-managed-fields", false, "If true, keep the managedFields when printing objects in JSON or YAML format.")
alpha_auth_whoamiCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
alpha_authCmd.AddCommand(alpha_auth_whoamiCmd)
}
27 changes: 27 additions & 0 deletions completers/kubectl_completer/cmd/alpha_events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var alpha_eventsCmd = &cobra.Command{
Use: "events",
Short: "Experimental: List events",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alpha_eventsCmd).Standalone()
alpha_eventsCmd.Flags().BoolP("all-namespaces", "A", false, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.")
alpha_eventsCmd.Flags().Bool("allow-missing-template-keys", true, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
alpha_eventsCmd.Flags().Int64("chunk-size", 500, "Return large lists in chunks rather than all at once. Pass 0 to disable. This flag is beta and may change in the future.")
alpha_eventsCmd.Flags().String("for", "", "Filter events to only those pertaining to the specified resource.")
alpha_eventsCmd.Flags().Bool("no-headers", false, "When using the default output format, don't print headers.")
alpha_eventsCmd.Flags().StringP("output", "o", "", "Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).")
alpha_eventsCmd.Flags().Bool("show-managed-fields", false, "If true, keep the managedFields when printing objects in JSON or YAML format.")
alpha_eventsCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
alpha_eventsCmd.Flags().StringSlice("types", []string{}, "Output only events of given types.")
alpha_eventsCmd.Flags().BoolP("watch", "w", false, "After listing the requested events, watch for more events.")
alphaCmd.AddCommand(alpha_eventsCmd)
}
29 changes: 15 additions & 14 deletions completers/kubectl_completer/cmd/annotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ var annotateCmd = &cobra.Command{

func init() {
carapace.Gen(annotateCmd).Standalone()

annotateCmd.Flags().Bool("all", false, "Select all resources, including uninitialized ones, in the namespace of the specified resource types")
annotateCmd.Flags().Bool("allow-missing-template-keys", false, "If true, ignore any errors in templates when a field or map key is missing in the template. Only app")
annotateCmd.Flags().String("dry-run", "", "Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent,")
annotateCmd.Flags().String("field-manager", "", "Name of the manager used to track field ownership.")
annotateCmd.Flags().String("field-selector", "", "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1")
annotateCmd.Flags().StringP("filename", "f", "", "Filename, directory, or URL to files identifying the resource to update the annotation")
annotateCmd.Flags().Bool("all", false, "Select all resources, in the namespace of the specified resource types.")
annotateCmd.Flags().BoolP("all-namespaces", "A", false, "If true, check the specified action in all namespaces.")
annotateCmd.Flags().Bool("allow-missing-template-keys", true, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
annotateCmd.Flags().String("dry-run", "none", "Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.")
annotateCmd.Flags().String("field-manager", "kubectl-annotate", "Name of the manager used to track field ownership.")
annotateCmd.Flags().String("field-selector", "", "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.")
annotateCmd.Flags().StringSliceP("filename", "f", []string{}, "Filename, directory, or URL to files identifying the resource to update the annotation")
annotateCmd.Flags().StringP("kustomize", "k", "", "Process the kustomization directory. This flag can't be used together with -f or -R.")
annotateCmd.Flags().Bool("list", false, "If true, display the annotations for a given resource.")
annotateCmd.Flags().Bool("local", false, "If true, annotation will NOT contact api-server but run locally.")
annotateCmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|js")
annotateCmd.Flags().Bool("overwrite", false, "If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite exi")
annotateCmd.Flags().Bool("record", false, "Record current kubectl command in the resource annotation. If set to false, do not record the comman")
annotateCmd.Flags().BoolP("recursive", "R", false, "Process the directory used in -f, --filename recursively. Useful when you want to manage related man")
annotateCmd.Flags().String("resource-version", "", "If non-empty, the annotation update will only succeed if this is the current resource-version for th")
annotateCmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.")
annotateCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The templa")
annotateCmd.Flags().StringP("output", "o", "", "Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).")
annotateCmd.Flags().Bool("overwrite", false, "If true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations.")
annotateCmd.Flags().BoolP("recursive", "R", false, "Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.")
annotateCmd.Flags().String("resource-version", "", "If non-empty, the annotation update will only succeed if this is the current resource-version for the object. Only valid when specifying a single resource.")
annotateCmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.")
annotateCmd.Flags().Bool("show-managed-fields", false, "If true, keep the managedFields when printing objects in JSON or YAML format.")
annotateCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
annotateCmd.Flag("dry-run").NoOptDefVal = "unchanged"
rootCmd.AddCommand(annotateCmd)

carapace.Gen(annotateCmd).FlagCompletion(carapace.ActionMap{
Expand Down
9 changes: 4 additions & 5 deletions completers/kubectl_completer/cmd/apiResources.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ var apiResourcesCmd = &cobra.Command{

func init() {
carapace.Gen(apiResourcesCmd).Standalone()

apiResourcesCmd.Flags().String("api-group", "", "Limit to resources in the specified API group.")
apiResourcesCmd.Flags().Bool("cached", false, "Use the cached list of resources if available.")
apiResourcesCmd.Flags().Bool("namespaced", false, "If false, non-namespaced resources will be returned, otherwise returning namespaced resources by def")
apiResourcesCmd.Flags().Bool("namespaced", true, "If false, non-namespaced resources will be returned, otherwise returning namespaced resources by default.")
apiResourcesCmd.Flags().Bool("no-headers", false, "When using the default or custom-column output format, don't print headers (default print headers).")
apiResourcesCmd.Flags().StringP("output", "o", "", "Output format. One of: wide|name.")
apiResourcesCmd.Flags().String("sort-by", "", "If non-empty, sort list of resources using specified field. The field can be either 'name' or 'kind'")
apiResourcesCmd.Flags().String("verbs", "", "Limit to resources that support the specified verbs.")
apiResourcesCmd.Flags().StringP("output", "o", "", "Output format. One of: (wide, name).")
apiResourcesCmd.Flags().String("sort-by", "", "If non-empty, sort list of resources using specified field. The field can be either 'name' or 'kind'.")
apiResourcesCmd.Flags().StringSlice("verbs", []string{}, "Limit to resources that support the specified verbs.")
rootCmd.AddCommand(apiResourcesCmd)

carapace.Gen(apiResourcesCmd).FlagCompletion(carapace.ActionMap{
Expand Down
3 changes: 1 addition & 2 deletions completers/kubectl_completer/cmd/apiVersions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (

var apiVersionsCmd = &cobra.Command{
Use: "api-versions",
Short: "Print the supported API versions on the server",
Short: "Print the supported API versions on the server, in the form of \"group/version\"",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(apiVersionsCmd).Standalone()

rootCmd.AddCommand(apiVersionsCmd)
}
44 changes: 24 additions & 20 deletions completers/kubectl_completer/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,44 @@ package cmd
import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/completers/kubectl_completer/cmd/action"
"github.com/rsteube/carapace-bin/pkg/actions/tools/kubectl"
"github.com/spf13/cobra"
)

var applyCmd = &cobra.Command{
Use: "apply",
Short: "Apply a configuration to a resource by filename or stdin",
Short: "Apply a configuration to a resource by file name or stdin",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(applyCmd).Standalone()

applyCmd.Flags().Bool("all", false, "Select all resources in the namespace of the specified resource types.")
applyCmd.Flags().Bool("allow-missing-template-keys", false, "If true, ignore any errors in templates when a field or map key is missing in the template. Only app")
applyCmd.Flags().String("cascade", "", "Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dep")
applyCmd.Flags().String("dry-run", "", "Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent,")
applyCmd.Flags().String("field-manager", "", "Name of the manager used to track field ownership.")
applyCmd.Flags().StringP("filename", "f", "", "that contains the configuration to apply")
applyCmd.Flags().Bool("force", false, "If true, immediately remove resources from API and bypass graceful deletion. Note that immediate del")
applyCmd.Flags().Bool("allow-missing-template-keys", true, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
applyCmd.Flags().String("cascade", "background", "Must be \"background\", \"orphan\", or \"foreground\". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.")
applyCmd.Flags().String("dry-run", "none", "Must be \"none\", \"server\", or \"client\". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.")
applyCmd.Flags().String("field-manager", "kubectl-client-side-apply", "Name of the manager used to track field ownership.")
applyCmd.Flags().StringSliceP("filename", "f", []string{}, "The files that contain the configurations to apply.")
applyCmd.Flags().Bool("force", false, "If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.")
applyCmd.Flags().Bool("force-conflicts", false, "If true, server-side apply will force the changes against conflicts.")
applyCmd.Flags().String("grace-period", "", "Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to")
applyCmd.Flags().Int("grace-period", -1, "Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).")
applyCmd.Flags().StringP("kustomize", "k", "", "Process a kustomization directory. This flag can't be used together with -f or -R.")
applyCmd.Flags().Bool("openapi-patch", false, "If true, use openapi to calculate diff when the openapi presents and the resource can be found in th")
applyCmd.Flags().StringP("output", "o", "", "Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|js")
applyCmd.Flags().Bool("overwrite", false, "Automatically resolve conflicts between the modified and live configuration by using values from the")
applyCmd.Flags().Bool("prune", false, "Automatically delete resource objects, including the uninitialized ones, that do not appear in the c")
applyCmd.Flags().String("prune-whitelist", "", "Overwrite the default whitelist with <group/version/kind> for --prune")
applyCmd.Flags().Bool("record", false, "Record current kubectl command in the resource annotation. If set to false, do not record the comman")
applyCmd.Flags().BoolP("recursive", "R", false, "Process the directory used in -f, --filename recursively. Useful when you want to manage related man")
applyCmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
applyCmd.Flags().Bool("openapi-patch", true, "If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types.")
applyCmd.Flags().StringP("output", "o", "", "Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).")
applyCmd.Flags().Bool("overwrite", true, "Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration")
applyCmd.Flags().Bool("prune", false, "Automatically delete resource objects, that do not appear in the configs and are created by either apply or create --save-config. Should be used with either -l or --all.")
applyCmd.Flags().StringArray("prune-whitelist", []string{}, "Overwrite the default whitelist with <group/version/kind> for --prune")
applyCmd.Flags().BoolP("recursive", "R", false, "Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.")
applyCmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching objects must satisfy all of the specified label constraints.")
applyCmd.Flags().Bool("server-side", false, "If true, apply runs in the server instead of the client.")
applyCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The templa")
applyCmd.Flags().String("timeout", "", "The length of time to wait before giving up on a delete, zero means determine a timeout from the siz")
applyCmd.Flags().Bool("validate", false, "If true, use a schema to validate the input before sending it")
applyCmd.Flags().Bool("show-managed-fields", false, "If true, keep the managedFields when printing objects in JSON or YAML format.")
applyCmd.Flags().String("template", "", "Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].")
applyCmd.Flags().String("timeout", "0s", "The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object")
applyCmd.Flags().String("validate", "strict", "Must be one of: strict (or true), warn, ignore (or false).")
applyCmd.Flags().Bool("wait", false, "If true, wait for resources to be gone before returning. This waits for finalizers.")
applyCmd.Flag("cascade").NoOptDefVal = "background"
applyCmd.Flag("dry-run").NoOptDefVal = "unchanged"
applyCmd.Flag("validate").NoOptDefVal = "strict"
rootCmd.AddCommand(applyCmd)

carapace.Gen(applyCmd).FlagCompletion(carapace.ActionMap{
Expand All @@ -47,5 +50,6 @@ func init() {
"kustomize": carapace.ActionDirectories(),
"output": action.ActionOutputFormats(),
"template": carapace.ActionFiles(),
"validate": kubectl.ActionValidationModes(),
})
}
Loading

0 comments on commit 953b2c7

Please sign in to comment.