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

async creation of custom resources (CR) using the CRD is failing #1626

Closed
venukarnati92 opened this issue Nov 17, 2021 · 10 comments
Closed

async creation of custom resources (CR) using the CRD is failing #1626

venukarnati92 opened this issue Nov 17, 2021 · 10 comments
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

@venukarnati92
Copy link
Contributor

Async creation of custom resources (CR) using the CRD is failing for dynamic Client create call.

Synchronous Implementation with this example is working fine https://github.com/kubernetes-client/python/blob/master/examples/dynamic-client/namespaced_custom_resource.py

Now to make creation process as async update line number 192 on the above example to the following

ingressroute_api.create(body=ingressroute_manifest_first, namespace=namespace_first, async_req=True)

Error Message

(ansible) 21-11-16 2:45:14 venu.karnati@ABOUTPIANOORIGIN:~/Desktop/gitProject/python/examples/dynamic-client$ python namespaced_custom_resource.py Traceback (most recent call last): File "namespaced_custom_resource.py", line 250, in <module> main() File "namespaced_custom_resource.py", line 192, in main ingressroute_api.create(body=ingressroute_manifest_first, namespace=namespace_first, async_req=True) File "/Users/venu.karnati/.pyenv/versions/ansible/lib/python3.6/site-packages/kubernetes/dynamic/client.py", line 119, in create return self.request('post', path, body=body, **kwargs) File "/Users/venu.karnati/.pyenv/versions/ansible/lib/python3.6/site-packages/kubernetes/dynamic/client.py", line 62, in inner return serializer(self, json.loads(resp.data.decode('utf8'))) AttributeError: 'ApplyResult' object has no attribute 'data'

Environment:

  • Kubernetes version 1.21.2
  • MacOS 11.6):
  • Python 3.6.8
  • kubernetes 18.20.0
@venukarnati92 venukarnati92 added the kind/bug Categorizes issue or PR as related to a bug. label Nov 17, 2021
@roycaihw
Copy link
Member

cc @fabianvf @roycaihw

@roycaihw
Copy link
Member

In our typed clients, the syntax for using async_req is:

  thread = api.method(body, async_req=True)
  result = thread.get()

For example, the CRD client.

Could you try if the same works with the dynamic client?

@venukarnati92
Copy link
Contributor Author

venukarnati92 commented Nov 22, 2021

@roycaihw
On further debugging I was able to find that when you make an asynchronous call response doesn't have data attribute.I can see request is launched but client.py is unable to get the response details.Looks we need to have separate logic for response parsing when the call is asynchronous .

@roycaihw The above suggestion will still fail because the error is happening when we make a create call itself.

"/Users/venu.karnati/.pyenv/versions/ansible/lib/python3.6/site-packages/kubernetes/dynamic/client.py", line 62, in inner return serializer(self, json.loads(resp.data.decode('utf8'))) AttributeError: 'ApplyResult' object has no attribute 'data'

Note:
When I make synchronous call I can see response.data attribute has the values.

@venukarnati92
Copy link
Contributor Author

/assign @Yourself

@k8s-ci-robot
Copy link
Contributor

@venukarnati92: GitHub didn't allow me to assign the following users: yourself.

Note that only kubernetes-client members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @Yourself

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.

@venukarnati92
Copy link
Contributor Author

I have raised a PR for the fix kubernetes-client/python-base#269

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 Mar 9, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 Apr 8, 2022
@roycaihw
Copy link
Member

roycaihw commented Apr 8, 2022

Fixed by #1697
/close

@k8s-ci-robot
Copy link
Contributor

@roycaihw: Closing this issue.

In response to this:

Fixed by #1697
/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

4 participants