Merge pull request #17269 from janetkuo/autoscale-deployments

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-11-21 22:23:23 -08:00
7 changed files with 31 additions and 19 deletions

View File

@@ -31,22 +31,21 @@ import (
const (
autoscaleLong = `Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster.
Looks up a replication controller by name and creates an autoscaler that uses this replication controller as a reference.
Looks up a deployment or replication controller by name and creates an autoscaler that uses this deployment or replication controller as a reference.
An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.`
autoscaleExample = `# Auto scale a replication controller "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies:
$ kubectl autoscale rc foo --min=2 --max=10
autoscaleExample = `# Auto scale a deployment "foo", with the number of pods between 2 to 10, target CPU utilization at a default value that server applies:
$ kubectl autoscale deployment foo --min=2 --max=10
# Auto scale a replication controller "foo", with the number of pods between 1 to 5, target CPU utilization at 80%:
$ kubectl autoscale rc foo --max=5 --cpu-percent=80`
)
// TODO: support autoscale for deployments
func NewCmdAutoscale(f *cmdutil.Factory, out io.Writer) *cobra.Command {
filenames := []string{}
cmd := &cobra.Command{
Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]",
Short: "Auto-scale a replication controller",
Short: "Auto-scale a deployment or replication controller",
Long: autoscaleLong,
Example: autoscaleExample,
Run: func(cmd *cobra.Command, args []string) {

View File

@@ -295,8 +295,7 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
},
CanBeAutoscaled: func(kind string) error {
switch kind {
// TODO: support autoscale for deployments
case "ReplicationController":
case "ReplicationController", "Deployment":
// nothing to do here
default:
return fmt.Errorf("cannot autoscale a %s", kind)