mirror of https://github.com/k3s-io/k3s
![]() 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`) ``` |
||
---|---|---|
.. | ||
cmd | ||
metricsutil | ||
resource | ||
testing | ||
BUILD | ||
OWNERS | ||
apply.go | ||
autoscale.go | ||
bash_comp_utils.go | ||
cluster.go | ||
cluster_test.go | ||
clusterrolebinding.go | ||
configmap.go | ||
configmap_test.go | ||
custom_column_printer.go | ||
custom_column_printer_test.go | ||
deployment.go | ||
deployment_test.go | ||
describe.go | ||
describe_test.go | ||
doc.go | ||
explain.go | ||
generate.go | ||
generate_test.go | ||
history.go | ||
interfaces.go | ||
kubectl.go | ||
kubectl_test.go | ||
namespace.go | ||
namespace_test.go | ||
pdb.go | ||
proxy_server.go | ||
proxy_server_test.go | ||
quota.go | ||
quota_test.go | ||
resource_filter.go | ||
resource_printer.go | ||
resource_printer_test.go | ||
rolebinding.go | ||
rollback.go | ||
rolling_updater.go | ||
rolling_updater_test.go | ||
rollout_status.go | ||
rollout_status_test.go | ||
run.go | ||
run_test.go | ||
scale.go | ||
scale_test.go | ||
secret.go | ||
secret_for_docker_registry.go | ||
secret_for_docker_registry_test.go | ||
secret_for_tls.go | ||
secret_for_tls_test.go | ||
secret_test.go | ||
service.go | ||
service_basic.go | ||
service_basic_test.go | ||
service_test.go | ||
serviceaccount.go | ||
serviceaccount_test.go | ||
sorted_resource_name_list.go | ||
sorted_resource_name_list_test.go | ||
sorting_printer.go | ||
sorting_printer_test.go | ||
stop.go | ||
stop_test.go | ||
versioned_client.go |