From 4a5b39d085c168b152d5db168ae7767fc0361edb Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 16 Aug 2021 13:34:42 -0700 Subject: [PATCH 1/4] update version constants for v18 GA release --- scripts/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/constants.py b/scripts/constants.py index beb6dd796c..9eca3c9e5f 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,13 +18,13 @@ KUBERNETES_BRANCH = "release-1.18" # client version for packaging and releasing. -CLIENT_VERSION = "18.20.0b1" +CLIENT_VERSION = "18.20.0" # Name of the release package PACKAGE_NAME = "kubernetes" # Stage of development, mainly used in setup.py's classifiers. -DEVELOPMENT_STATUS = "4 - Beta" +DEVELOPMENT_STATUS = "5 - Production/Stable" # If called directly, return the constant value given From 286bd61dc325fdf3ed07ff79bab9639fe432ae01 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 16 Aug 2021 13:44:53 -0700 Subject: [PATCH 2/4] generated client change for v18 GA release --- kubernetes/README.md | 2 +- kubernetes/__init__.py | 2 +- kubernetes/client/__init__.py | 2 +- kubernetes/client/api/custom_objects_api.py | 12 +++--- kubernetes/client/api_client.py | 2 +- kubernetes/client/apis/__init__.py | 13 ------- kubernetes/client/configuration.py | 2 +- .../models/v1_projected_volume_source.py | 3 ++ kubernetes/test/test_api_client.py | 25 ------------ kubernetes/test/test_configuration.py | 39 ------------------- setup.py | 4 +- 11 files changed, 16 insertions(+), 90 deletions(-) delete mode 100644 kubernetes/client/apis/__init__.py delete mode 100644 kubernetes/test/test_api_client.py delete mode 100644 kubernetes/test/test_configuration.py diff --git a/kubernetes/README.md b/kubernetes/README.md index 13f2126959..bc6861ad97 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -4,7 +4,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: release-1.18 -- Package version: 18.20.0b1 +- Package version: 18.20.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index 2b367f8884..66af35f596 100644 --- a/kubernetes/__init__.py +++ b/kubernetes/__init__.py @@ -14,7 +14,7 @@ __project__ = 'kubernetes' # The version is auto-updated. Please do not edit. -__version__ = "18.20.0b1" +__version__ = "18.20.0" import kubernetes.client import kubernetes.config diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index b47a5b3dab..5f8d5cbd8d 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "18.20.0b1" +__version__ = "18.20.0" # import apis into sdk package from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi diff --git a/kubernetes/client/api/custom_objects_api.py b/kubernetes/client/api/custom_objects_api.py index 2e038a914f..613763b59b 100644 --- a/kubernetes/client/api/custom_objects_api.py +++ b/kubernetes/client/api/custom_objects_api.py @@ -2425,7 +2425,7 @@ def patch_cluster_custom_object_with_http_info(self, group, version, plural, nam # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2594,7 +2594,7 @@ def patch_cluster_custom_object_scale_with_http_info(self, group, version, plura # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2763,7 +2763,7 @@ def patch_cluster_custom_object_status_with_http_info(self, group, version, plur # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2941,7 +2941,7 @@ def patch_namespaced_custom_object_with_http_info(self, group, version, namespac # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -3119,7 +3119,7 @@ def patch_namespaced_custom_object_scale_with_http_info(self, group, version, na # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -3297,7 +3297,7 @@ def patch_namespaced_custom_object_status_with_http_info(self, group, version, n # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/merge-patch+json']) # noqa: E501 + ['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 diff --git a/kubernetes/client/api_client.py b/kubernetes/client/api_client.py index edcdead5f6..88dc7e038d 100644 --- a/kubernetes/client/api_client.py +++ b/kubernetes/client/api_client.py @@ -78,7 +78,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/18.20.0b1/python' + self.user_agent = 'OpenAPI-Generator/18.20.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/kubernetes/client/apis/__init__.py b/kubernetes/client/apis/__init__.py deleted file mode 100644 index ca4b321de2..0000000000 --- a/kubernetes/client/apis/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from __future__ import absolute_import -import warnings - -# flake8: noqa - -# alias kubernetes.client.api package and print deprecation warning -from kubernetes.client.api import * - -warnings.filterwarnings('default', module='kubernetes.client.apis') -warnings.warn( - "The package kubernetes.client.apis is renamed and deprecated, use kubernetes.client.api instead (please note that the trailing s was removed).", - DeprecationWarning -) diff --git a/kubernetes/client/configuration.py b/kubernetes/client/configuration.py index ed81b5164f..c61c070447 100644 --- a/kubernetes/client/configuration.py +++ b/kubernetes/client/configuration.py @@ -347,7 +347,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: release-1.18\n"\ - "SDK Package Version: 18.20.0b1".\ + "SDK Package Version: 18.20.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/kubernetes/client/models/v1_projected_volume_source.py b/kubernetes/client/models/v1_projected_volume_source.py index ab8c66a261..a2f41d730f 100644 --- a/kubernetes/client/models/v1_projected_volume_source.py +++ b/kubernetes/client/models/v1_projected_volume_source.py @@ -99,6 +99,9 @@ def sources(self, sources): :param sources: The sources of this V1ProjectedVolumeSource. # noqa: E501 :type: list[V1VolumeProjection] """ + if self.local_vars_configuration.client_side_validation and sources is None: # noqa: E501 + raise ValueError("Invalid value for `sources`, must not be `None`") # noqa: E501 + self._sources = sources def to_dict(self): diff --git a/kubernetes/test/test_api_client.py b/kubernetes/test/test_api_client.py deleted file mode 100644 index f0a9416cf7..0000000000 --- a/kubernetes/test/test_api_client.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding: utf-8 - - -import atexit -import weakref -import unittest - -import kubernetes - - -class TestApiClient(unittest.TestCase): - - def test_context_manager_closes_threadpool(self): - with kubernetes.client.ApiClient() as client: - self.assertIsNotNone(client.pool) - pool_ref = weakref.ref(client._pool) - self.assertIsNotNone(pool_ref()) - self.assertIsNone(pool_ref()) - - def test_atexit_closes_threadpool(self): - client = kubernetes.client.ApiClient() - self.assertIsNotNone(client.pool) - self.assertIsNotNone(client._pool) - atexit._run_exitfuncs() - self.assertIsNone(client._pool) diff --git a/kubernetes/test/test_configuration.py b/kubernetes/test/test_configuration.py deleted file mode 100644 index 15e065090a..0000000000 --- a/kubernetes/test/test_configuration.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding: utf-8 - -import unittest - -from kubernetes.client import Configuration - -class TestConfiguration(unittest.TestCase): - - def setUp(self): - pass - - def tearDown(self): - # reset Configuration - Configuration.set_default(None) - - def testConfiguration(self): - # check that different instances use different dictionaries - c1 = Configuration() - c2 = Configuration() - self.assertNotEqual(id(c1.api_key), id(c2.api_key)) - self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) - - def testDefaultConfiguration(self): - # prepare default configuration - c1 = Configuration(host="example.com") - c1.debug = True - Configuration.set_default(c1) - - # get default configuration - c2 = Configuration.get_default_copy() - self.assertEqual(c2.host, "example.com") - self.assertTrue(c2.debug) - - self.assertNotEqual(id(c1.api_key), id(c2.api_key)) - self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) - - -if __name__ == '__main__': - unittest.main() diff --git a/setup.py b/setup.py index 28014ceeb8..3c165940fc 100644 --- a/setup.py +++ b/setup.py @@ -16,9 +16,9 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -CLIENT_VERSION = "18.20.0b1" +CLIENT_VERSION = "18.20.0" PACKAGE_NAME = "kubernetes" -DEVELOPMENT_STATUS = "4 - Beta" +DEVELOPMENT_STATUS = "5 - Production/Stable" # To install the library, run the following # From 9e3641da11c7a7216b1d88fd147cfdd07b2f96e7 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 16 Aug 2021 13:47:51 -0700 Subject: [PATCH 3/4] apply hotfixes --- kubernetes/client/api/custom_objects_api.py | 12 +++--- kubernetes/client/apis/__init__.py | 13 +++++++ .../models/v1_projected_volume_source.py | 3 -- kubernetes/test/test_api_client.py | 25 ++++++++++++ kubernetes/test/test_configuration.py | 39 +++++++++++++++++++ 5 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 kubernetes/client/apis/__init__.py create mode 100644 kubernetes/test/test_api_client.py create mode 100644 kubernetes/test/test_configuration.py diff --git a/kubernetes/client/api/custom_objects_api.py b/kubernetes/client/api/custom_objects_api.py index 613763b59b..2e038a914f 100644 --- a/kubernetes/client/api/custom_objects_api.py +++ b/kubernetes/client/api/custom_objects_api.py @@ -2425,7 +2425,7 @@ def patch_cluster_custom_object_with_http_info(self, group, version, plural, nam # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2594,7 +2594,7 @@ def patch_cluster_custom_object_scale_with_http_info(self, group, version, plura # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2763,7 +2763,7 @@ def patch_cluster_custom_object_status_with_http_info(self, group, version, plur # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -2941,7 +2941,7 @@ def patch_namespaced_custom_object_with_http_info(self, group, version, namespac # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -3119,7 +3119,7 @@ def patch_namespaced_custom_object_scale_with_http_info(self, group, version, na # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 @@ -3297,7 +3297,7 @@ def patch_namespaced_custom_object_status_with_http_info(self, group, version, n # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json-patch+json', 'application/merge-patch+json', 'application/apply-patch+yaml']) # noqa: E501 + ['application/merge-patch+json']) # noqa: E501 # Authentication setting auth_settings = ['BearerToken'] # noqa: E501 diff --git a/kubernetes/client/apis/__init__.py b/kubernetes/client/apis/__init__.py new file mode 100644 index 0000000000..ca4b321de2 --- /dev/null +++ b/kubernetes/client/apis/__init__.py @@ -0,0 +1,13 @@ +from __future__ import absolute_import +import warnings + +# flake8: noqa + +# alias kubernetes.client.api package and print deprecation warning +from kubernetes.client.api import * + +warnings.filterwarnings('default', module='kubernetes.client.apis') +warnings.warn( + "The package kubernetes.client.apis is renamed and deprecated, use kubernetes.client.api instead (please note that the trailing s was removed).", + DeprecationWarning +) diff --git a/kubernetes/client/models/v1_projected_volume_source.py b/kubernetes/client/models/v1_projected_volume_source.py index a2f41d730f..ab8c66a261 100644 --- a/kubernetes/client/models/v1_projected_volume_source.py +++ b/kubernetes/client/models/v1_projected_volume_source.py @@ -99,9 +99,6 @@ def sources(self, sources): :param sources: The sources of this V1ProjectedVolumeSource. # noqa: E501 :type: list[V1VolumeProjection] """ - if self.local_vars_configuration.client_side_validation and sources is None: # noqa: E501 - raise ValueError("Invalid value for `sources`, must not be `None`") # noqa: E501 - self._sources = sources def to_dict(self): diff --git a/kubernetes/test/test_api_client.py b/kubernetes/test/test_api_client.py new file mode 100644 index 0000000000..f0a9416cf7 --- /dev/null +++ b/kubernetes/test/test_api_client.py @@ -0,0 +1,25 @@ +# coding: utf-8 + + +import atexit +import weakref +import unittest + +import kubernetes + + +class TestApiClient(unittest.TestCase): + + def test_context_manager_closes_threadpool(self): + with kubernetes.client.ApiClient() as client: + self.assertIsNotNone(client.pool) + pool_ref = weakref.ref(client._pool) + self.assertIsNotNone(pool_ref()) + self.assertIsNone(pool_ref()) + + def test_atexit_closes_threadpool(self): + client = kubernetes.client.ApiClient() + self.assertIsNotNone(client.pool) + self.assertIsNotNone(client._pool) + atexit._run_exitfuncs() + self.assertIsNone(client._pool) diff --git a/kubernetes/test/test_configuration.py b/kubernetes/test/test_configuration.py new file mode 100644 index 0000000000..15e065090a --- /dev/null +++ b/kubernetes/test/test_configuration.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +import unittest + +from kubernetes.client import Configuration + +class TestConfiguration(unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + # reset Configuration + Configuration.set_default(None) + + def testConfiguration(self): + # check that different instances use different dictionaries + c1 = Configuration() + c2 = Configuration() + self.assertNotEqual(id(c1.api_key), id(c2.api_key)) + self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + def testDefaultConfiguration(self): + # prepare default configuration + c1 = Configuration(host="example.com") + c1.debug = True + Configuration.set_default(c1) + + # get default configuration + c2 = Configuration.get_default_copy() + self.assertEqual(c2.host, "example.com") + self.assertTrue(c2.debug) + + self.assertNotEqual(id(c1.api_key), id(c2.api_key)) + self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + +if __name__ == '__main__': + unittest.main() From 5231791f0c1df2ffde9f0407f77ddceb8db08da2 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 16 Aug 2021 13:53:54 -0700 Subject: [PATCH 4/4] update changelog and readme --- CHANGELOG.md | 4 ++-- README.md | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 558c05970f..9c7436846e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -# v18.0.0-snapshot +# v18.20.0 -Kubernetes API Version: To Be Updated +Kubernetes API Version: 1.18.20 ### Feature - Support for the dryRun parameter has been added to the dynamic client. ([kubernetes-client/python-base#247](https://github.com/kubernetes-client/python-base/pull/247), [@gravesm](https://github.com/gravesm)) diff --git a/README.md b/README.md index 7b34d555ab..311190f1cf 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ supported versions of Kubernetes clusters. - [client 11.y.z](https://pypi.org/project/kubernetes/11.0.0/): Kubernetes 1.14 or below (+-), Kubernetes 1.15 (✓), Kubernetes 1.16 or above (+-) - [client 12.y.z](https://pypi.org/project/kubernetes/12.0.1/): Kubernetes 1.15 or below (+-), Kubernetes 1.16 (✓), Kubernetes 1.17 or above (+-) - [client 17.y.z](https://pypi.org/project/kubernetes/17.17.0/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) -- [client 18.y.z](https://pypi.org/project/kubernetes/18.20.0b1/): Kubernetes 1.17 or below (+-), Kubernetes 1.18 (✓), Kubernetes 1.19 or above (+-) +- [client 18.y.z](https://pypi.org/project/kubernetes/18.20.0/): Kubernetes 1.17 or below (+-), Kubernetes 1.18 (✓), Kubernetes 1.19 or above (+-) > See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release. @@ -121,12 +121,13 @@ between client-python versions. | 10.0 Alpha/Beta | Kubernetes main repo, 1.14 branch | ✗ | | 10.0 | Kubernetes main repo, 1.14 branch | ✗ | | 11.0 Alpha/Beta | Kubernetes main repo, 1.15 branch | ✗ | -| 11.0 | Kubernetes main repo, 1.15 branch | ✓ | +| 11.0 | Kubernetes main repo, 1.15 branch | ✗ | | 12.0 Alpha/Beta | Kubernetes main repo, 1.16 branch | ✗ | | 12.0 | Kubernetes main repo, 1.16 branch | ✓ | | 17.0 Alpha/Beta | Kubernetes main repo, 1.17 branch | ✗ | | 17.0 | Kubernetes main repo, 1.17 branch | ✓ | -| 18.0 Alpha/Beta | Kubernetes main repo, 1.18 branch | ✓ | +| 18.0 Alpha/Beta | Kubernetes main repo, 1.18 branch | ✗ | +| 18.0 | Kubernetes main repo, 1.18 branch | ✓ | > See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release.