Skip to content

Commit 581eeac

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 dict, JSON Patch, and generated model PATCH bodies, Kubernetes IntOrString and CRD JSON-schema representations, and both successful Namespace-delete response shapes. Defer Pydantic call validators so importing does not build all 1,872 schemas eagerly. Restore DynamicClient's JSON discovery default to avoid the literal wildcard Content-Type rejected by API discovery routes. Correct invalid exec and metadata test inputs, cover these behaviors and asynchronous YAML creation with request-level compatibility tests, and document the remaining synchronous breaking changes in the changelog.
1 parent fb0bd76 commit 581eeac

1,720 files changed

Lines changed: 446672 additions & 285964 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.

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
# Breaking Change from upgrading OpenAPI Generator to v7.24.0
2+
3+
The synchronous client now uses the modern Python generator instead of
4+
`python-legacy`. Existing endpoint names, model names, and wire aliases
5+
are preserved, but applications may need the following updates:
6+
7+
- Synchronous runtime dependencies now require `urllib3>=2.6.3,<3`,
8+
`pydantic>=2.11`, `typing-extensions>=4.7.1`, and
9+
`python-dateutil>=2.8.2`. Python 3.10 remains the minimum supported
10+
version. Async generation is unchanged.
11+
- Models and API-call arguments now use Pydantic validation. Invalid,
12+
unknown, or previously coerced values can raise
13+
`pydantic.ValidationError` before a request is sent; models are
14+
keyword-only, reject unknown fields during construction, and validate
15+
assignments. The model `local_vars_configuration` argument and
16+
Configuration's `discard_unknown_keys` and
17+
`disabled_client_side_validations` arguments are removed.
18+
`client_side_validation=False` no longer disables generated
19+
validation.
20+
- Low-level synchronous transport interfaces changed. Direct callers of
21+
`ApiClient.request`, `ApiClient.call_api`, `ApiClient.deserialize`, or
22+
the `RESTClientObject` HTTP-verb helpers must migrate to the modern
23+
request/response interface. `ApiException.body` is now decoded text
24+
instead of bytes.
25+
- `CoreV1Api.delete_namespace` now returns a decoded dictionary rather
26+
than `V1Status`, since a successful deletion can return either a
27+
terminating Namespace or a Status.
28+
29+
See [kubernetes-client/python#2631][python-pr] and
30+
[kubernetes-client/gen#305][gen-pr].
31+
32+
[python-pr]: https://github.com/kubernetes-client/python/pull/2631
33+
[gen-pr]: https://github.com/kubernetes-client/gen/pull/305
34+
135
# v36.0.3
236

337
Kubernetes API Version: v1.36.2

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}

0 commit comments

Comments
 (0)