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
kubectl edit ThirdPartyResource object fails with "invalid character" #35993
Comments
I am also seeing this issue on GKE, with the following k8s versions:
|
@adohe Is this something you could take a look at? |
@pwittrock IIRC, I have already fixed this on my local, I need to get it back. |
I looked into this issue again, and just found other problem when test against master branch.
I believe there are some problem of TPR discovery. |
I can confirm this issue as well. |
@pires what error you get? and also what's your kubernetes version? |
Environment: I create a TPR that exposes an object
|
@adohe any updates on this? |
fixed in #41304 |
Automatic merge from submit-queue Make kubectl edit work with unstructured objects Fixes #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`) ```
What keywords did you search in Kubernetes issues before filing this one?
kubectl edit invalid character
kubectl edit thirdpartyresource
Is this a BUG REPORT or FEATURE REQUEST?
BUG REPORT
Kubernetes version (use
kubectl version
):What happened:
kubectl edit
of a thirdPartyResource fails then re-enters the editor and adds the following comment:What you expected to happen:
kubectl edit
to successfully edit the ThirdPartResource object.How to reproduce it (as minimally and precisely as possible):
tpr.yaml
obj.yaml
The text was updated successfully, but these errors were encountered: