mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
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
This commit is contained in:
parent
e0a51c9e6b
commit
cc8428566e
@ -78,7 +78,7 @@ type AnnotateOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
annotateLong = templates.LongDesc(`
|
annotateLong = templates.LongDesc(i18n.T(`
|
||||||
Update the annotations on one or more resources
|
Update the annotations on one or more resources
|
||||||
|
|
||||||
All Kubernetes objects support the ability to store additional data with the object as
|
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.
|
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
|
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(`
|
annotateExample = templates.Examples(i18n.T(`
|
||||||
# Update pod 'foo' with the annotation 'description' and the value 'my frontend'.
|
# 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/genericclioptions"
|
||||||
"k8s.io/cli-runtime/pkg/printers"
|
"k8s.io/cli-runtime/pkg/printers"
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -90,8 +91,8 @@ func NewCmdAPIResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
|
|||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "api-resources",
|
Use: "api-resources",
|
||||||
Short: "Print the supported API resources on the server",
|
Short: i18n.T("Print the supported API resources on the server"),
|
||||||
Long: "Print the supported API resources on the server",
|
Long: i18n.T("Print the supported API resources on the server"),
|
||||||
Example: apiresourcesExample,
|
Example: apiresourcesExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(cmd, args))
|
cmdutil.CheckErr(o.Complete(cmd, args))
|
||||||
|
@ -55,8 +55,8 @@ func NewCmdAPIVersions(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||||||
o := NewAPIVersionsOptions(ioStreams)
|
o := NewAPIVersionsOptions(ioStreams)
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "api-versions",
|
Use: "api-versions",
|
||||||
Short: "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: "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,
|
Example: apiversionsExample,
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
@ -22,11 +22,12 @@ import (
|
|||||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
"k8s.io/kubectl/pkg/cmd/util/editor"
|
"k8s.io/kubectl/pkg/cmd/util/editor"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
applyEditLastAppliedLong = templates.LongDesc(`
|
applyEditLastAppliedLong = templates.LongDesc(i18n.T(`
|
||||||
Edit the latest last-applied-configuration annotations of resources from the default editor.
|
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
|
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
|
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
|
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
|
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(`
|
applyEditLastAppliedExample = templates.Examples(`
|
||||||
# Edit the last-applied-configuration annotations by type/name in YAML.
|
# 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{
|
cmd := &cobra.Command{
|
||||||
Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)",
|
Use: "edit-last-applied (RESOURCE/NAME | -f FILENAME)",
|
||||||
DisableFlagsInUseLine: true,
|
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,
|
Long: applyEditLastAppliedLong,
|
||||||
Example: applyEditLastAppliedExample,
|
Example: applyEditLastAppliedExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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",
|
Use: "attach (POD | TYPE/NAME) -c CONTAINER",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Attach to a running container"),
|
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,
|
Example: attachExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||||
|
@ -46,7 +46,7 @@ func NewCmdCertificate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
|
|||||||
Use: "certificate SUBCOMMAND",
|
Use: "certificate SUBCOMMAND",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Modify certificate resources."),
|
Short: i18n.T("Modify certificate resources."),
|
||||||
Long: "Modify certificate resources.",
|
Long: i18n.T("Modify certificate resources."),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmd.Help()
|
cmd.Help()
|
||||||
},
|
},
|
||||||
@ -118,7 +118,7 @@ func NewCmdCertificateApprove(f cmdutil.Factory, ioStreams genericclioptions.IOS
|
|||||||
Use: "approve (-f FILENAME | NAME)",
|
Use: "approve (-f FILENAME | NAME)",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Approve a certificate signing request"),
|
Short: i18n.T("Approve a certificate signing request"),
|
||||||
Long: templates.LongDesc(`
|
Long: templates.LongDesc(i18n.T(`
|
||||||
Approve a certificate signing request.
|
Approve a certificate signing request.
|
||||||
|
|
||||||
kubectl certificate approve allows a cluster admin to approve a certificate
|
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
|
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
|
as a requested identity. Before approving a CSR, ensure you understand what the
|
||||||
signed certificate can do.
|
signed certificate can do.
|
||||||
`),
|
`)),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
@ -161,13 +161,13 @@ func NewCmdCertificateDeny(f cmdutil.Factory, ioStreams genericclioptions.IOStre
|
|||||||
Use: "deny (-f FILENAME | NAME)",
|
Use: "deny (-f FILENAME | NAME)",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Deny a certificate signing request"),
|
Short: i18n.T("Deny a certificate signing request"),
|
||||||
Long: templates.LongDesc(`
|
Long: templates.LongDesc(i18n.T(`
|
||||||
Deny a certificate signing request.
|
Deny a certificate signing request.
|
||||||
|
|
||||||
kubectl certificate deny allows a cluster admin to deny a certificate
|
kubectl certificate deny allows a cluster admin to deny a certificate
|
||||||
signing request (CSR). This action tells a certificate signing controller to
|
signing request (CSR). This action tells a certificate signing controller to
|
||||||
not to issue a certificate to the requestor.
|
not to issue a certificate to the requestor.
|
||||||
`),
|
`)),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||||
cmdutil.CheckErr(o.Validate())
|
cmdutil.CheckErr(o.Validate())
|
||||||
|
@ -40,14 +40,14 @@ func NewCmdConfig(f cmdutil.Factory, pathOptions *clientcmd.PathOptions, streams
|
|||||||
Use: "config SUBCOMMAND",
|
Use: "config SUBCOMMAND",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Modify kubeconfig files"),
|
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"
|
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"
|
||||||
|
|
||||||
The loading order follows these rules:
|
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.
|
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 + ` 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.
|
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) + ` is used and no merging takes place.`),
|
3. Otherwise, `) + path.Join("${HOME}", pathOptions.GlobalFileSubpath) + i18n.T(` is used and no merging takes place.`)),
|
||||||
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
createAuthInfoLong = fmt.Sprintf(templates.LongDesc(`
|
createAuthInfoLong = fmt.Sprintf(templates.LongDesc(i18n.T(`
|
||||||
Sets a user entry in kubeconfig
|
Sets a user entry in kubeconfig
|
||||||
|
|
||||||
Specifying a name that already exists will merge new fields on top of existing values.
|
Specifying a name that already exists will merge new fields on top of existing values.
|
||||||
@ -81,7 +81,7 @@ var (
|
|||||||
Basic auth flags:
|
Basic auth flags:
|
||||||
--%v=basic_user --%v=basic_password
|
--%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(`
|
createAuthInfoExample = templates.Examples(`
|
||||||
# Set only the "client-key" field on the "cluster-admin"
|
# Set only the "client-key" field on the "cluster-admin"
|
||||||
|
@ -44,10 +44,10 @@ type createClusterOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
createClusterLong = templates.LongDesc(`
|
createClusterLong = templates.LongDesc(i18n.T(`
|
||||||
Sets a cluster entry in kubeconfig.
|
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(`
|
createClusterExample = templates.Examples(`
|
||||||
# Set only the server field on the e2e cluster entry without touching other values.
|
# Set only the server field on the e2e cluster entry without touching other values.
|
||||||
|
@ -41,10 +41,10 @@ type createContextOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
createContextLong = templates.LongDesc(`
|
createContextLong = templates.LongDesc(i18n.T(`
|
||||||
Sets a context entry in kubeconfig
|
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(`
|
createContextExample = templates.Examples(`
|
||||||
# Set the user field on the gce context entry without touching other values
|
# Set the user field on the gce context entry without touching other values
|
||||||
|
@ -34,8 +34,8 @@ type CurrentContextOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
currentContextLong = templates.LongDesc(`
|
currentContextLong = templates.LongDesc(i18n.T(`
|
||||||
Displays the current-context`)
|
Displays the current-context`))
|
||||||
|
|
||||||
currentContextExample = templates.Examples(`
|
currentContextExample = templates.Examples(`
|
||||||
# Display the current-context
|
# Display the current-context
|
||||||
|
@ -39,7 +39,7 @@ func NewCmdConfigDeleteCluster(out io.Writer, configAccess clientcmd.ConfigAcces
|
|||||||
Use: "delete-cluster NAME",
|
Use: "delete-cluster NAME",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Delete the specified cluster from the kubeconfig"),
|
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,
|
Example: deleteClusterExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(runDeleteCluster(out, configAccess, cmd))
|
cmdutil.CheckErr(runDeleteCluster(out, configAccess, cmd))
|
||||||
|
@ -39,7 +39,7 @@ func NewCmdConfigDeleteContext(out, errOut io.Writer, configAccess clientcmd.Con
|
|||||||
Use: "delete-context NAME",
|
Use: "delete-context NAME",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Delete the specified context from the kubeconfig"),
|
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,
|
Example: deleteContextExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(runDeleteContext(out, errOut, configAccess, cmd))
|
cmdutil.CheckErr(runDeleteContext(out, errOut, configAccess, cmd))
|
||||||
|
@ -62,7 +62,7 @@ func NewCmdConfigDeleteUser(streams genericclioptions.IOStreams, configAccess cl
|
|||||||
Use: "delete-user NAME",
|
Use: "delete-user NAME",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Delete the specified user from the kubeconfig"),
|
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,
|
Example: deleteUserExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(cmd, args))
|
cmdutil.CheckErr(o.Complete(cmd, args))
|
||||||
|
@ -39,7 +39,7 @@ func NewCmdConfigGetClusters(out io.Writer, configAccess clientcmd.ConfigAccess)
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "get-clusters",
|
Use: "get-clusters",
|
||||||
Short: i18n.T("Display clusters defined in the kubeconfig"),
|
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,
|
Example: getClustersExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(runGetClusters(out, configAccess))
|
cmdutil.CheckErr(runGetClusters(out, configAccess))
|
||||||
|
@ -47,7 +47,7 @@ type GetContextsOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
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(`
|
getContextsExample = templates.Examples(`
|
||||||
# List all the contexts in your kubeconfig file
|
# List all the contexts in your kubeconfig file
|
||||||
|
@ -58,7 +58,7 @@ func NewCmdConfigGetUsers(streams genericclioptions.IOStreams, configAccess clie
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "get-users",
|
Use: "get-users",
|
||||||
Short: i18n.T("Display users defined in the kubeconfig"),
|
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,
|
Example: getUsersExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Run())
|
cmdutil.CheckErr(o.Run())
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,19 +38,19 @@ type RenameContextOptions struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
renameContextUse = "rename-context CONTEXT_NAME NEW_NAME"
|
renameContextUse = "rename-context CONTEXT_NAME NEW_NAME"
|
||||||
|
|
||||||
renameContextShort = "Renames a context from the kubeconfig file."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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.
|
Renames a context from the kubeconfig file.
|
||||||
|
|
||||||
CONTEXT_NAME is the context name that you wish to change.
|
CONTEXT_NAME is the context name that you wish to change.
|
||||||
|
|
||||||
NEW_NAME is the new name you wish to set.
|
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(`
|
renameContextExample = templates.Examples(`
|
||||||
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
|
# Rename the context 'old-name' to 'new-name' in your kubeconfig file
|
||||||
|
@ -41,14 +41,14 @@ type setOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
setLong = templates.LongDesc(`
|
setLong = templates.LongDesc(i18n.T(`
|
||||||
Sets an individual value in a kubeconfig file
|
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_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.
|
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(`
|
setExample = templates.Examples(`
|
||||||
# Set server field on the my-cluster cluster to https://1.2.3.4
|
# Set server field on the my-cluster cluster to https://1.2.3.4
|
||||||
|
@ -36,10 +36,10 @@ type unsetOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
unsetLong = templates.LongDesc(`
|
unsetLong = templates.LongDesc(i18n.T(`
|
||||||
Unsets an individual value in a kubeconfig file
|
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(`
|
unsetExample = templates.Examples(`
|
||||||
# Unset the current-context.
|
# Unset the current-context.
|
||||||
|
@ -51,10 +51,10 @@ type ViewOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
viewLong = templates.LongDesc(`
|
viewLong = templates.LongDesc(i18n.T(`
|
||||||
Display merged kubeconfig settings or a specified kubeconfig file.
|
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(`
|
viewExample = templates.Examples(`
|
||||||
# Show merged kubeconfig settings.
|
# 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>",
|
Use: "cp <file-spec-src> <file-spec-dest>",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Copy files and directories to and from containers."),
|
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,
|
Example: cpExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd))
|
cmdutil.CheckErr(o.Complete(f, cmd))
|
||||||
|
@ -33,12 +33,13 @@ import (
|
|||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
"k8s.io/kubectl/pkg/scheme"
|
"k8s.io/kubectl/pkg/scheme"
|
||||||
"k8s.io/kubectl/pkg/util"
|
"k8s.io/kubectl/pkg/util"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cronjobLong = templates.LongDesc(`
|
cronjobLong = templates.LongDesc(i18n.T(`
|
||||||
Create a cronjob with the specified name.`)
|
Create a cronjob with the specified name.`))
|
||||||
|
|
||||||
cronjobExample = templates.Examples(`
|
cronjobExample = templates.Examples(`
|
||||||
# Create a cronjob
|
# Create a cronjob
|
||||||
|
@ -32,7 +32,7 @@ func NewCmdCreateSecret(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "secret",
|
Use: "secret",
|
||||||
Short: i18n.T("Create a secret using specified subcommand"),
|
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),
|
Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut),
|
||||||
}
|
}
|
||||||
cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, ioStreams))
|
cmd.AddCommand(NewCmdCreateSecretDockerRegistry(f, ioStreams))
|
||||||
|
@ -34,7 +34,7 @@ func NewCmdCreateService(f cmdutil.Factory, ioStreams genericclioptions.IOStream
|
|||||||
Use: "service",
|
Use: "service",
|
||||||
Aliases: []string{"svc"},
|
Aliases: []string{"svc"},
|
||||||
Short: i18n.T("Create a service using specified subcommand."),
|
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),
|
Run: cmdutil.DefaultSubCommandRun(ioStreams.ErrOut),
|
||||||
}
|
}
|
||||||
cmd.AddCommand(NewCmdCreateServiceClusterIP(f, ioStreams))
|
cmd.AddCommand(NewCmdCreateServiceClusterIP(f, ioStreams))
|
||||||
|
@ -35,7 +35,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
describeLong = templates.LongDesc(`
|
describeLong = templates.LongDesc(i18n.T(`
|
||||||
Show details of a specific resource or group of resources
|
Show details of a specific resource or group of resources
|
||||||
|
|
||||||
Print a detailed description of the selected resources, including related resources such
|
Print a detailed description of the selected resources, including related resources such
|
||||||
@ -45,7 +45,7 @@ var (
|
|||||||
$ kubectl describe TYPE NAME_PREFIX
|
$ kubectl describe TYPE NAME_PREFIX
|
||||||
|
|
||||||
will first check for an exact match on TYPE and NAME_PREFIX. If no such resource
|
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(`
|
describeExample = templates.Examples(i18n.T(`
|
||||||
# Describe a node
|
# 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...]",
|
Use: "exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Execute a command in a container"),
|
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,
|
Example: execExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
argsLenAtDash := cmd.ArgsLenAtDash()
|
argsLenAtDash := cmd.ArgsLenAtDash()
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
explainLong = templates.LongDesc(`
|
explainLong = templates.LongDesc(i18n.T(`
|
||||||
List the fields for supported resources
|
List the fields for supported resources
|
||||||
|
|
||||||
This command describes the fields associated with each supported API resource.
|
This command describes the fields associated with each supported API resource.
|
||||||
@ -41,7 +41,7 @@ var (
|
|||||||
<type>.<fieldName>[.<fieldName>]
|
<type>.<fieldName>[.<fieldName>]
|
||||||
|
|
||||||
Add the --recursive flag to display all of the fields at once without descriptions.
|
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(`
|
explainExamples = templates.Examples(i18n.T(`
|
||||||
# Get the documentation of the resource and its fields
|
# Get the documentation of the resource and its fields
|
||||||
|
@ -42,9 +42,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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.
|
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
|
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):
|
Possible resources include (case insensitive):
|
||||||
|
|
||||||
` + exposeResources)
|
`) + exposeResources)
|
||||||
|
|
||||||
exposeExample = templates.Examples(i18n.T(`
|
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.
|
# 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 (
|
var (
|
||||||
getLong = templates.LongDesc(`
|
getLong = templates.LongDesc(i18n.T(`
|
||||||
Display one or many resources
|
Display one or many resources
|
||||||
|
|
||||||
Prints a table of the most important information about the specified 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.
|
Uninitialized objects are not shown unless --include-uninitialized is passed.
|
||||||
|
|
||||||
By specifying the output as 'template' and providing a Go template as the value
|
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(`
|
getExample = templates.Examples(i18n.T(`
|
||||||
# List all pods in ps output format.
|
# List all pods in ps output format.
|
||||||
|
@ -146,7 +146,7 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
|
|||||||
Use: logsUsageStr,
|
Use: logsUsageStr,
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: i18n.T("Print the logs for a container in a pod"),
|
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,
|
Example: logsExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
cmdutil.CheckErr(o.Complete(f, cmd, args))
|
||||||
|
@ -36,7 +36,7 @@ func NewCmdOptions(out io.Writer) *cobra.Command {
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "options",
|
Use: "options",
|
||||||
Short: i18n.T("Print the list of flags inherited by all commands"),
|
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,
|
Example: optionsExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmd.Usage()
|
cmd.Usage()
|
||||||
|
@ -34,23 +34,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pluginLong = templates.LongDesc(`
|
pluginLong = templates.LongDesc(i18n.T(`
|
||||||
Provides utilities for interacting with plugins.
|
Provides utilities for interacting with plugins.
|
||||||
|
|
||||||
Plugins provide extended functionality that is not part of the major command-line distribution.
|
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.
|
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.
|
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.
|
List all available plugin files on a user's PATH.
|
||||||
|
|
||||||
Available plugin files are those that are:
|
Available plugin files are those that are:
|
||||||
- executable
|
- executable
|
||||||
- anywhere on the user's PATH
|
- anywhere on the user's PATH
|
||||||
- begin with "kubectl-"
|
- begin with "kubectl-"
|
||||||
`)
|
`))
|
||||||
|
|
||||||
ValidPluginFilenamePrefixes = []string{"kubectl"}
|
ValidPluginFilenamePrefixes = []string{"kubectl"}
|
||||||
)
|
)
|
||||||
@ -87,7 +87,7 @@ func NewCmdPluginList(f cmdutil.Factory, streams genericclioptions.IOStreams) *c
|
|||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "list",
|
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,
|
Long: pluginListLong,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(cmd))
|
cmdutil.CheckErr(o.Complete(cmd))
|
||||||
|
@ -27,8 +27,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
rolloutLong = templates.LongDesc(`
|
rolloutLong = templates.LongDesc(i18n.T(`
|
||||||
Manage the rollout of a resource.` + rolloutValidResources)
|
Manage the rollout of a resource.`) + rolloutValidResources)
|
||||||
|
|
||||||
rolloutExample = templates.Examples(`
|
rolloutExample = templates.Examples(`
|
||||||
# Rollback to the previous deployment
|
# Rollback to the previous deployment
|
||||||
|
@ -32,8 +32,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
historyLong = templates.LongDesc(`
|
historyLong = templates.LongDesc(i18n.T(`
|
||||||
View previous rollout revisions and configurations.`)
|
View previous rollout revisions and configurations.`))
|
||||||
|
|
||||||
historyExample = templates.Examples(`
|
historyExample = templates.Examples(`
|
||||||
# View the rollout history of a deployment
|
# View the rollout history of a deployment
|
||||||
|
@ -53,12 +53,12 @@ type PauseOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pauseLong = templates.LongDesc(`
|
pauseLong = templates.LongDesc(i18n.T(`
|
||||||
Mark the provided resource as paused
|
Mark the provided resource as paused
|
||||||
|
|
||||||
Paused resources will not be reconciled by a controller.
|
Paused resources will not be reconciled by a controller.
|
||||||
Use "kubectl rollout resume" to resume a paused resource.
|
Use "kubectl rollout resume" to resume a paused resource.
|
||||||
Currently only deployments support being paused.`)
|
Currently only deployments support being paused.`))
|
||||||
|
|
||||||
pauseExample = templates.Examples(`
|
pauseExample = templates.Examples(`
|
||||||
# Mark the nginx deployment as paused. Any current state of
|
# Mark the nginx deployment as paused. Any current state of
|
||||||
|
@ -53,10 +53,10 @@ type RestartOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
restartLong = templates.LongDesc(`
|
restartLong = templates.LongDesc(i18n.T(`
|
||||||
Restart a resource.
|
Restart a resource.
|
||||||
|
|
||||||
Resource will be rollout restarted.`)
|
Resource will be rollout restarted.`))
|
||||||
|
|
||||||
restartExample = templates.Examples(`
|
restartExample = templates.Examples(`
|
||||||
# Restart a deployment
|
# Restart a deployment
|
||||||
|
@ -54,12 +54,12 @@ type ResumeOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
resumeLong = templates.LongDesc(`
|
resumeLong = templates.LongDesc(i18n.T(`
|
||||||
Resume a paused resource
|
Resume a paused resource
|
||||||
|
|
||||||
Paused resources will not be reconciled by a controller. By resuming a
|
Paused resources will not be reconciled by a controller. By resuming a
|
||||||
resource, we allow it to be reconciled again.
|
resource, we allow it to be reconciled again.
|
||||||
Currently only deployments support being resumed.`)
|
Currently only deployments support being resumed.`))
|
||||||
|
|
||||||
resumeExample = templates.Examples(`
|
resumeExample = templates.Examples(`
|
||||||
# Resume an already paused deployment
|
# Resume an already paused deployment
|
||||||
|
@ -43,7 +43,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
statusLong = templates.LongDesc(`
|
statusLong = templates.LongDesc(i18n.T(`
|
||||||
Show the status of the rollout.
|
Show the status of the rollout.
|
||||||
|
|
||||||
By default 'rollout status' will watch the status of the latest 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
|
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
|
'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,
|
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(`
|
statusExample = templates.Examples(`
|
||||||
# Watch the rollout status of a deployment
|
# Watch the rollout status of a deployment
|
||||||
|
@ -51,8 +51,8 @@ type UndoOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
undoLong = templates.LongDesc(`
|
undoLong = templates.LongDesc(i18n.T(`
|
||||||
Rollback to a previous rollout.`)
|
Rollback to a previous rollout.`))
|
||||||
|
|
||||||
undoExample = templates.Examples(`
|
undoExample = templates.Examples(`
|
||||||
# Rollback to the previous deployment
|
# Rollback to the previous deployment
|
||||||
|
@ -25,10 +25,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
setLong = templates.LongDesc(`
|
setLong = templates.LongDesc(i18n.T(`
|
||||||
Configure application resources
|
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
|
// NewCmdSet returns an initialized Command instance for 'set' sub command
|
||||||
|
@ -38,6 +38,7 @@ import (
|
|||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
"k8s.io/kubectl/pkg/polymorphichelpers"
|
"k8s.io/kubectl/pkg/polymorphichelpers"
|
||||||
"k8s.io/kubectl/pkg/scheme"
|
"k8s.io/kubectl/pkg/scheme"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ var (
|
|||||||
envResources = `
|
envResources = `
|
||||||
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs)`
|
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.
|
Update environment variables on a pod template.
|
||||||
|
|
||||||
List environment variable definitions in one or more pods, pod templates.
|
List environment variable definitions in one or more pods, pod templates.
|
||||||
@ -59,7 +60,7 @@ var (
|
|||||||
syntax.
|
syntax.
|
||||||
|
|
||||||
Possible resources include (case insensitive):
|
Possible resources include (case insensitive):
|
||||||
` + envResources)
|
`) + envResources)
|
||||||
|
|
||||||
envExample = templates.Examples(`
|
envExample = templates.Examples(`
|
||||||
# Update deployment 'registry' with a new environment variable
|
# 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{
|
cmd := &cobra.Command{
|
||||||
Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N",
|
Use: "env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N",
|
||||||
DisableFlagsInUseLine: true,
|
DisableFlagsInUseLine: true,
|
||||||
Short: "Update environment variables on a pod template",
|
Short: i18n.T("Update environment variables on a pod template"),
|
||||||
Long: envLong,
|
Long: envLong,
|
||||||
Example: envExample,
|
Example: envExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
@ -65,14 +65,14 @@ type SetImageOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
imageResources = `
|
imageResources = i18n.T(`
|
||||||
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), replicaset (rs)`
|
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.
|
Update existing container image(s) of resources.
|
||||||
|
|
||||||
Possible resources include (case insensitive):
|
Possible resources include (case insensitive):
|
||||||
` + imageResources)
|
`) + imageResources)
|
||||||
|
|
||||||
imageExample = templates.Examples(`
|
imageExample = templates.Examples(`
|
||||||
# Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
|
# 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 (
|
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.
|
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.
|
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(`
|
resourcesExample = templates.Examples(`
|
||||||
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
|
# Set a deployments nginx container cpu limits to "200m" and memory to "512Mi"
|
||||||
|
@ -64,13 +64,13 @@ type SetSelectorOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
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
|
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'.
|
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.
|
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.
|
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(`
|
selectorExample = templates.Examples(`
|
||||||
# set the labels and selector before creating a deployment/service pair.
|
# 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 -
|
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 (
|
var (
|
||||||
subjectLong = templates.LongDesc(`
|
subjectLong = templates.LongDesc(i18n.T(`
|
||||||
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`)
|
Update User, Group or ServiceAccount in a RoleBinding/ClusterRoleBinding.`))
|
||||||
|
|
||||||
subjectExample = templates.Examples(`
|
subjectExample = templates.Examples(`
|
||||||
# Update a ClusterRoleBinding for serviceaccount1
|
# Update a ClusterRoleBinding for serviceaccount1
|
||||||
|
@ -71,7 +71,7 @@ func NewCmdVersion(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *co
|
|||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: i18n.T("Print the client and server version information"),
|
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,
|
Example: versionExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cmdutil.CheckErr(o.Complete(f, cmd))
|
cmdutil.CheckErr(o.Complete(f, cmd))
|
||||||
|
@ -22,6 +22,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/watch:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/watch:go_default_library",
|
||||||
"//staging/src/k8s.io/kubectl/pkg/cmd/util:go_default_library",
|
"//staging/src/k8s.io/kubectl/pkg/cmd/util:go_default_library",
|
||||||
|
"//staging/src/k8s.io/kubectl/pkg/util/i18n:go_default_library",
|
||||||
"//staging/src/k8s.io/kubectl/pkg/util/templates:go_default_library",
|
"//staging/src/k8s.io/kubectl/pkg/util/templates:go_default_library",
|
||||||
"//vendor/github.com/spf13/cobra:go_default_library",
|
"//vendor/github.com/spf13/cobra:go_default_library",
|
||||||
],
|
],
|
||||||
|
@ -41,11 +41,12 @@ import (
|
|||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
watchtools "k8s.io/client-go/tools/watch"
|
watchtools "k8s.io/client-go/tools/watch"
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"k8s.io/kubectl/pkg/util/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
waitLong = templates.LongDesc(`
|
waitLong = templates.LongDesc(i18n.T(`
|
||||||
Experimental: Wait for a specific condition on one or many resources.
|
Experimental: Wait for a specific condition on one or many resources.
|
||||||
|
|
||||||
The command takes multiple resources and waits until the specified condition
|
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.
|
by providing the "delete" keyword as the value to the --for flag.
|
||||||
|
|
||||||
A successful message will be printed to stdout indicating when the specified
|
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(`
|
waitExample = templates.Examples(`
|
||||||
# Wait for the pod "busybox1" to contain the status condition of type "Ready".
|
# 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{
|
cmd := &cobra.Command{
|
||||||
Use: "wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available]",
|
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,
|
Long: waitLong,
|
||||||
Example: waitExample,
|
Example: waitExample,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user