Automatic merge from submit-queue. 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>.
remove confusing flexibility for metadata interpretation
Metadata accessors are coded in. This means that we don't need to inject flexibility, the flexibility is already present based on what your code relies up. This removes the per-individual resource injection which simplifies all calling code.
intersection of @kubernetes/sig-api-machinery-pr-reviews @kubernetes/sig-cli-maintainers
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 61324, 62880, 62765). 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>.
provide standard iostream struct for commands
Commands usually need some kind of iostream. For consistency, delegation, and testability this pull introduces a standard struct to embed in every set of command options. It also starts the plumbing so that the benefits of standardization for all three of those cases become clear.
@kubernetes/sig-cli-maintainers
@soltysh @juanvallejo
```release-note
NONE
```
Automatic merge from submit-queue. 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>.
add test file for pkg/kubectl/cmd/rollout/rollout_pause.go file
new: pkg/kubectl/cmd/rollout/rollout_pause_test.go
modified: pkg/kubectl/cmd/rollout/BUILD
**What this PR does / why we need it**:
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
```
Automatic merge from submit-queue (batch tested with PRs 62876, 62733, 62827). 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>.
remove discovery injection from factory
We added this shim when cached discovery was a contentious thing to give ourselves flexibility. It is no longer contentious and this removes a layer of complexity we no longer need.
@kubernetes/sig-cli-maintainers
@soltysh @juanvallejo
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.
final record flag cleanup
This ties off the remainder of the record flag uses. Trying to merge different types of patches is fraught, so I added a way to get a merge patch (not a strategic patch) back from the annotation update.
@kubernetes/sig-cli-maintainers
/assign @soltysh
/assign @juanvallejo
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.
simplify the client cache
We created the client cache back when we negotiated versions to create a config and a client. Now we don't, so this is just debt. This removes all the obvious places. I'll open a separate WIP to try to kill the rest.
@kubernetes/sig-cli-maintainers
@soltysh
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62632, 62789, 62512, 62848). 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>.
use recordFlags to manage recording
This updates the set commands to use the recordflags and updates the commands we're touching to follow the pattern that is emerging. A method for New*Options, a valid default value for a recorder there, using the value `o` everywhere to refer to options, naming the struct `<commandName>Options`.
@kubernetes/sig-cli-maintainers
@soltysh @juanvallejo continues the effort
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62632, 62789, 62512, 62848). 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 stops rendering List as suffix kind name for CRD resources
**What this PR does / why we need it**:
`List` should not be treated as suffix when validating CRD objects.
Removing this validation won't break anything.
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes#62410
**Special notes for your reviewer**:
/assign liggitt deads2k
/cc nikhita soltysh
**Release note**:
```release-note
kubectl stops rendering List as suffix kind name for CRD resources
```
Automatic merge from submit-queue. 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>.
fix up and use record flags
This pull starts a genericclioptions package with a dependency enforcer to ensure that we have no kube/kube links. It makes the recordflags nil-able and still behave as expected. And it also updates several commands to use the record flags.
@kubernetes/sig-cli-maintainers @soltysh @juanvallejo
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62694, 62569, 62646, 61633, 62433). 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>.
wire printflags through run cmd
**Release note**:
```release-note
NONE
```
Adds PrintFlags to `run` command.
cc @soltysh @deads2k
Automatic merge from submit-queue. 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>.
add validation in kubectl create if no file in directory
**What this PR does / why we need it**:
if no yaml or json file in a directory
```
# ./cluster/kubectl.sh create -f ../0/1 --dry-run
pod "nginx" created (dry run)
# ./cluster/kubectl.sh create -f ../0
error: You must provide one or more resources by argument or filename.
Example resource specifications include:
'-f rsrc.yaml'
'--filename=rsrc.json'
'<resource> <name>'
'<resource>'
```
expected:
```
# ./cluster/kubectl.sh create -f ../0
error: error reading [../0]: please make sure the file extension is [.json .yaml .yml]
```
**Which issue this PR fixes**: fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). 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>.
Fix kubectl describe cronjob
CronJob describer was attempting to use the internal batch clientset, which speaks to the batch/v1 API group. CronJobs do not exist in that API group.
Automatic merge from submit-queue (batch tested with PRs 62748, 60536, 62300, 62661, 62731). 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>.
Wire PrintFlags through delete, replace, run commands
**Release note**:
```release-note
NONE
```
Wires PrintFlags through the `delete`, `replace`, and `run` commands.
All three commands grouped in this patch as they depend on DeleteOptions.
~~Tagged as WIP for now, as I still need to update tests.~~
cc @soltysh @deads2k
Automatic merge from submit-queue (batch tested with PRs 62436, 62499, 62664, 62685, 62660). 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>.
begin adding record flags struct
**Release note**:
```release-note
NONE
```
Begins wiring RecordFlags through the apply command.
cc @soltysh @deads2k
Automatic merge from submit-queue (batch tested with PRs 62467, 62482, 62211). 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>.
Ensure resources created by `run --rm` are cleaned up
**Release note**:
```release-note
NONE
```
Resources created by `kubectl run --rm ...` are now cleaned up, even in the event of an error.
Relevant downstream issue: https://github.com/openshift/origin/issues/13276
cc @soltysh
Automatic merge from submit-queue. 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>.
Move all create subcommands to its own subdirectory
**What this PR does / why we need it**:
Similarly to `kubectl set` subcommands move al `create` subcommands to its own subdirectory given that there are that many of them.
/assign @juanvallejo
**Release note**:
```release-note
NONE
```
Automatic merge from submit-queue (batch tested with PRs 62273, 62461). 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>.
allow higher burst for discovery
Discovery makes a lot of consecutive (maybe someday parallel) calls. One for every group and another for every version. Add a few CRDs and it's pretty easy to get to 50 calls.
This targets the burst on kubectl's discovery client only.