Merge pull request #58283 from nikhita/kubectl-scale-unstructured

Automatic merge from submit-queue (batch tested with PRs 59463, 59719, 60181, 58283, 59966). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubectl scale: support Unstructured objects

Support `Unstructured` objects with kubectl scale.

So that we can use the scale subresource for custom resources (possible after https://github.com/kubernetes/kubernetes/pull/55168 is merged):

```
➜ cluster/kubectl.sh scale --replicas=5 crontabs/my-new-cron-object
crontab "my-new-cron-object" scaled
```

**Release note**:

```release-note
NONE
```

/cc sttts deads2k p0lyn0mial
pull/6/head
Kubernetes Submit Queue 2018-02-23 00:34:30 -08:00 committed by GitHub
commit d4acd6b997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ func RunScale(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args
all := cmdutil.GetFlagBool(cmd, "all")
r := f.NewBuilder().
Internal().
Unstructured().
ContinueOnError().
NamespaceParam(cmdNamespace).DefaultNamespace().
FilenameParam(enforceNamespace, options).
@ -173,7 +173,7 @@ func RunScale(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args
return err
}
mapping := info.ResourceMapping()
client, err := f.ClientForMapping(mapping)
client, err := f.UnstructuredClientForMapping(mapping)
if err != nil {
return err
}