Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add a kubectl stop command" #3717

Merged
merged 1 commit into from
Jan 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 0 additions & 44 deletions docs/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ Additional help topics:
kubectl rollingupdate Perform a rolling update of the given ReplicationController
kubectl resize Set a new size for a resizable resource (currently only Replication Controllers)
kubectl run-container Run a particular image on the cluster.
kubectl stop Gracefully shutdown a resource

Use "kubectl help [command]" for more information about that command.
```
Expand Down Expand Up @@ -934,46 +933,3 @@ Usage:

```

#### stop
Gracefully shutdown a resource

Attempts to shutdown and delete a resource that supports graceful termination.
If the resource is resizable it will be resized to 0 before deletion.

Examples:
$ kubectl stop replicationcontroller foo
foo stopped


Usage:
```
kubectl stop <resource> <id> [flags]

Available Flags:
--alsologtostderr=false: log to standard error as well as files
--api-version="": The API version to use when talking to the server
-a, --auth-path="": Path to the auth info file. If missing, prompt the user. Only used if using https.
--certificate-authority="": Path to a cert. file for the certificate authority.
--client-certificate="": Path to a client key file for TLS.
--client-key="": Path to a client key file for TLS.
--cluster="": The name of the kubeconfig cluster to use
--context="": The name of the kubeconfig context to use
--insecure-skip-tls-verify=false: If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
--kubeconfig="": Path to the kubeconfig file to use for CLI requests.
--log_backtrace_at=:0: when logging hits line file:N, emit a stack trace
--log_dir=: If non-empty, write log files in this directory
--log_flush_frequency=5s: Maximum number of seconds between log flushes
--logtostderr=true: log to standard error instead of files
--match-server-version=false: Require server version to match client version
-n, --namespace="": If present, the namespace scope for this CLI request.
--ns-path="/home/username/.kubernetes_ns": Path to the namespace info file that holds the namespace context to use for CLI requests.
-s, --server="": The address of the Kubernetes API server
--stderrthreshold=2: logs at or above this threshold go to stderr
--token="": Bearer token for authentication to the API server.
--user="": The name of the kubeconfig user to use
--v=0: log level for V logs
--validate=false: If true, use a schema to validate the input before sending it
--vmodule=: comma-separated list of pattern=N settings for file-filtered logging

```

14 changes: 4 additions & 10 deletions pkg/kubectl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ type Factory struct {
Printer func(cmd *cobra.Command, mapping *meta.RESTMapping, noHeaders bool) (kubectl.ResourcePrinter, error)
// Returns a Resizer for changing the size of the specified RESTMapping type or an error
Resizer func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Resizer, error)
// Returns a Reaper for gracefully shutting down resources.
Reaper func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Reaper, error)
// Returns a schema that can validate objects stored on disk.
Validator func(*cobra.Command) (validation.Schema, error)
// Returns the default namespace to use in cases where no other namespace is specified
Expand Down Expand Up @@ -133,14 +131,11 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
if err != nil {
return nil, err
}
return kubectl.ResizerFor(mapping.Kind, client)
},
Reaper: func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Reaper, error) {
client, err := clients.ClientForVersion(mapping.APIVersion)
if err != nil {
return nil, err
resizer, ok := kubectl.ResizerFor(mapping.Kind, client)
if !ok {
return nil, fmt.Errorf("no resizer has been implemented for %q", mapping.Kind)
}
return kubectl.ReaperFor(mapping.Kind, client)
return resizer, nil
},
Validator: func(cmd *cobra.Command) (validation.Schema, error) {
if GetFlagBool(cmd, "validate") {
Expand Down Expand Up @@ -211,7 +206,6 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
cmds.AddCommand(f.NewCmdResize(out))

cmds.AddCommand(f.NewCmdRunContainer(out))
cmds.AddCommand(f.NewCmdStop(out))

return cmds
}
Expand Down
55 changes: 0 additions & 55 deletions pkg/kubectl/cmd/stop.go

This file was deleted.

6 changes: 3 additions & 3 deletions pkg/kubectl/resize.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ type Resizer interface {
Resize(namespace, name string, preconditions *ResizePrecondition, newSize uint) (string, error)
}

func ResizerFor(kind string, c client.Interface) (Resizer, error) {
func ResizerFor(kind string, c *client.Client) (Resizer, bool) {
switch kind {
case "ReplicationController":
return &ReplicationControllerResizer{c}, nil
return &ReplicationControllerResizer{c}, true
}
return nil, fmt.Errorf("no resizer has been implemented for %q", kind)
return nil, false
}

type ReplicationControllerResizer struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubectl/rolling_updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
)

type updaterFake struct {
type customFake struct {
*client.Fake
ctrl client.ReplicationControllerInterface
}

func (c *updaterFake) ReplicationControllers(namespace string) client.ReplicationControllerInterface {
func (c *customFake) ReplicationControllers(namespace string) client.ReplicationControllerInterface {
return c.ctrl
}

func fakeClientFor(namespace string, responses []fakeResponse) client.Interface {
fake := client.Fake{}
return &updaterFake{
return &customFake{
&fake,
&fakeRc{
&client.FakeReplicationControllers{
Expand Down
110 changes: 0 additions & 110 deletions pkg/kubectl/stop.go

This file was deleted.