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

Error connecting to KubeVirt #50

Closed
naufalafif opened this issue Apr 18, 2022 · 5 comments
Closed

Error connecting to KubeVirt #50

naufalafif opened this issue Apr 18, 2022 · 5 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@naufalafif
Copy link

I follow example code, but still could not connect to kubevirt. it's working fine when using kubectl

Error log

kubevirt.rest.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Audit-Id': '1d0c7150-c823-4aa5-a864-4258d0f96c38', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'X-Kubernetes-Pf-Flowschema-Uid': 'eec4da63-596f-493e-baa1-73cd12dfd211', 'X-Kubernetes-Pf-Prioritylevel-Uid': '336d1222-b538-4c5a-a13c-3218760d2b87', 'Date': 'Mon, 18 Apr 2022 05:28:35 GMT', 'Content-Length': '366'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"[virtualmachines.kubevirt.io](http://virtualmachines.kubevirt.io/) is forbidden: User \"system:anonymous\" cannot list resource \"virtualmachines\" in API group \"[kubevirt.io](http://kubevirt.io/)\" in the namespace \"{namespace:[a-z0-9][a-z0-9\\\\-]*}\"","reason":"Forbidden","details":{"group":"[kubevirt.io](http://kubevirt.io/)","kind":"virtualmachines"},"code":403}

i did check the code & found that the authorization header is missing.

Request Headers

{'Accept': 'application/json', 'User-Agent': 'Swagger-Codegen/v0.52.0-rc.0-72-g0db065c1b/python'}

the issue is on defaultAPI, auth_settings is set as empty list [], while on api_client when auth_settings is empty it'l skip the process of set up the auth header.

@naufalafif
Copy link
Author

naufalafif commented Apr 18, 2022

temporary solution will be to create api_client with authorization as default header

  api_client = kubevirt.api_client.ApiClient(
      host=kubevirt.configuration.host,
      header_name='authorization',
      header_value=f'Bearer {token}'
  )
  api = kubevirt.DefaultApi(api_client)

@kubevirt-bot
Copy link
Contributor

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.

/lifecycle stale

@kubevirt-bot kubevirt-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 17, 2022
@kubevirt-bot
Copy link
Contributor

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.

/lifecycle rotten

@kubevirt-bot kubevirt-bot 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 Aug 16, 2022
@kubevirt-bot
Copy link
Contributor

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

/close

@kubevirt-bot
Copy link
Contributor

@kubevirt-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.

/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
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

2 participants