cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals cleanup: sort imports Add i18n dependency for wait.go Remove translation on envResource cleanup: translate string instead of variable cleanup: sort imports cleanup: translate string literal only Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
This commit is contained in:
parent
19654050b5
commit
38408eaa8c
|
@ -78,7 +78,7 @@ type AnnotateOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
annotateLong = templates.LongDesc(`
|
||||
annotateLong = templates.LongDesc(i18n.T(`
|
||||
Update the annotations on one or more resources
|
||||
|
||||
All Kubernetes objects support the ability to store additional data with the object as
|
||||
|
@ -88,7 +88,7 @@ var (
|
|||
|
||||
Attempting to set an annotation that already exists will fail unless --overwrite is set.
|
||||
If --resource-version is specified and does not match the current resource version on
|
||||
the server the command will fail.`)
|
||||
the server the command will fail.`))
|
||||
|
||||
annotateExample = templates.Examples(i18n.T(`
|
||||
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
"k8s.io/cli-runtime/pkg/printers"
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
|
@ -90,8 +91,8 @@ func NewCmdAPIResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
|
|||
|
||||
cmd := &cobra.Command{
|
||||
Use: "api-resources",
|
||||
Short: "Print the supported API resources on the server",
|
||||
Long: "Print the supported API resources on the server",
|
||||
Short: i18n.T("Print the supported API resources on the server"),
|
||||
Long: i18n.T("Print the supported API resources on the server"),
|
||||
Example: apiresourcesExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(cmd, args))
|
||||
|
|
|
@ -55,8 +55,8 @@ func NewCmdAPIVersions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||
o := NewAPIVersionsOptions(ioStreams)
|
||||
cmd := &cobra.Command{
|
||||
Use: "api-versions",
|
||||
Short: "Print the supported API versions on the server, in the form of \"group/version\"",
|
||||
Long: "Print the supported API versions on the server, in the form of \"group/version\"",
|
||||
Short: i18n.T("Print the supported API versions on the server, in the form of \"group/version\""),
|
||||
Long: i18n.T("Print the supported API versions on the server, in the form of \"group/version\""),
|
||||
Example: apiversionsExample,
|
||||
DisableFlagsInUseLine: true,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
|
|
@ -22,11 +22,12 @@ import (
|
|||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/cmd/util/editor"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
var (
|
||||
applyEditLastAppliedLong = templates.LongDesc(`
|
||||
applyEditLastAppliedLong = templates.LongDesc(i18n.T(`
|
||||
Edit the latest last-applied-configuration annotations of resources from the default editor.
|
||||
|
||||
The edit-last-applied command allows you to directly edit any API resource you can retrieve via the
|
||||
|
@ -45,7 +46,7 @@ var (
|
|||
that contains your unapplied changes. The most common error when updating a resource
|
||||
is another editor changing the resource on the server. When this occurs, you will have
|
||||
to apply your changes to the newer version of the resource, or update your temporary
|
||||
saved copy to include the latest resource version.`)
|
||||
saved copy to include the latest resource version.`))
|
||||
|
||||
applyEditLastAppliedExample = templates.Examples(`
|
||||
# Edit the last-applied-configuration annotations by type/name in YAML.
|
||||
|
@ -62,7 +63,7 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, ioStreams genericclioptions.I
|
|||
cmd := &cobra.Command{
|
||||
Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: "Edit latest last-applied-configuration annotations of a resource/object",
|
||||
Short: i18n.T("Edit latest last-applied-configuration annotations of a resource/object"),
|
||||
Long: applyEditLastAppliedLong,
|
||||
Example: applyEditLastAppliedExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
|
|
@ -103,7 +103,7 @@ func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra
|
|||
Use: "attach (POD | TYPE/NAME) -c CONTAINER",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Attach to a running container"),
|
||||
Long: "Attach to a process that is already running inside an existing container.",
|
||||
Long: i18n.T("Attach to a process that is already running inside an existing container."),
|
||||
Example: attachExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||
|
|
|
@ -46,7 +46,7 @@ func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||
Use: "certificate SUBCOMMAND",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Modify certificate resources."),
|
||||
Long: "Modify certificate resources.",
|
||||
Long: i18n.T("Modify certificate resources."),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmd.Help()
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS
|
|||
Use: "approve (-f FILENAME | NAME)",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Approve a certificate signing request"),
|
||||
Long: templates.LongDesc(`
|
||||
Long: templates.LongDesc(i18n.T(`
|
||||
Approve a certificate signing request.
|
||||
|
||||
kubectl certificate approve allows a cluster admin to approve a certificate
|
||||
|
@ -129,7 +129,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS
|
|||
can potentially grant a requester access to cluster resources or to authenticate
|
||||
as a requested identity. Before approving a CSR, ensure you understand what the
|
||||
signed certificate can do.
|
||||
`),
|
||||
`)),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(o.Validate())
|
||||
|
@ -161,13 +161,13 @@ func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||
Use: "deny (-f FILENAME | NAME)",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Deny a certificate signing request"),
|
||||
Long: templates.LongDesc(`
|
||||
Long: templates.LongDesc(i18n.T(`
|
||||
Deny a certificate signing request.
|
||||
|
||||
kubectl certificate deny allows a cluster admin to deny a certificate
|
||||
signing request (CSR). This action tells a certificate signing controller to
|
||||
not to issue a certificate to the requestor.
|
||||
`),
|
||||
`)),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||
cmdutil.CheckErr(o.Validate())
|
||||
|
|
|
@ -40,14 +40,14 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, streams
|
|||
Use: "config SUBCOMMAND",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Modify kubeconfig files"),
|
||||
Long: templates.LongDesc(`
|
||||
Long: templates.LongDesc(i18n.T(`
|
||||
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"
|
||||
|
||||
The loading order follows these rules:
|
||||
|
||||
1. If the --` + pathOptions.ExplicitFileFlag + ` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.
|
||||
2. If $` + pathOptions.EnvVar + ` environment variable is set, then it is used as a list of paths (normal path delimiting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list.
|
||||
3. Otherwise, ` + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + ` is used and no merging takes place.`),
|
||||
1. If the --`) + pathOptions.ExplicitFileFlag + i18n.T(` flag is set, then only that file is loaded. The flag may only be set once and no merging takes place.
|
||||
2. If $`) + pathOptions.EnvVar + i18n.T(` environment variable is set, then it is used as a list of paths (normal path delimiting rules for your system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last file in the list.
|
||||
3. Otherwise, `) + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + i18n.T(` is used and no merging takes place.`)),
|
||||
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
createAuthInfoLong = fmt.Sprintf(templates.LongDesc(`
|
||||
createAuthInfoLong = fmt.Sprintf(templates.LongDesc(i18n.T(`
|
||||
Sets a user entry in kubeconfig
|
||||
|
||||
Specifying a name that already exists will merge new fields on top of existing values.
|
||||
|
@ -81,7 +81,7 @@ var (
|
|||
Basic auth flags:
|
||||
--%v=basic_user --%v=basic_password
|
||||
|
||||
Bearer token and basic auth are mutually exclusive.`), clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword)
|
||||
Bearer token and basic auth are mutually exclusive.`)), clientcmd.FlagCertFile, clientcmd.FlagKeyFile, clientcmd.FlagBearerToken, clientcmd.FlagUsername, clientcmd.FlagPassword)
|
||||
|
||||
createAuthInfoExample = templates.Examples(`
|
||||
# Set only the "client-key" field on the "cluster-admin"
|
||||
|
|
|
@ -44,10 +44,10 @@ type createClusterOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
createClusterLong = templates.LongDesc(`
|
||||
createClusterLong = templates.LongDesc(i18n.T(`
|
||||
Sets a cluster entry in kubeconfig.
|
||||
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`)
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`))
|
||||
|
||||
createClusterExample = templates.Examples(`
|
||||
# Set only the server field on the e2e cluster entry without touching other values.
|
||||
|
|
|
@ -41,10 +41,10 @@ type createContextOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
createContextLong = templates.LongDesc(`
|
||||
createContextLong = templates.LongDesc(i18n.T(`
|
||||
Sets a context entry in kubeconfig
|
||||
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`)
|
||||
Specifying a name that already exists will merge new fields on top of existing values for those fields.`))
|
||||
|
||||
createContextExample = templates.Examples(`
|
||||
# Set the user field on the gce context entry without touching other values
|
||||
|
|
|
@ -34,8 +34,8 @@ type CurrentContextOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
currentContextLong = templates.LongDesc(`
|
||||
Displays the current-context`)
|
||||
currentContextLong = templates.LongDesc(i18n.T(`
|
||||
Displays the current-context`))
|
||||
|
||||
currentContextExample = templates.Examples(`
|
||||
# Display the current-context
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAcces
|
|||
Use: "delete-cluster NAME",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Delete the specified cluster from the kubeconfig"),
|
||||
Long: "Delete the specified cluster from the kubeconfig",
|
||||
Long: i18n.T("Delete the specified cluster from the kubeconfig"),
|
||||
Example: deleteClusterExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(runDeleteCluster(out, configAccess, cmd))
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.Con
|
|||
Use: "delete-context NAME",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Delete the specified context from the kubeconfig"),
|
||||
Long: "Delete the specified context from the kubeconfig",
|
||||
Long: i18n.T("Delete the specified context from the kubeconfig"),
|
||||
Example: deleteContextExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(runDeleteContext(out, errOut, configAccess, cmd))
|
||||
|
|
|
@ -62,7 +62,7 @@ func NewCmdConfigDeleteUser(streams genericclioptions.IOStreams, configAccess cl
|
|||
Use: "delete-user NAME",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Delete the specified user from the kubeconfig"),
|
||||
Long: "Delete the specified user from the kubeconfig",
|
||||
Long: i18n.T("Delete the specified user from the kubeconfig"),
|
||||
Example: deleteUserExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(cmd, args))
|
||||
|
|
|
@ -39,7 +39,7 @@ func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess)
|
|||
cmd := &cobra.Command{
|
||||
Use: "get-clusters",
|
||||
Short: i18n.T("Display clusters defined in the kubeconfig"),
|
||||
Long: "Display clusters defined in the kubeconfig.",
|
||||
Long: i18n.T("Display clusters defined in the kubeconfig."),
|
||||
Example: getClustersExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(runGetClusters(out, configAccess))
|
||||
|
|
|
@ -47,7 +47,7 @@ type GetContextsOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
getContextsLong = templates.LongDesc(`Displays one or many contexts from the kubeconfig file.`)
|
||||
getContextsLong = templates.LongDesc(i18n.T(`Displays one or many contexts from the kubeconfig file.`))
|
||||
|
||||
getContextsExample = templates.Examples(`
|
||||
# List all the contexts in your kubeconfig file
|
||||
|
|
|
@ -58,7 +58,7 @@ func NewCmdConfigGetUsers(streams genericclioptions.IOStreams, configAccess clie
|
|||
cmd := &cobra.Command{
|
||||
Use: "get-users",
|
||||
Short: i18n.T("Display users defined in the kubeconfig"),
|
||||
Long: "Display users defined in the kubeconfig.",
|
||||
Long: i18n.T("Display users defined in the kubeconfig."),
|
||||
Example: getUsersExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Run())
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
|
@ -37,19 +38,19 @@ type RenameContextOptions struct {
|
|||
|
||||
const (
|
||||
renameContextUse = "rename-context CONTEXT_NAME NEW_NAME"
|
||||
|
||||
renameContextShort = "Renames a context from the kubeconfig file."
|
||||
)
|
||||
|
||||
var (
|
||||
renameContextLong = templates.LongDesc(`
|
||||
renameContextShort = i18n.T("Renames a context from the kubeconfig file.")
|
||||
|
||||
renameContextLong = templates.LongDesc(i18n.T(`
|
||||
Renames a context from the kubeconfig file.
|
||||
|
||||
CONTEXT_NAME is the context name that you wish to change.
|
||||
|
||||
NEW_NAME is the new name you wish to set.
|
||||
|
||||
Note: In case the context being renamed is the 'current-context', this field will also be updated.`)
|
||||
Note: In case the context being renamed is the 'current-context', this field will also be updated.`))
|
||||
|
||||
renameContextExample = templates.Examples(`
|
||||
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
|
||||
|
|
|
@ -41,14 +41,14 @@ type setOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
setLong = templates.LongDesc(`
|
||||
setLong = templates.LongDesc(i18n.T(`
|
||||
Sets an individual value in a kubeconfig file
|
||||
|
||||
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.
|
||||
|
||||
PROPERTY_VALUE is the new value you wish to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded string unless the --set-raw-bytes flag is used.
|
||||
|
||||
Specifying a attribute name that already exists will merge new fields on top of existing values.`)
|
||||
Specifying a attribute name that already exists will merge new fields on top of existing values.`))
|
||||
|
||||
setExample = templates.Examples(`
|
||||
# Set server field on the my-cluster cluster to https://1.2.3.4
|
||||
|
|
|
@ -36,10 +36,10 @@ type unsetOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
unsetLong = templates.LongDesc(`
|
||||
unsetLong = templates.LongDesc(i18n.T(`
|
||||
Unsets an individual value in a kubeconfig file
|
||||
|
||||
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.`)
|
||||
PROPERTY_NAME is a dot delimited name where each token represents either an attribute name or a map key. Map keys may not contain dots.`))
|
||||
|
||||
unsetExample = templates.Examples(`
|
||||
# Unset the current-context.
|
||||
|
|
|
@ -51,10 +51,10 @@ type ViewOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
viewLong = templates.LongDesc(`
|
||||
viewLong = templates.LongDesc(i18n.T(`
|
||||
Display merged kubeconfig settings or a specified kubeconfig file.
|
||||
|
||||
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.`)
|
||||
You can use --output jsonpath={...} to extract specific values using a jsonpath expression.`))
|
||||
|
||||
viewExample = templates.Examples(`
|
||||
# Show merged kubeconfig settings.
|
||||
|
|
|
@ -102,7 +102,7 @@ func NewCmdCp(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.C
|
|||
Use: "cp <file-spec-src> <file-spec-dest>",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Copy files and directories to and from containers."),
|
||||
Long: "Copy files and directories to and from containers.",
|
||||
Long: i18n.T("Copy files and directories to and from containers."),
|
||||
Example: cpExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd))
|
||||
|
|
|
@ -33,12 +33,13 @@ import (
|
|||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/scheme"
|
||||
"k8s.io/kubectl/pkg/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
var (
|
||||
cronjobLong = templates.LongDesc(`
|
||||
Create a cronjob with the specified name.`)
|
||||
cronjobLong = templates.LongDesc(i18n.T(`
|
||||
Create a cronjob with the specified name.`))
|
||||
|
||||
cronjobExample = templates.Examples(`
|
||||
# Create a cronjob
|
||||
|
|
|
@ -32,7 +32,7 @@ func NewCmdCreateSecret(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
|
|||
cmd := &cobra.Command{
|
||||
Use: "secret",
|
||||
Short: i18n.T("Create a secret using specified subcommand"),
|
||||
Long: "Create a secret using specified subcommand.",
|
||||
Long: i18n.T("Create a secret using specified subcommand."),
|
||||
Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut),
|
||||
}
|
||||
cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, ioStreams))
|
||||
|
|
|
@ -34,7 +34,7 @@ func NewCmdCreateService(f cmdutil.Factory, ioStreams genericclioptions.IOStream
|
|||
Use: "service",
|
||||
Aliases: []string{"svc"},
|
||||
Short: i18n.T("Create a service using specified subcommand."),
|
||||
Long: "Create a service using specified subcommand.",
|
||||
Long: i18n.T("Create a service using specified subcommand."),
|
||||
Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut),
|
||||
}
|
||||
cmd.AddCommand(NewCmdCreateServiceClusterIP(f, ioStreams))
|
||||
|
|
|
@ -35,7 +35,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
describeLong = templates.LongDesc(`
|
||||
describeLong = templates.LongDesc(i18n.T(`
|
||||
Show details of a specific resource or group of resources
|
||||
|
||||
Print a detailed description of the selected resources, including related resources such
|
||||
|
@ -45,7 +45,7 @@ var (
|
|||
$ kubectl describe TYPE NAME_PREFIX
|
||||
|
||||
will first check for an exact match on TYPE and NAME_PREFIX. If no such resource
|
||||
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.`)
|
||||
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.`))
|
||||
|
||||
describeExample = templates.Examples(i18n.T(`
|
||||
# Describe a node
|
||||
|
|
|
@ -85,7 +85,7 @@ func NewCmdExec(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
|
|||
Use: "exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Execute a command in a container"),
|
||||
Long: "Execute a command in a container.",
|
||||
Long: i18n.T("Execute a command in a container."),
|
||||
Example: execExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
argsLenAtDash := cmd.ArgsLenAtDash()
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
explainLong = templates.LongDesc(`
|
||||
explainLong = templates.LongDesc(i18n.T(`
|
||||
List the fields for supported resources
|
||||
|
||||
This command describes the fields associated with each supported API resource.
|
||||
|
@ -41,7 +41,7 @@ var (
|
|||
<type>.<fieldName>[.<fieldName>]
|
||||
|
||||
Add the --recursive flag to display all of the fields at once without descriptions.
|
||||
Information about each field is retrieved from the server in OpenAPI format.`)
|
||||
Information about each field is retrieved from the server in OpenAPI format.`))
|
||||
|
||||
explainExamples = templates.Examples(i18n.T(`
|
||||
# Get the documentation of the resource and its fields
|
||||
|
|
|
@ -42,9 +42,9 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
exposeResources = `pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)`
|
||||
exposeResources = i18n.T(`pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)`)
|
||||
|
||||
exposeLong = templates.LongDesc(`
|
||||
exposeLong = templates.LongDesc(i18n.T(`
|
||||
Expose a resource as a new Kubernetes service.
|
||||
|
||||
Looks up a deployment, service, replica set, replication controller or pod by name and uses the selector
|
||||
|
@ -56,7 +56,7 @@ var (
|
|||
|
||||
Possible resources include (case insensitive):
|
||||
|
||||
` + exposeResources)
|
||||
`) + exposeResources)
|
||||
|
||||
exposeExample = templates.Examples(i18n.T(`
|
||||
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
||||
|
|
|
@ -85,7 +85,7 @@ type GetOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
getLong = templates.LongDesc(`
|
||||
getLong = templates.LongDesc(i18n.T(`
|
||||
Display one or many resources
|
||||
|
||||
Prints a table of the most important information about the specified resources.
|
||||
|
@ -96,7 +96,7 @@ var (
|
|||
Uninitialized objects are not shown unless --include-uninitialized is passed.
|
||||
|
||||
By specifying the output as 'template' and providing a Go template as the value
|
||||
of the --template flag, you can filter the attributes of the fetched resources.`)
|
||||
of the --template flag, you can filter the attributes of the fetched resources.`))
|
||||
|
||||
getExample = templates.Examples(i18n.T(`
|
||||
# List all pods in ps output format.
|
||||
|
|
|
@ -146,7 +146,7 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
|
|||
Use: logsUsageStr,
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: i18n.T("Print the logs for a container in a pod"),
|
||||
Long: "Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional.",
|
||||
Long: i18n.T("Print the logs for a container in a pod or specified resource. If the pod has only one container, the container name is optional."),
|
||||
Example: logsExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||
|
|
|
@ -36,7 +36,7 @@ func NewCmdOptions(out io.Writer) *cobra.Command {
|
|||
cmd := &cobra.Command{
|
||||
Use: "options",
|
||||
Short: i18n.T("Print the list of flags inherited by all commands"),
|
||||
Long: "Print the list of flags inherited by all commands",
|
||||
Long: i18n.T("Print the list of flags inherited by all commands"),
|
||||
Example: optionsExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmd.Usage()
|
||||
|
|
|
@ -34,23 +34,23 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
pluginLong = templates.LongDesc(`
|
||||
pluginLong = templates.LongDesc(i18n.T(`
|
||||
Provides utilities for interacting with plugins.
|
||||
|
||||
Plugins provide extended functionality that is not part of the major command-line distribution.
|
||||
Please refer to the documentation and examples for more information about how write your own plugins.
|
||||
|
||||
The easiest way to discover and install plugins is via the kubernetes sub-project krew.
|
||||
To install krew, visit [krew.sigs.k8s.io](https://krew.sigs.k8s.io/docs/user-guide/setup/install/)`)
|
||||
To install krew, visit [krew.sigs.k8s.io](https://krew.sigs.k8s.io/docs/user-guide/setup/install/)`))
|
||||
|
||||
pluginListLong = templates.LongDesc(`
|
||||
pluginListLong = templates.LongDesc(i18n.T(`
|
||||
List all available plugin files on a user's PATH.
|
||||
|
||||
Available plugin files are those that are:
|
||||
- executable
|
||||
- anywhere on the user's PATH
|
||||
- begin with "kubectl-"
|
||||
`)
|
||||
`))
|
||||
|
||||
ValidPluginFilenamePrefixes = []string{"kubectl"}
|
||||
)
|
||||
|
@ -87,7 +87,7 @@ func NewCmdPluginList(f cmdutil.Factory, streams genericclioptions.IOStreams) *c
|
|||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "list all visible plugin executables on a user's PATH",
|
||||
Short: i18n.T("list all visible plugin executables on a user's PATH"),
|
||||
Long: pluginListLong,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(cmd))
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
rolloutLong = templates.LongDesc(`
|
||||
Manage the rollout of a resource.` + rolloutValidResources)
|
||||
rolloutLong = templates.LongDesc(i18n.T(`
|
||||
Manage the rollout of a resource.`) + rolloutValidResources)
|
||||
|
||||
rolloutExample = templates.Examples(`
|
||||
# Rollback to the previous deployment
|
||||
|
|
|
@ -32,8 +32,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
historyLong = templates.LongDesc(`
|
||||
View previous rollout revisions and configurations.`)
|
||||
historyLong = templates.LongDesc(i18n.T(`
|
||||
View previous rollout revisions and configurations.`))
|
||||
|
||||
historyExample = templates.Examples(`
|
||||
# View the rollout history of a deployment
|
||||
|
|
|
@ -53,12 +53,12 @@ type PauseOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
pauseLong = templates.LongDesc(`
|
||||
pauseLong = templates.LongDesc(i18n.T(`
|
||||
Mark the provided resource as paused
|
||||
|
||||
Paused resources will not be reconciled by a controller.
|
||||
Use "kubectl rollout resume" to resume a paused resource.
|
||||
Currently only deployments support being paused.`)
|
||||
Currently only deployments support being paused.`))
|
||||
|
||||
pauseExample = templates.Examples(`
|
||||
# Mark the nginx deployment as paused. Any current state of
|
||||
|
|
|
@ -53,10 +53,10 @@ type RestartOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
restartLong = templates.LongDesc(`
|
||||
restartLong = templates.LongDesc(i18n.T(`
|
||||
Restart a resource.
|
||||
|
||||
Resource will be rollout restarted.`)
|
||||
Resource will be rollout restarted.`))
|
||||
|
||||
restartExample = templates.Examples(`
|
||||
# Restart a deployment
|
||||
|
|
|
@ -54,12 +54,12 @@ type ResumeOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
resumeLong = templates.LongDesc(`
|
||||
resumeLong = templates.LongDesc(i18n.T(`
|
||||
Resume a paused resource
|
||||
|
||||
Paused resources will not be reconciled by a controller. By resuming a
|
||||
resource, we allow it to be reconciled again.
|
||||
Currently only deployments support being resumed.`)
|
||||
Currently only deployments support being resumed.`))
|
||||
|
||||
resumeExample = templates.Examples(`
|
||||
# Resume an already paused deployment
|
||||
|
|
|
@ -43,7 +43,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
statusLong = templates.LongDesc(`
|
||||
statusLong = templates.LongDesc(i18n.T(`
|
||||
Show the status of the rollout.
|
||||
|
||||
By default 'rollout status' will watch the status of the latest rollout
|
||||
|
@ -51,7 +51,7 @@ var (
|
|||
you can use --watch=false. Note that if a new rollout starts in-between, then
|
||||
'rollout status' will continue watching the latest revision. If you want to
|
||||
pin to a specific revision and abort if it is rolled over by another revision,
|
||||
use --revision=N where N is the revision you need to watch for.`)
|
||||
use --revision=N where N is the revision you need to watch for.`))
|
||||
|
||||
statusExample = templates.Examples(`
|
||||
# Watch the rollout status of a deployment
|
||||
|
|
|
@ -51,8 +51,8 @@ type UndoOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
undoLong = templates.LongDesc(`
|
||||
Rollback to a previous rollout.`)
|
||||
undoLong = templates.LongDesc(i18n.T(`
|
||||
Rollback to a previous rollout.`))
|
||||
|
||||
undoExample = templates.Examples(`
|
||||
# Rollback to the previous deployment
|
||||
|
|
|
@ -25,10 +25,10 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
setLong = templates.LongDesc(`
|
||||
setLong = templates.LongDesc(i18n.T(`
|
||||
Configure application resources
|
||||
|
||||
These commands help you make changes to existing application resources.`)
|
||||
These commands help you make changes to existing application resources.`))
|
||||
)
|
||||
|
||||
// NewCmdSet returns an initialized Command instance for 'set' sub command
|
||||
|
|
|
@ -38,6 +38,7 @@ import (
|
|||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/polymorphichelpers"
|
||||
"k8s.io/kubectl/pkg/scheme"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
|
@ -46,7 +47,7 @@ var (
|
|||
envResources = `
|
||||
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)`
|
||||
|
||||
envLong = templates.LongDesc(`
|
||||
envLong = templates.LongDesc(i18n.T(`
|
||||
Update environment variables on a pod template.
|
||||
|
||||
List environment variable definitions in one or more pods, pod templates.
|
||||
|
@ -59,7 +60,7 @@ var (
|
|||
syntax.
|
||||
|
||||
Possible resources include (case insensitive):
|
||||
` + envResources)
|
||||
`) + envResources)
|
||||
|
||||
envExample = templates.Examples(`
|
||||
# Update deployment 'registry' with a new environment variable
|
||||
|
@ -150,7 +151,7 @@ func NewCmdEnv(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Co
|
|||
cmd := &cobra.Command{
|
||||
Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N",
|
||||
DisableFlagsInUseLine: true,
|
||||
Short: "Update environment variables on a pod template",
|
||||
Short: i18n.T("Update environment variables on a pod template"),
|
||||
Long: envLong,
|
||||
Example: envExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
|
|
@ -65,14 +65,14 @@ type SetImageOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
imageResources = `
|
||||
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)`
|
||||
imageResources = i18n.T(`
|
||||
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)`)
|
||||
|
||||
imageLong = templates.LongDesc(`
|
||||
imageLong = templates.LongDesc(i18n.T(`
|
||||
Update existing container image(s) of resources.
|
||||
|
||||
Possible resources include (case insensitive):
|
||||
` + imageResources)
|
||||
`) + imageResources)
|
||||
|
||||
imageExample = templates.Examples(`
|
||||
# Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
|
||||
|
|
|
@ -38,12 +38,12 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
resourcesLong = templates.LongDesc(`
|
||||
resourcesLong = templates.LongDesc(i18n.T(`
|
||||
Specify compute resource requirements (cpu, memory) for any resource that defines a pod template. If a pod is successfully scheduled, it is guaranteed the amount of resource requested, but may burst up to its specified limits.
|
||||
|
||||
for each compute resource, if a limit is specified and a request is omitted, the request will default to the limit.
|
||||
|
||||
Possible resources include (case insensitive): %s.`)
|
||||
Possible resources include (case insensitive): %s.`))
|
||||
|
||||
resourcesExample = templates.Examples(`
|
||||
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
|
||||
|
|
|
@ -64,13 +64,13 @@ type SetSelectorOptions struct {
|
|||
}
|
||||
|
||||
var (
|
||||
selectorLong = templates.LongDesc(`
|
||||
selectorLong = templates.LongDesc(i18n.T(`
|
||||
Set the selector on a resource. Note that the new selector will overwrite the old selector if the resource had one prior to the invocation
|
||||
of 'set selector'.
|
||||
|
||||
A selector must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores, up to %[1]d characters.
|
||||
If --resource-version is specified, then updates will use this resource version, otherwise the existing resource-version will be used.
|
||||
Note: currently selectors can only be set on Service objects.`)
|
||||
Note: currently selectors can only be set on Service objects.`))
|
||||
selectorExample = templates.Examples(`
|
||||
# set the labels and selector before creating a deployment/service pair.
|
||||
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
|
||||
|
|
|
@ -37,8 +37,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
subjectLong = templates.LongDesc(`
|
||||
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`)
|
||||
subjectLong = templates.LongDesc(i18n.T(`
|
||||
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`))
|
||||
|
||||
subjectExample = templates.Examples(`
|
||||
# Update a ClusterRoleBinding for serviceaccount1
|
||||
|
|
|
@ -71,7 +71,7 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
|
|||
cmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: i18n.T("Print the client and server version information"),
|
||||
Long: "Print the client and server version information for the current context",
|
||||
Long: i18n.T("Print the client and server version information for the current context"),
|
||||
Example: versionExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
cmdutil.CheckErr(o.Complete(f, cmd))
|
||||
|
|
|
@ -41,11 +41,12 @@ import (
|
|||
"k8s.io/client-go/dynamic"
|
||||
watchtools "k8s.io/client-go/tools/watch"
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
)
|
||||
|
||||
var (
|
||||
waitLong = templates.LongDesc(`
|
||||
waitLong = templates.LongDesc(i18n.T(`
|
||||
Experimental: Wait for a specific condition on one or many resources.
|
||||
|
||||
The command takes multiple resources and waits until the specified condition
|
||||
|
@ -55,7 +56,7 @@ var (
|
|||
by providing the "delete" keyword as the value to the --for flag.
|
||||
|
||||
A successful message will be printed to stdout indicating when the specified
|
||||
condition has been met. One can use -o option to change to output destination.`)
|
||||
condition has been met. One can use -o option to change to output destination.`))
|
||||
|
||||
waitExample = templates.Examples(`
|
||||
# Wait for the pod "busybox1" to contain the status condition of type "Ready".
|
||||
|
@ -108,7 +109,7 @@ func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams gen
|
|||
|
||||
cmd := &cobra.Command{
|
||||
Use: "wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available]",
|
||||
Short: "Experimental: Wait for a specific condition on one or many resources.",
|
||||
Short: i18n.T("Experimental: Wait for a specific condition on one or many resources."),
|
||||
Long: waitLong,
|
||||
Example: waitExample,
|
||||
|
||||
|
|
Loading…
Reference in New Issue