Unverified Commit e26b7301 authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #71103 from Pingan2017/autoscale-sts-kubectl

support statefulset in kubectl autoscale command
parents 1b059e57 c3bb1c46
...@@ -42,7 +42,7 @@ var ( ...@@ -42,7 +42,7 @@ var (
autoscaleLong = templates.LongDesc(i18n.T(` autoscaleLong = templates.LongDesc(i18n.T(`
Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster.
Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. Looks up a Deployment, ReplicaSet, StatefulSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference.
An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.`)) An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.`))
autoscaleExample = templates.Examples(i18n.T(` autoscaleExample = templates.Examples(i18n.T(`
......
...@@ -31,6 +31,7 @@ func canBeAutoscaled(kind schema.GroupKind) error { ...@@ -31,6 +31,7 @@ func canBeAutoscaled(kind schema.GroupKind) error {
corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(), corev1.SchemeGroupVersion.WithKind("ReplicationController").GroupKind(),
appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(), appsv1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
appsv1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(), appsv1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
appsv1.SchemeGroupVersion.WithKind("StatefulSet").GroupKind(),
extensionsv1beta1.SchemeGroupVersion.WithKind("Deployment").GroupKind(), extensionsv1beta1.SchemeGroupVersion.WithKind("Deployment").GroupKind(),
extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(): extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind():
// nothing to do here // nothing to do here
......
...@@ -39,6 +39,10 @@ func TestCanBeAutoscaled(t *testing.T) { ...@@ -39,6 +39,10 @@ func TestCanBeAutoscaled(t *testing.T) {
expectErr: false, expectErr: false,
}, },
{ {
kind: appsv1.SchemeGroupVersion.WithKind("StatefulSet").GroupKind(),
expectErr: false,
},
{
kind: extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(), kind: extensionsv1beta1.SchemeGroupVersion.WithKind("ReplicaSet").GroupKind(),
expectErr: false, expectErr: false,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment