Skip to content

Commit 5353a3d

Browse files
committed
Regenerate the synchronous client with v7.24.0
OpenAPI Generator v7 removed python-legacy, preventing the synchronous Kubernetes client from moving beyond v6.6.0 and inheriting the modern Python generator's native type information. Regenerate with the released v7.24.0 Python generator, declare its runtime requirements, package py.typed, and refresh the Sphinx API index. Adapt dynamic, stream, watch, OIDC, YAML, leader-election, and example callers to the modern transport and legacy-compatible response behavior. Remove obsolete post-generation hotfixes while retaining the small REST correction that selects strategic merge for built-in object patches and JSON Patch for operation lists. Preserve Kubernetes IntOrString and CRD JSON-schema representations, accept both successful Namespace-delete response shapes, and defer Pydantic call validators so import does not build all 1,872 schemas eagerly. Correct invalid exec and metadata test inputs, and cover these behaviors and asynchronous YAML creation with request-level compatibility tests.
1 parent fb0bd76 commit 5353a3d

1,719 files changed

Lines changed: 446612 additions & 285963 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎MANIFEST.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include OWNERS
33
include *.md
44
include *.txt
55
include *.ini
6+
include kubernetes/client/py.typed
67
exclude .gitignore
78
exclude .gitreview
89

