-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Model objects should tolerate None in place of empty lists #376
Comments
This is a hacky workaround for: kubernetes-client#376 The client code is generated and should not be manually edited like this, but the error is blocking our use of the library.
Same problem with CRD requests:
|
The lates one has some problems with none values received instead of empty list: kubernetes-client/python#376
@yliaog ping? This is going to become a larger problem as more people start to use Kubernetes 1.8. |
This is a hacky workaround for: kubernetes-client#376 The client code is generated and should not be manually edited like this, but the error is blocking our use of the library.
cc @mbohlool for his comments |
That is an interesting problem and I keep going back and forth between main repo or swagger-codegen as the place to fix this. Problem is do we assume a required array can be empty or not. Seems that kubernetes API server think that is OK but swagger-codegen assume the other one. I would say the best fix should be in kubernetes main repo, e.g. if an array can be empty, it should not be required. I suggest you file an issue in the main repo and see if we can get a fix there in 1.10. As a temporary fix, we can patch the spec in the kubernetes-client/gen repo. |
Just to piggy back off this issue. I'm seeing a similar error with the python client: 4.0.0 I did not see this issue when were using the 2.2.0 of the python client. |
For anyone looking for an easy workaround. You can easily monkey patch the class giving you errors: from kubernetes.client.models.v1_endpoints import V1Endpoints
def set_subsets(self, subsets):
if subsets is None:
subsets = []
self._subsets = subsets
setattr(V1Endpoints, 'subsets', property(fget=V1Endpoints.subsets.fget, fset=set_subsets)) |
Running into this problem regularly with respect to CRDs. Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.0", GitCommit:"91e7b4fd31fcd3d5f436da26c980becec37ceefe", GitTreeState:"clean", BuildDate:"2018-06-27T20:17:28Z", GoVersion:"go1.10.2", Compiler:"gc", Platform:"windows/amd64"} |
same issue and workaround didnt work for me.... |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@ashpreetbedi: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@mbohlool this issue is there when creating CRDs as well. How can we get this fixed? |
Python client version: 4.0.0a1
Server version: 1.8.0
On an endpoints request, Kubernetes 1.8 will return
"subsets": null
in the case of an empty subsets list. This leads to an error on deserialization:See related Kubernetes issue: kubernetes/kubernetes#44593
However, that issue was eventually resolved by declaring that as clients should treat nulls and empty lists as interchangeable unless specified otherwise:
kubernetes/kubernetes#45294
The Python client should remove the none-checks, or possibly translate them to empty lists (though if they decided against that on the server-side, it sounds risky).
The text was updated successfully, but these errors were encountered: