Repository navigation
Conversation
Kubernetes can return the resource or Status for the same successful DELETE. Swagger 2 named only one model, so the Python clients returned dictionaries on some methods and tried to decode Status as the resource on others [1]. Match the operation to its resource definition by group, version, and kind. Generate the resource-or-Status union on individual DELETE methods and select the model from the returned JSON. Callers that previously received dictionaries must use model attributes instead. [1]: kubernetes-client/python#2752
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tamird The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
@yliaog, #309 preserved both response shapes by returning dictionaries. Does inferring the two models from the Swagger 2 operation look reasonable until we can read them from v3? The Python client PR shows what would change for callers in the next major release. — with Codex assistance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A successful Pod DELETE can return
kind: Status. The generated Python client currently tries to deserialize that body as a Pod and raises a validation error. ConfigMap DELETE has the opposite problem: callers get a dictionary regardless of which object the server returns. Python issue #2752 shows what this looks like to a caller.Generate a resource-or-
V1Statusunion for individual built-in DELETEs in the synchronous and asyncio Python clients. Swagger 2 names only one response model, but Kubernetes identifies the target resource by group, version, and kind. At runtime the generated client selects one of the allowed models using the JSON body'sapiVersionandkind. Collection deletes and generic custom-object methods keep their existing behavior.For methods that returned dictionaries after #309, callers must switch to model attributes. #312 tracks replacing the Swagger 2 inference with explicit response alternatives when the generator consumes Kubernetes’ v3 schemas. The Python return types can stay the same.
Prepared with Codex assistance.