mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Use dedent for the kubectl commands
The one side effect is that for the "kubectl help" commands a newline is prepended to output, which will alter the yaml output. Here we use dedent to format the code to match the output. hack/update-generated-docs.sh has been run and the affected files have been added. Note: for describe.go we added a period to the end of an output message.
This commit is contained in:
@@ -19,17 +19,21 @@ package rollout
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"github.com/spf13/cobra"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
)
|
||||
|
||||
const (
|
||||
rollout_long = `Manages a deployment using subcommands like "kubectl rollout undo deployment/abc"`
|
||||
rollout_example = `# Rollback to the previous deployment
|
||||
kubectl rollout undo deployment/abc`
|
||||
rollout_valid_resources = `Valid resource types include:
|
||||
* deployments
|
||||
`
|
||||
var (
|
||||
rollout_long = dedent.Dedent(`
|
||||
Manages a deployment using subcommands like "kubectl rollout undo deployment/abc"`)
|
||||
rollout_example = dedent.Dedent(`
|
||||
# Rollback to the previous deployment
|
||||
kubectl rollout undo deployment/abc`)
|
||||
rollout_valid_resources = dedent.Dedent(`
|
||||
Valid resource types include:
|
||||
* deployments
|
||||
`)
|
||||
)
|
||||
|
||||
func NewCmdRollout(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
@@ -34,13 +35,15 @@ type HistoryOptions struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
history_long = `View previous rollout revisions and configurations.`
|
||||
history_example = `# View the rollout history of a deployment
|
||||
kubectl rollout history deployment/abc
|
||||
var (
|
||||
history_long = dedent.Dedent(`
|
||||
View previous rollout revisions and configurations.`)
|
||||
history_example = dedent.Dedent(`
|
||||
# View the rollout history of a deployment
|
||||
kubectl rollout history deployment/abc
|
||||
|
||||
# View the details of deployment revision 3
|
||||
kubectl rollout history deployment/abc --revision=3`
|
||||
# View the details of deployment revision 3
|
||||
kubectl rollout history deployment/abc --revision=3`)
|
||||
)
|
||||
|
||||
func NewCmdRolloutHistory(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
@@ -19,6 +19,7 @@ package rollout
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/meta"
|
||||
@@ -42,17 +43,19 @@ type PauseConfig struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
pause_long = `Mark the provided resource as paused
|
||||
var (
|
||||
pause_long = dedent.Dedent(`
|
||||
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.`
|
||||
Paused resources will not be reconciled by a controller.
|
||||
Use \"kubectl rollout resume\" to resume a paused resource.
|
||||
Currently only deployments support being paused.`)
|
||||
|
||||
pause_example = `# Mark the nginx deployment as paused. Any current state of
|
||||
# the deployment will continue its function, new updates to the deployment will not
|
||||
# have an effect as long as the deployment is paused.
|
||||
kubectl rollout pause deployment/nginx`
|
||||
pause_example = dedent.Dedent(`
|
||||
# Mark the nginx deployment as paused. Any current state of
|
||||
# the deployment will continue its function, new updates to the deployment will not
|
||||
# have an effect as long as the deployment is paused.
|
||||
kubectl rollout pause deployment/nginx`)
|
||||
)
|
||||
|
||||
func NewCmdRolloutPause(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
@@ -19,6 +19,7 @@ package rollout
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/meta"
|
||||
@@ -42,15 +43,17 @@ type ResumeConfig struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
resume_long = `Resume a paused resource
|
||||
var (
|
||||
resume_long = dedent.Dedent(`
|
||||
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.`
|
||||
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.`)
|
||||
|
||||
resume_example = `# Resume an already paused deployment
|
||||
kubectl rollout resume deployment/nginx`
|
||||
resume_example = dedent.Dedent(`
|
||||
# Resume an already paused deployment
|
||||
kubectl rollout resume deployment/nginx`)
|
||||
)
|
||||
|
||||
func NewCmdRolloutResume(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
@@ -35,10 +36,12 @@ type StatusOptions struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
status_long = `Watch the status of current rollout, until it's done.`
|
||||
status_example = `# Watch the rollout status of a deployment
|
||||
kubectl rollout status deployment/nginx`
|
||||
var (
|
||||
status_long = dedent.Dedent(`
|
||||
Watch the status of current rollout, until it's done.`)
|
||||
status_example = dedent.Dedent(`
|
||||
# Watch the rollout status of a deployment
|
||||
kubectl rollout status deployment/nginx`)
|
||||
)
|
||||
|
||||
func NewCmdRolloutStatus(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
@@ -19,6 +19,7 @@ package rollout
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/renstrom/dedent"
|
||||
"k8s.io/kubernetes/pkg/api/meta"
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
@@ -43,13 +44,15 @@ type UndoOptions struct {
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
undo_long = `Rollback to a previous rollout.`
|
||||
undo_example = `# Rollback to the previous deployment
|
||||
kubectl rollout undo deployment/abc
|
||||
var (
|
||||
undo_long = dedent.Dedent(`
|
||||
Rollback to a previous rollout.`)
|
||||
undo_example = dedent.Dedent(`
|
||||
# Rollback to the previous deployment
|
||||
kubectl rollout undo deployment/abc
|
||||
|
||||
# Rollback to deployment revision 3
|
||||
kubectl rollout undo deployment/abc --to-revision=3`
|
||||
# Rollback to deployment revision 3
|
||||
kubectl rollout undo deployment/abc --to-revision=3`)
|
||||
)
|
||||
|
||||
func NewCmdRolloutUndo(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
|
||||
Reference in New Issue
Block a user