Skip to content

Commit

Permalink
Merge pull request #6729 from kargakis/prune-deployments-desc-enhance…
Browse files Browse the repository at this point in the history
…ment

Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Jan 21, 2016
2 parents cc9178d + eefad09 commit 2670ca0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
16 changes: 16 additions & 0 deletions docs/generated/oadm_by_example_content.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,22 @@ Replace cluster SCCs to match the recommended bootstrap policy
====


== oadm prune deployments
Remove old completed and failed deployments

====
[options="nowrap"]
----
# Dry run deleting all but the last complete deployment for every deployment config
$ oadm prune deployments --keep-complete=1
# To actually perform the prune operation, the confirm flag must be appended
$ oadm prune deployments --keep-complete=1 --confirm
----
====


== oadm prune images
Remove unreferenced images

Expand Down
25 changes: 19 additions & 6 deletions pkg/cmd/admin/prune/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,22 @@ import (
deployutil "github.com/openshift/origin/pkg/deploy/util"
)

const deploymentsLongDesc = `%s %s - Remove older completed and failed deployments`

const PruneDeploymentsRecommendedName = "deployments"

const (
deploymentsLongDesc = `Prune old completed and failed deployments
By default, the prune operation performs a dry run making no changes to the deployments.
A --confirm flag is needed for changes to be effective.
`

deploymentsExample = ` # Dry run deleting all but the last complete deployment for every deployment config
$ %[1]s %[2]s --keep-complete=1
# To actually perform the prune operation, the confirm flag must be appended
$ %[1]s %[2]s --keep-complete=1 --confirm`
)

type pruneDeploymentConfig struct {
Confirm bool
KeepYoungerThan time.Duration
Expand All @@ -42,10 +54,11 @@ func NewCmdPruneDeployments(f *clientcmd.Factory, parentName, name string, out i
}

cmd := &cobra.Command{
Use: name,
Short: "Remove completed and failed deployments",
Long: fmt.Sprintf(deploymentsLongDesc, parentName, name),

Use: name,
Short: "Remove old completed and failed deployments",
Long: deploymentsLongDesc,
Example: fmt.Sprintf(deploymentsExample, parentName, name),
SuggestFor: []string{"deployment", "deployments"},
Run: func(cmd *cobra.Command, args []string) {
if len(args) > 0 {
glog.Fatalf("No arguments are allowed to this command")
Expand Down

0 comments on commit 2670ca0

Please sign in to comment.