kubernetes/hack
Kubernetes Submit Queue 1625150de8 Merge pull request #40260 from liggitt/kubectl-tpr
Automatic merge from submit-queue (batch tested with PRs 39223, 40260, 40082, 40389)

make kubectl generic commands work with unstructured objects

part of making apply, edit, label, annotate, and patch work with third party resources

fixes #35149
fixes #34413

prereq of:
https://github.com/kubernetes/kubernetes/issues/35496
https://github.com/kubernetes/kubernetes/pull/40096

related to:
https://github.com/kubernetes/kubernetes/issues/39906
https://github.com/kubernetes/kubernetes/issues/40119

kubectl is currently decoding any resource it doesn't have compiled-in to a ThirdPartyResourceData struct, which means it computes patches using that struct, and would try to send a ThirdPartyResourceData object to the API server when running `apply`

This PR removes the behavior that decodes unknown objects into ThirdPartyResourceData structs internally, and fixes up the following generic commands to work with unstructured objects

- [x] apply
  - [x] decode into runtime.Unstructured objects
  - [x] successfully use `--record` with unregistered objects 
- [x] patch
  - [x] decode into runtime.Unstructured objects
  - [x] successfully use `--record` with unregistered objects 
- [x] describe
  - [x] decode into runtime.Unstructured objects
  - [x] implement generic describer
- [x] fix other generic kubectl commands to work with unstructured objects
  - [x] label
  - [x] annotate

follow-ups for pre-existing issues:
- [ ] `explain` doesn't work with unregistered resources
- [ ] remove special casing of federation group in clientset lookups, etc
- [ ] `patch`
  - [ ] doesn't honor output formats when persisting to server (`kubectl patch -f svc.json --type merge -p '{}' -o json` doesn't output json)
  - [ ] --local throws exception (`kubectl patch -f svc.json --type merge -p '{}' --local`)
