python icon indicating copy to clipboard operation
python copied to clipboard

404 Error For CertificatesV1beta1Api

Open rjk2147 opened this issue 5 years ago • 3 comments

What happened (please include outputs or screenshots): When running any API call to /apis/certificates.k8s.io/v1beta1/certificatesigningrequests a 404 error is returned. This does not happen for other API clients such as CoreV1API.

  File "/home/user/csr.py", line 4, in <module>
    body = certs_api.get_api_resources()
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/api/certificates_v1beta1_api.py", line 499, in get_api_resources
    return self.get_api_resources_with_http_info(**kwargs)  # noqa: E501
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/api/certificates_v1beta1_api.py", line 566, in get_api_resources_with_http_info
    return self.api_client.call_api(
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 373, in request
    return self.rest_client.GET(url,
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/rest.py", line 239, in GET
    return self.request("GET", url,
  File "/home/user/venv/lib/python3.8/site-packages/kubernetes/client/rest.py", line 233, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'e68a76e2-5fe9-4c7a-aa21-dc8e39202ecb', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '0e2c9617-9fdd-4d07-bf77-c7d590b29349', 'X-Kubernetes-Pf-Prioritylevel-Uid': '06a126cc-0935-433f-bc48-b79ccb83a2c1', 'Date': 'Sat, 14 Aug 2021 13:01:27 GMT', 'Content-Length': '174'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the server could not find the requested resource","reason":"NotFound","details":{},"code":404}

What you expected to happen: A return that would run without exception and be able to print the api definition of /apis/certificates.k8s.io/v1beta1/certificatesigningrequests How to reproduce it (as minimally and precisely as possible):

from kubernetes import config, client
config.load_kube_config()
certs_api = client.CertificatesV1beta1Api()
print(certs_api.get_api_resources())

Anything else we need to know?:

Environment:

  • Kubernetes version: v1.22.0
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T18:03:20Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T17:57:25Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}

  • OS: Linux 5.11.0-25-generic 20.04.1-Ubuntu SMP x86_64 x86_64
  • Python version: Python 3.8.10
  • Python client version: 17.17.0

rjk2147 avatar Aug 14 '21 13:08 rjk2147

The certificates.k8s.io/v1beta1 group version has been deprecated as of Kubernetes 1.22. Ref: https://kubernetes.io/docs/reference/using-api/deprecation-guide/

Hence, you wouldn't be able to access that resource. It's best to use the certificates.k8s.io/v1 group version for CertificateSigningRequest.

/assign

palnabarun avatar Aug 16 '21 16:08 palnabarun

/close

(Closing for now. Please feel to reopen in case you feel it is still unresolved.)

palnabarun avatar Oct 25 '21 16:10 palnabarun

@palnabarun: Closing this issue.

In response to this:

/close

(Closing for now. Please feel to reopen in case you feel it is still unresolved.)

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.

k8s-ci-robot avatar Oct 25 '21 16:10 k8s-ci-robot