Skip to content
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

list_api_service: ValueError: Invalid value for service, must not be None #1174

Closed
clausa20 opened this issue May 29, 2020 · 8 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@clausa20
Copy link

clausa20 commented May 29, 2020

Hello,
I try to get apiservice using in python doing:

config.load_kube_config(kubectl_config_full_path)
api_instance = client.ApiregistrationV1Api()
response = api_instance.list_api_service()
print("Api services: " + str(response))

but I get the following error:

ValueError: Invalid value for service, must not be None

I have a AWS EKS 1.15 as Kubernetes Master.
Python 3.6.8.
python kubernetes client 10.0.0
Ubuntu 16.04.6 LTS

Update:
I've tested it with python kubernetes client 11.0.0 and I get the same error

@clausa20 clausa20 added the kind/bug Categorizes issue or PR as related to a bug. label May 29, 2020
@moshevayner
Copy link
Member

I was able to reproduce it locally.
I'll take a look at the code and figure out what needs to be done.
/assign

@moshevayner
Copy link
Member

moshevayner commented May 31, 2020

@clausa20 I've started looking into it, and for now I have workaround on how to make this work without failing.
If you add _preload_content=False as a kwarg to your function call, you can then get the list using response.data, as following:

    kubernetes.config.load_kube_config()
    api_registration_api = kubernetes.client.ApiregistrationV1Api()
    response = api_registration_api.list_api_service(_preload_content=False)
    print(response.data)

I'll keep looking into why the data serialization fails and figure out if this is an intended behavior or something that requires fixing and will act accordingly. But I hope that I was able to get you unblocked for now.

@clausa20
Copy link
Author

clausa20 commented Jun 1, 2020

@MoShitrit thanks for the workaround, it fits ok for me. Regards.

@roycaihw
Copy link
Member

roycaihw commented Jun 9, 2020

Looks like this is another occurrence of kubernetes-client/gen#52 and has been fixed by kubernetes/kubernetes#85728 in Kubernetes 1.18. Kubernetes sometimes incorrectly restricts a field to be required but the apiserver may omits the field in real responses. These responses break the generated clients since the generated client-side validation expects the required field to exist.

For now the workaround is either to avoid de-serializing the response so the client-side validation doesn't kick in, or to remove the client-side validation if you have access to your local module code. Once we cut a new release with the 1.18 openapi spec, the generated client won't expect the field to be required.

diegodelemos pushed a commit to diegodelemos/reana-commons that referenced this issue Jul 3, 2020
* Gets raw data from Kubernetes and avoids OpenAPI deserialization which
  fails due to kubernetes-client/gen#52,
  even though [this fix](kubernetes/kubernetes#85728)
  exists, the Python Kubernetes library is still not compatible with it.
  More information at kubernetes-client/python#1174.
diegodelemos pushed a commit to diegodelemos/reana-commons that referenced this issue Jul 3, 2020
* Gets raw data from Kubernetes and avoids OpenAPI deserialization which
  fails due to kubernetes-client/gen#52,
  even though [this fix](kubernetes/kubernetes#85728)
  exists, the Python Kubernetes library is still not compatible with it.
  More information at kubernetes-client/python#1174.
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 7, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 7, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants