New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make kubectl generic commands work with unstructured objects #40260
Conversation
kubectl apply
work with unstructured objects
cc @smarterclayton @deads2k @ymqytw @pwittrock |
86e6a5b
to
15485ad
Compare
@liggitt What is the behavior w.r.t. saving nulls in the last-applied-config annotation. Are they saved? What happens when they are added / removed from the local configuration file and applied if they are / are not in the last-applied-config annotation? |
kubectl apply
work with unstructured objectskubectl apply
work with unstructured objects
kubectl apply
work with unstructured objects
@pwittrock @ymqytw I removed the generic json patch computation from this PR, so this is now limited to giving us unstructured objects to work with (instead of ThirdPartyResourceData objects). With this PR, apply still encounters the issue #40096 is attempting to fix, but gives us a better foundation for computing a generic patch for those objects. |
Sorry for the noise. I just want this to be merged. |
rebased |
Automatic merge from submit-queue (batch tested with PRs 39223, 40260, 40082, 40389) |
Automatic merge from submit-queue (batch tested with PRs 40529, 40630) propagate explicit nulls in apply Rebase of #35496 on top of #40260 The client-side propagation of the raw value is no longer needed, since the client is preserving the original object in unstructured form (explicit nulls are preserved). Kept tests and CreateThreeWayMergePatch changes from #35496 ```release-note kubectl apply now supports explicitly clearing values not present in the config by setting them to null ``` - [x] Clean up orphaned objects in test-cmd to preserve pre- and post- conditions - [x] improve CreateThreeWayMergePatch test to not filter based on string comparison to test name
Automatic merge from submit-queue (batch tested with PRs 40864, 40666, 38382, 40874) apply falls back to generic JSON patch computation if no go struct is registered for the target GVK This PR is the master version of #40096 which is target 1.4 branch. This PR is based on #40260 - [x] ensure subkey deletion works in CreateThreeWayJSONMergePatch - [x] ensure type stomping works in CreateThreeWayJSONMergePatch - [x] lots of tests for generic json patch computation - [x] apply falls back to generic 3-way JSON merge patch if no go struct is registered for the target GVK - [x] prevent generic apply patch computation between different apiVersions and/or kinds - [x] make pruner generic (apply --prune works with TPR) ```release-note apply falls back to generic 3-way JSON merge patch if no go struct is registered for the target GVK ```
@liggitt Thanks for the fixes! Does this also fix
The issue has no milestone, will this be part of 1.6? |
No. Third party resources do not support conversion.
These commits will be in 1.6, yes |
Automatic merge from submit-queue (batch tested with PRs 40529, 40630) propagate explicit nulls in apply Rebase of kubernetes/kubernetes#35496 on top of kubernetes/kubernetes#40260 The client-side propagation of the raw value is no longer needed, since the client is preserving the original object in unstructured form (explicit nulls are preserved). Kept tests and CreateThreeWayMergePatch changes from kubernetes/kubernetes#35496 ```release-note kubectl apply now supports explicitly clearing values not present in the config by setting them to null ``` - [x] Clean up orphaned objects in test-cmd to preserve pre- and post- conditions - [x] improve CreateThreeWayMergePatch test to not filter based on string comparison to test name Kubernetes-commit: 9807cd7d06712dec1fc48d12644613768699957a
part of making apply, edit, label, annotate, and patch work with third party resources
fixes #35149
fixes #34413
prereq of:
#35496
#40096
related to:
#39906
#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
--record
with unregistered objects--record
with unregistered objectsfollow-ups for pre-existing issues:
patch
doesn't honor output formats when persisting to server (kubectl patch -f svc.json --type merge -p '{}' -o json
doesn't output json) - Honor output formats in kubectl patch #41705apply
edit
- done in Make kubectl edit work with unstructured objects #41304