kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
141 stars 45 forks source link

Issue with Running list_pod_incluster Example Code - HTTP 422 #228

Closed inkuu2998 closed 3 months ago

inkuu2998 commented 3 months ago

Hello,

I’m having trouble running the example code provided. I’m encountering an error and I’m hoping you could help me understand what might be going wrong.

Here are the details of my environment:

Client Version: v1.28.1-CaaSCore1.2.5 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.28.1-CaaSCore1.2.5

C client version: release-0.8.0 The code I’m trying to run is as follows(not changed):

pod_list = CoreV1API_listNamespacedPod(apiClient, "default", /namespace / NULL, / pretty / 0, / allowWatchBookmarks / NULL, / continue / NULL, / fieldSelector / NULL, / labelSelector / 0, / limit / NULL, / resourceVersion / NULL, / resourceVersionMatch / 0, / sendInitialEvents / 0, / timeoutSeconds / 0 / watch / ); The output I’m getting is “The return code of HTTP request=422” and “Cannot get any pod.” Any guidance on what might be causing this issue would be greatly appreciated. Thank you for your time and assistance.

Additional Information:

Interestingly, I have noticed that the output is normal when I use the same c client version (0.8.0) with the following versions: kubectl version: Client Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.19”, GitCommit:“ac0cc736d0018d817c763083945e4db863168d12”, GitTreeState:“clean”, BuildDate:“2021-05-12T11:29:07Z”, GoVersion:“go1.13.15”, Compiler:“gc”, Platform:“linux/arm64”} Server Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.19”, GitCommit:“ac0cc736d0018d817c763083945e4db863168d12”, GitTreeState:“clean”, BuildDate:“2021-05-12T11:21:54Z”, GoVersion:“go1.13.15”, Compiler:“gc”, Platform:“linux/arm64”} This leads me to believe that the issue might be related to the specific versions I mentioned in my initial post. I would appreciate any insights into this.

Thank you again for your assistance.

ityuhui commented 3 months ago

The client release-0.8.0 has a known issue. (https://github.com/kubernetes-client/c/issues/209) Please try with release-0.9.0 or master banch.

inkuu2998 commented 3 months ago

Thank you for the proposed solution. However, our project is currently using server version 1.28, and we are unable to change this version at the moment.

Upon reviewing the release notes, I noticed that client version 0.8.0 is designed for server version 1.28, while client version 0.9.0 is based on server version 1.29. This raises concerns about potential compatibility issues if we upgrade to client version 0.9.0.

Therefore, I would like to inquire about the compatibility details between different client versions and server versions.

Thank you very much for your help and support. I look forward to your response.

ityuhui commented 3 months ago

This issue happens after release 0.8.0, we only fix it in the release 0.9.0 and master branch, but not merge back to release 0.8.0 as we don’t want to break compatibility with some older versions of kubernetes v1.28.x

release 0.9.0 can work with kubernetes v1.28 https://github.com/kubernetes-client/c/blob/master/docs/versioning-and-compatibility.md

Check the history of https://github.com/kubernetes-client/c/blob/master/kubernetes/swagger.json to get the changes between v1.29 and v1.28

inkuu2998 commented 3 months ago

Thank you for your reply and help!

ityuhui commented 3 months ago

Close this ticket as I think it is resovled.