Files
kubernetes/pkg/kubectl
Kubernetes Submit Queue cf10f532d1 Merge pull request #41304 from liggitt/edit-refactor
Automatic merge from submit-queue

Make kubectl edit work with unstructured objects

Fixes https://github.com/kubernetes/kubernetes/issues/35993


1. First (before any other changes), added several test cases for complex edit scenarios:
   - [x] ensure the edit loop bails out if given the same result that already caused errors
   - [x] ensure an edited file with a syntax error is reopened preserving the input
   - [x] ensure objects with existing "caused-by" annotations get updated with the current command

2. Refactored the edit code to prep for switching to unstructured:
   - [x] made editFn operate on a slice of resource.Info objects passed as an arg, regardless of edit mode
   - [x] simplified short-circuiting logic when re-editing a file containing an error
   - [x] refactored how we build the various visitors (namespace enforcement, annotation application, patching, creating) so we could easily switch to just using a single visitor over a set of resource infos read from the updated input for all of them

3. Switched to using a resource builder to parse the stream of the user's edited output
   - [x] improve the error message you get on syntax errors
   - [x] preserve the user's input more faithfully (see how the captured testcase requests to the server changed to reflect exactly what the user edited)
   - [x] stopped doing client-side conversion (means deprecating `--output-version`)

4. Switched edit to work with generic objects
   - [x] use unstructured objects
   - [x] fall back to generic json merge patch for unrecognized group/version/kinds

5. Added new test cases
   - [x] schemaless objects falls back to generic json merge (covers TPR scenario)
   - [x] edit unknown version of known kind (version "v0" of storageclass) falls back to generic json merge

```release-note
`kubectl edit` now edits objects exactly as they were retrieved from the API. This allows using `kubectl edit` with third-party resources and extension API servers. Because client-side conversion is no longer done, the `--output-version` option is deprecated for `kubectl edit`. To edit using a particular API version, fully-qualify the resource, version, and group used to fetch the object (for example, `job.v1.batch/myjob`)
```
2017-02-14 18:34:30 -08:00
..
2017-01-29 21:41:45 +01:00
2017-02-14 14:51:06 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2016-07-16 13:48:21 -04:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-20 08:04:53 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-25 17:32:22 -08:00
2017-01-30 12:46:59 -05:00
2017-01-20 08:04:53 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-29 21:41:44 +01:00
2017-01-26 13:54:40 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2017-01-11 09:09:48 -05:00
2016-11-23 15:53:09 -08:00
2017-01-26 13:54:40 -05:00
2016-12-14 12:39:49 -08:00