- [ ] `apply`
  - [ ] fall back to generic JSON patch computation if no go struct is registered for the target GVK (e.g. https://github.com/kubernetes/kubernetes/pull/40096)
  - [ ] ensure subkey deletion works in CreateThreeWayJSONMergePatch
  - [ ] ensure type stomping works in CreateThreeWayJSONMergePatch
  - [ ] lots of tests for generic json patch computation
  - [ ] prevent generic apply patch computation among different versions
  - [ ] reconcile treatment of nulls with https://github.com/kubernetes/kubernetes/pull/35496
- [ ] `edit`
  - [ ] decode into runtime.Unstructured objects
  - [ ] fall back to generic JSON patch computation if no go struct is registered for the target GVK
2017-01-27 05:41:45 -08:00
..
boilerplate Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
cmd/teststale
e2e-internal Build release tarballs in bazel and add make bazel-release rule 2017-01-13 16:17:44 -08:00
gen-swagger-doc
jenkins No more unit tests to skip. 2016-12-27 16:19:43 -08:00
lib Add test shell stack traces 2017-01-25 13:34:16 -05:00
make-rules Test generic operations with thirdpartyresources 2017-01-26 19:59:27 -05:00
testdata promote certificates.k8s.io to beta 2017-01-19 13:13:20 -08:00
verify-flags Merge pull request #39462 from Shawyeok/master 2017-01-25 16:40:57 -08:00
.linted_packages move testing/core to client-go 2017-01-26 13:54:40 -05:00
autogenerated_placeholder.txt
benchmark-go.sh unify newline format for benchmark-go.sh 2016-12-10 01:15:30 -08:00
benchmark-integration.sh
BUILD Add //hack:verify-boilerplate rule. 2017-01-19 11:10:48 -08:00
build-cross.sh
build-go.sh
build-ui.sh genericapiserver: fix imports 2017-01-19 13:06:47 +01:00
cherry_pick_pull.sh hack/cherry_pick_pull.sh: cleanup patch files 2016-12-14 14:33:17 -08:00
dev-build-and-push.sh hack/dev-build-*: Run dev build instead of release build 2016-12-15 10:35:16 -07:00
dev-build-and-up.sh hack/dev-build-*: Run dev build instead of release build 2016-12-15 10:35:16 -07:00
dev-push-hyperkube.sh Rename build-tools/ back to build/ 2016-12-14 13:42:15 -08:00
e2e-node-test.sh
e2e.go hack/e2e.go / kops: Add --kops-admin-access to restrict API access 2016-12-12 23:25:13 -08:00
federated-ginkgo-e2e.sh
generate-bindata.sh Run bindata generation from KUBE_ROOT 2017-01-10 14:28:19 -05:00
generate-docs.sh spell check for test/* 2016-12-14 06:03:00 -08:00
get-build.sh
ginkgo-e2e.sh [Federation][init-11] Switch federation e2e tests to use the new federation control plane bootstrap via the kubefed init command. 2016-12-16 11:22:44 +05:30
godep-save.sh k8s.io/apimachinery scripts 2017-01-11 08:15:34 -05:00
grab-profiles.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
install-etcd.sh
list-feature-tests.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
local-up-cluster.sh added warning message error about not running kubelet if not darwin/linux to my check 2017-01-26 13:11:27 -08:00
local-up-discovery.sh rename kubernetes-discovery to kube-aggregator 2017-01-10 12:27:42 -05:00
lookup_pull.py
OWNERS Updated top level owners file to match new format 2017-01-19 11:29:16 -08:00
print-workspace-status.sh bazel: save git version in kubernetes.tar.gz 2017-01-23 17:28:08 -08:00
run-in-gopath.sh
test-cmd.sh
test-go.sh
test-integration.sh choose a particular directory test-integration 2016-08-26 12:33:06 -04:00
test-update-storage-objects.sh Remove extensions/v1beta1 Job 2016-12-17 00:07:24 +01:00
update_owners.py Remove girishkalele from most places 2016-12-05 19:29:34 -05:00
update-all.sh Sync update-all with verfiy targets 2016-12-05 12:43:54 +01:00
update-api-reference-docs.sh update generation bash to handle vendor dir 2017-01-17 09:06:34 -05:00
update-bazel.sh Update to gazel v13 2017-01-05 14:14:06 -08:00
update-codecgen.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
update-codegen.sh [Federation] update client generation script to include autoscaling resources 2017-01-22 12:27:56 +05:30
update-federation-api-reference-docs.sh update generation bash to handle vendor dir 2017-01-17 09:06:34 -05:00
update-federation-generated-swagger-docs.sh update generation bash to handle vendor dir 2017-01-17 09:06:34 -05:00
update-federation-openapi-spec.sh genericapiserver: move MasterCount and service options into master 2016-12-16 17:23:43 +01:00
update-federation-swagger-spec.sh Federation does not generate swagger spec correctly 2017-01-06 23:45:04 -05:00
update-generated-docs.sh
update-generated-protobuf-dockerized.sh spell check for test/* 2016-12-14 06:03:00 -08:00
update-generated-protobuf.sh Rename build-tools/ back to build/ 2016-12-14 13:42:15 -08:00
update-generated-runtime-dockerized.sh CRI: use more gogoprotobuf plugins 2017-01-25 13:52:24 -08:00
update-generated-runtime.sh Rename build-tools/ back to build/ 2016-12-14 13:42:15 -08:00
update-generated-swagger-docs.sh update generation bash to handle vendor dir 2017-01-17 09:06:34 -05:00
update-godep-licenses.sh make godep licenses/copyright check case insensitive 2016-10-24 18:00:08 -07:00
update-gofmt.sh Merge pull request #31547 from mbohlool/fix2 2016-09-14 05:35:51 -07:00
update-munge-docs.sh remove verify-munge-docs.sh 2016-12-07 14:33:34 -08:00
update-openapi-spec.sh Fix race in service IP allocation repair loop 2016-12-26 21:59:27 -08:00
update-staging-client-go.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
update-swagger-spec.sh update generation scripts to share API group version constants 2016-09-22 13:30:41 -04:00
verify-all.sh
verify-api-groups.sh add script to check for updates to the files for generation 2016-11-01 15:59:50 -04:00
verify-api-reference-docs.sh
verify-bazel.sh Update to gazel v13 2017-01-05 14:14:06 -08:00
verify-boilerplate.sh Add a build rule for the boilerplate unit test. 2017-01-01 22:54:32 -08:00
verify-cli-conventions.sh Tools for checking CLI conventions 2016-10-17 11:50:02 -02:00
verify-codecgen.sh add apiregistration types 2016-12-06 13:45:10 -05:00
verify-codegen.sh rename kubernetes-discovery to kube-aggregator 2017-01-10 12:27:42 -05:00
verify-description.sh
verify-federation-openapi-spec.sh Add verify script federation OpenAPI spec generation 2016-11-07 02:41:50 -08:00
verify-flags-underscore.py ignore BUILD in the flags-underscore.py validation 2016-10-21 17:32:33 -07:00
verify-generated-docs.sh
verify-generated-protobuf.sh utils: Use macOS copatible copying method 2016-10-18 11:09:38 +02:00
verify-generated-runtime.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
verify-generated-swagger-docs.sh docs generation: Use macos compatible copy method 2016-10-18 11:11:03 +02:00
verify-godep-licenses.sh
verify-godeps.sh Fix undefined KEEP_TMP in verify-godeps.sh 2017-01-24 14:45:20 -05:00
verify-gofmt.sh ignore staging in munge scripts 2016-08-24 13:09:13 -07:00
verify-golint.sh hack/verify-golint: enforce cleanup of old packages 2017-01-24 08:34:06 +01:00
verify-govet.sh
verify-import-boss.sh
verify-linkcheck.sh
verify-openapi-spec.sh verify-openapi-spec.sh should not ignore extra file in the spec folder api/openapi-spec 2016-11-01 01:13:11 -07:00
verify-pkg-names.sh Fix spelling in package naming linter error message 2016-12-20 15:48:14 -05:00
verify-readonly-packages.sh Add more generated files as exceptions for readonly directories 2017-01-11 21:38:08 +01:00
verify-staging-client-go.sh add update-staging-client-go.sh and verify-staging-client-go.sh; 2016-10-29 14:20:39 -07:00
verify-staging-imports.sh remove go get failing import comment 2017-01-19 10:39:07 -05:00
verify-swagger-spec.sh
verify-symbols.sh spell check for test/* 2016-12-14 06:03:00 -08:00
verify-test-images.sh Make all useage of sort deterministic 2016-10-20 16:47:20 -04:00
verify-test-owners.sh Disable verify-test-owners.sh and make go vet more obvious 2016-12-21 11:44:04 -08:00