‎devel/release.md‎

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -104,62 +104,29 @@ command:
104104
scripts/update-client.sh
105105
```
106106

107-
**NOTE**: If you see a lot of new or modified files under the `kubernetes/test/`
108-
directory, delete everything except `kubernetes/test/test_api_client.py` and
109-
`kubernetes/test/test_configuration.py`.
110-
111107
Commit changes (should be only version number changes) to the release branch.
112108
Name the commit something like "Update version constants for XXX release".
113109

114-
***After you finished the steps above, refer to the section, "Hot issues", and
115-
apply the manual fixes.***
116-
117110
```bash
118111
git push upstream $RELEASE_BRANCH
119112
```
120113

121-
### 3. Hot issues
122-
123-
Use the `scripts/apply-hotfixes.sh` script to apply the fixes below in one step.
124-
**As mentioned above, the script should be run after finishing the section "Update release tags". Also, ensure a clean working directory before applying the script.**
125-
126-
Commit the manual changes like this [PR](https://github.com/kubernetes-client/python/pull/995/commits) does.
127-
128-
There are some hot issues with the client generation that require manual fixes.
129-
**The steps below are deprecated and only exist for documentation purposess. They should be performed using the `scripts/apply-hotfixes.sh` script mentioned above.**
130-
131-
1. Restore custom object patch behavior. You should apply [this commit](https://github.com/kubernetes-client/python/pull/995/commits/9959273625b999ae9a8f0679c4def2ee7d699ede)
132-
to ensure custom object patch behavior is backwards compatible. For more
133-
details, see [#866](https://github.com/kubernetes-client/python/issues/866) and
134-
[#959](https://github.com/kubernetes-client/python/pull/959).
135-
136-
2. Add alias package kubernetes.client.apis with deprecation warning. You need
137-
to add [this file](https://github.com/kubernetes-client/python/blob/0976d59d6ff206f2f428cabc7a6b7b1144843b2a/kubernetes/client/apis/__init__.py)
138-
under `kubernetes/client/apis/` to ensure the package is backwards compatible.
139-
For more details, see [#974](https://github.com/kubernetes-client/python/issues/974)
140-
141-
3. Add ability to the client to be used as Context Manager [kubernetes-client/python#1073](https://github.com/kubernetes-client/python/pull/1073)
142-
143-
4. Remove the tests directory (ref: https://github.com/kubernetes-client/python/commit/ec9c944f076999543cd2122aff2d86f969d82548). See the [upstream issue](https://github.com/OpenAPITools/openapi-generator/issues/5377) for more information.
144-
145-
5. Add tests for the default `Configuration` behavior (ref: https://github.com/kubernetes-client/python/pull/1303 and https://github.com/kubernetes-client/python/pull/1285). The commit [1ffa61d0650e4c93e0d7f0becd2c54797eafd407](https://github.com/kubernetes-client/python/pull/1285/commits/1ffa61d0650e4c93e0d7f0becd2c54797eafd407) should be cherry-picked.
146-
147-
### 4. CHANGELOG
114+
### 3. CHANGELOG
148115

149116
Make sure the change logs are up to date [here](https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md).
150117
If they are not, follow commits added after the last release and update/commit
151118
the change logs to master.
152119

153120
Then based on the release, follow one of next two steps.
154121

155-
### 5. README
122+
### 4. README
156123

157124
Update the compatibility matrix and maintenance status in the README file.
158125

159126
### Submit pull request
160127

161-
Typically after the you've completed steps 2-6 above you can push your changes
162-
open a pull request against `kubernetes-client:release-x.y`
128+
After completing the steps above, push your changes and open a pull request
129+
against `kubernetes-client:release-x.y`.
163130

164131
## Patch a release branch
165132

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kubernetes.client.api\_response module
2+
======================================
3+
4+
.. automodule:: kubernetes.client.api_response
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

‎doc/source/kubernetes.client.models.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Submodules
206206
kubernetes.client.models.v1_group_resource
207207
kubernetes.client.models.v1_group_subject
208208
kubernetes.client.models.v1_group_version_for_discovery
209+
kubernetes.client.models.v1_group_version_kind
209210
kubernetes.client.models.v1_grpc_action
210211
kubernetes.client.models.v1_horizontal_pod_autoscaler
211212
kubernetes.client.models.v1_horizontal_pod_autoscaler_list
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kubernetes.client.models.v1\_group\_version\_kind module
2+
========================================================
3+
4+
.. automodule:: kubernetes.client.models.v1_group_version_kind
5+
:members:
6+
:show-inheritance:
7+
:undoc-members:

‎doc/source/kubernetes.client.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Submodules
1818
:maxdepth: 4
1919

2020
kubernetes.client.api_client
21+
kubernetes.client.api_response
2122
kubernetes.client.configuration
2223
kubernetes.client.exceptions
2324
kubernetes.client.rest

‎examples/cronjob_crud.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ def create_namespaced_cron_job(namespace='default', body=None):
1818
print(f'{name} exists, please do not repeat!')
1919
else:
2020
v1 = client.BatchV1Api()
21-
ret = v1.create_namespaced_cron_job(namespace=namespace, body=cronjob_json, pretty=True,
22-
_preload_content=False, async_req=False)
21+
ret = v1.create_namespaced_cron_job(
22+
namespace=namespace, body=cronjob_json, pretty='true',
23+
_preload_content=False)
2324
ret_dict = json.loads(ret.data)
2425
print(f'create succeed\n{json.dumps(ret_dict)}')
2526

@@ -32,7 +33,8 @@ def delete_namespaced_cron_job(namespace='default', name=None):
3233
print(f"{name} doesn't exists, please enter a new one!")
3334
else:
3435
v1 = client.BatchV1Api()
35-
ret = v1.delete_namespaced_cron_job(name=name, namespace=namespace, _preload_content=False, async_req=False)
36+
ret = v1.delete_namespaced_cron_job(
37+
name=name, namespace=namespace, _preload_content=False)
3638
ret_dict = json.loads(ret.data)
3739
print(f'delete succeed\n{json.dumps(ret_dict)}')
3840

@@ -45,8 +47,9 @@ def patch_namespaced_cron_job(namespace='default', body=None):
4547
name = body['metadata']['name']
4648
if judge_crontab_exists(namespace, name):
4749
v1 = client.BatchV1Api()
48-
ret = v1.patch_namespaced_cron_job(name=name, namespace=namespace, body=cronjob_json,
49-
_preload_content=False, async_req=False)
50+
ret = v1.patch_namespaced_cron_job(
51+
name=name, namespace=namespace, body=cronjob_json,
52+
_preload_content=False)
5053
ret_dict = json.loads(ret.data)
5154
print(f'patch succeed\n{json.dumps(ret_dict)}')
5255
else:
@@ -55,7 +58,8 @@ def patch_namespaced_cron_job(namespace='default', body=None):
5558

5659
def get_cronjob_list(namespace='default'):
5760
v1 = client.BatchV1Api()
58-
ret = v1.list_namespaced_cron_job(namespace=namespace, pretty=True, _preload_content=False)
61+
ret = v1.list_namespaced_cron_job(
62+
namespace=namespace, pretty='true', _preload_content=False)
5963
cron_job_list = json.loads(ret.data)
6064
print(f'cronjob number={len(cron_job_list["items"])}')
6165
return cron_job_list["items"]

‎examples/dynamic-client/namespaced_custom_resource.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create_namespace(namespace_api, name):
5252
namespace_manifest = {
5353
"apiVersion": "v1",
5454
"kind": "Namespace",
55-
"metadata": {"name": name, "resourceversion": "v1"},
55+
"metadata": {"name": name},
5656
}
5757
namespace_api.create(body=namespace_manifest)
5858

‎examples/dynamic-client/service.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def main():
3636
service_manifest = {
3737
"apiVersion": "v1",
3838
"kind": "Service",
39-
"metadata": {"labels": {"name": name}, "name": name, "resourceversion": "v1"},
39+
"metadata": {"labels": {"name": name}, "name": name},
4040
"spec": {
4141
"ports": [
4242
{"name": "port", "port": 80, "protocol": "TCP", "targetPort": 80}

‎examples/pod_logs_non_blocking.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def stream_logs():
2222
name="log-demo",
2323
namespace="default",
2424
follow=True,
25-
_preload_content=False
25+
_preload_content=False,
2626
)
2727

2828
# 👇 make socket non-blocking with timeout

0 commit comments

Comments
 (0)