From 5424e17c85b0dfc655055ced3dd6ee70693c91b0 Mon Sep 17 00:00:00 2001 From: Graham Reed Date: Thu, 30 Jul 2020 18:19:58 +0100 Subject: [PATCH 1/6] Update python base To get auth plugin support for client certificates, ref. kubernetes-client/python-base#205 --- CHANGELOG.md | 1 + kubernetes/base | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9be7065970..278bd029dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Kubernetes API Version: 1.16.14 - Adds the ability to load kubeconfig from a dictionary [kubernetes-client/python-base#195](https://github.com/kubernetes-client/python-base/pull/195) - Allow incluster to accept pass-in config [kubernetes-client/python-base#193](https://github.com/kubernetes-client/python-base/pull/193) - Set expiration on token of incluster config and reload the token if it expires [kubernetes-client/python-base#191](https://github.com/kubernetes-client/python-base/pull/191) +- Accept and use client certificates from authentication plugins [kubernetes-client/python-base#205](https://github.com/kubernetes-client/python-base/pull/205) **Bug Fix:** diff --git a/kubernetes/base b/kubernetes/base index fb86b8acb6..54d188f89e 160000 --- a/kubernetes/base +++ b/kubernetes/base @@ -1 +1 @@ -Subproject commit fb86b8acb66830b098c691fa14f4e6edbf9f7317 +Subproject commit 54d188f89e462e4c829aa9acb44d5c09cc5030ae From b4fb2c9b78b2f7f0af90b6d19d3ac19bc4537106 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Wed, 19 Aug 2020 18:31:11 +0530 Subject: [PATCH 2/6] Generate updated client Signed-off-by: Nabarun Pal --- 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 +- kubernetes/test/test_api_client.py | 25 --------------------- scripts/constants.py | 4 ++-- setup.py | 4 ++-- 10 files changed, 15 insertions(+), 53 deletions(-) delete mode 100644 kubernetes/client/apis/__init__.py delete mode 100644 kubernetes/test/test_api_client.py diff --git a/kubernetes/README.md b/kubernetes/README.md index 1305f5814f..91b682baf4 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.16 -- Package version: 12.0.0a1 +- Package version: 12.0.0b1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index cc1742a338..f85abe66fb 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__ = "12.0.0a1" +__version__ = "12.0.0b1" import kubernetes.client import kubernetes.config diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 7d9b48d4f5..0f9102c7d7 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "12.0.0a1" +__version__ = "12.0.0b1" # 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 1186b0a0f5..00ba8e2068 100644 --- a/kubernetes/client/api/custom_objects_api.py +++ b/kubernetes/client/api/custom_objects_api.py @@ -2405,7 +2405,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 @@ -2574,7 +2574,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 @@ -2743,7 +2743,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 @@ -2921,7 +2921,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 @@ -3099,7 +3099,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 @@ -3277,7 +3277,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 8148693831..c47c2e6994 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/12.0.0a1/python' + self.user_agent = 'OpenAPI-Generator/12.0.0b1/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 e87e18f621..23f7f4b622 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.16\n"\ - "SDK Package Version: 12.0.0a1".\ + "SDK Package Version: 12.0.0b1".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(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/scripts/constants.py b/scripts/constants.py index b19d171055..6cb6f23b3f 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,13 +18,13 @@ KUBERNETES_BRANCH = "release-1.16" # client version for packaging and releasing. -CLIENT_VERSION = "12.0.0a1" +CLIENT_VERSION = "12.0.0b1" # Name of the release package PACKAGE_NAME = "kubernetes" # Stage of development, mainly used in setup.py's classifiers. -DEVELOPMENT_STATUS = "3 - Alpha" +DEVELOPMENT_STATUS = "4 - Beta" # If called directly, return the constant value given diff --git a/setup.py b/setup.py index e55c3ea76b..dbcb865535 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 = "12.0.0a1" +CLIENT_VERSION = "12.0.0b1" PACKAGE_NAME = "kubernetes" -DEVELOPMENT_STATUS = "3 - Alpha" +DEVELOPMENT_STATUS = "4 - Beta" # To install the library, run the following # From a08107f465b8ea35bf975076224411bf4f613017 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Mon, 22 Jun 2020 20:43:11 +0530 Subject: [PATCH 3/6] Fix custom objects API to preserve backward compatibility Reference: - [#866](https://github.com/kubernetes-client/python/issues/866) - [#959](https://github.com/kubernetes-client/python/pull/959) Signed-off-by: Nabarun Pal --- kubernetes/client/api/custom_objects_api.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kubernetes/client/api/custom_objects_api.py b/kubernetes/client/api/custom_objects_api.py index 00ba8e2068..1186b0a0f5 100644 --- a/kubernetes/client/api/custom_objects_api.py +++ b/kubernetes/client/api/custom_objects_api.py @@ -2405,7 +2405,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 @@ -2574,7 +2574,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 @@ -2743,7 +2743,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 @@ -2921,7 +2921,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 @@ -3099,7 +3099,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 @@ -3277,7 +3277,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 From aad4b97f2c1fc4d396faac58841c7ab5f9497ae7 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Mon, 22 Jun 2020 20:46:20 +0530 Subject: [PATCH 4/6] Add kubernetes.client.apis as an alias to kubernetes.client.api Reference: https://github.com/kubernetes-client/python/issues/974 Signed-off-by: Nabarun Pal --- kubernetes/client/apis/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 kubernetes/client/apis/__init__.py 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 +) From 0e9ba9494f953327281629b09d36a4162d73d59b Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Mon, 22 Jun 2020 20:55:37 +0530 Subject: [PATCH 5/6] Cherry pick test for API client context manager The implementation and tests were already picked up by the upstream OpenAPI generator [here](https://github.com/OpenAPITools/openapi-generator/pull/5094). Patching in the tests here for correctness and clarity. Reference: https://github.com/kubernetes-client/python/pull/1073 Signed-off-by: Nabarun Pal --- kubernetes/test/test_api_client.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 kubernetes/test/test_api_client.py 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) From 48230f3428f2f5427766cc9346703a87c1056284 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Wed, 19 Aug 2020 18:38:15 +0530 Subject: [PATCH 6/6] Update the CHANGELOG and README - Adds a bug fix on python-base Ref: https://github.com/kubernetes-client/python-base/pull/201 - https://github.com/kubernetes-client/python/pull/1220 wrongly added changes to the 12.0.0a1 CHANGELOG. We should not modify CHANGELOGs after a release is made. Signed-off-by: Nabarun Pal --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e740bf7e47..98fdafb4a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v12.0.0b1 + +Kubernetes API Version: 1.16.14 + +**New Feature:** +- Accept and use client certificates from authentication plugins [kubernetes-client/python-base#205](https://github.com/kubernetes-client/python-base/pull/205) + +**Bug Fix:** +- Return when object is None in FileOrData class [kubernetes-client/python-base#201](https://github.com/kubernetes-client/python-base/pull/201) + # v12.0.0a1 Kubernetes API Version: 1.16.14 @@ -44,7 +54,6 @@ Kubernetes API Version: 1.16.14 - Adds the ability to load kubeconfig from a dictionary [kubernetes-client/python-base#195](https://github.com/kubernetes-client/python-base/pull/195) - Allow incluster to accept pass-in config [kubernetes-client/python-base#193](https://github.com/kubernetes-client/python-base/pull/193) - Set expiration on token of incluster config and reload the token if it expires [kubernetes-client/python-base#191](https://github.com/kubernetes-client/python-base/pull/191) -- Accept and use client certificates from authentication plugins [kubernetes-client/python-base#205](https://github.com/kubernetes-client/python-base/pull/205) **Bug Fix:**