From 17cf4e16ce73a6b03cfcb0ab9aad07feaecaabc0 Mon Sep 17 00:00:00 2001 From: yliao Date: Fri, 29 May 2026 20:36:26 +0000 Subject: [PATCH 1/4] update changelog with release notes from master branch --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cea65a66e7..a0d5e1d0dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v36.0.2 + +Kubernetes API Version: v1.36.1 + +### Uncategorized +- Restored backward compatibility for `Configuration.auth_settings()`: + the legacy `api_key['authorization']` lookup is honored as a fallback + when `api_key['BearerToken']` is not set, fixing 401 Unauthorized + regressions seen after upgrading to v36.0.0 (#2595). (#2604, @GK-07) + # v36.0.1 Kubernetes API Version: v1.36.1 From d2cb00054278fdaf6f74889f915ac9f58838d1b0 Mon Sep 17 00:00:00 2001 From: yliao Date: Fri, 29 May 2026 20:36:26 +0000 Subject: [PATCH 2/4] update version constants for 36.0.2 release --- scripts/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/constants.py b/scripts/constants.py index f60edaab63..82e81a79e6 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,7 +18,7 @@ KUBERNETES_BRANCH = "release-1.36" # client version for packaging and releasing. -CLIENT_VERSION = "36.0.1" +CLIENT_VERSION = "36.0.2" # Name of the release package PACKAGE_NAME = "kubernetes" From 9683d0601ac2f0b43c9ad6c105d3389397cc9bb8 Mon Sep 17 00:00:00 2001 From: yliao Date: Fri, 29 May 2026 20:37:39 +0000 Subject: [PATCH 3/4] generated client change --- kubernetes/README.md | 2 +- kubernetes/__init__.py | 2 +- kubernetes/aio/README.md | 2 +- kubernetes/aio/__init__.py | 2 +- kubernetes/aio/client/__init__.py | 2 +- kubernetes/aio/client/api_client.py | 2 +- kubernetes/aio/client/api_client.py.orig | 2 +- kubernetes/aio/client/configuration.py | 2 +- kubernetes/aio/client/configuration.py.orig | 2 +- kubernetes/aio/setup.py | 2 +- kubernetes/client/__init__.py | 2 +- kubernetes/client/api_client.py | 2 +- kubernetes/client/configuration.py | 2 +- setup-asyncio.py | 2 +- setup-release.py | 2 +- setup.py | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/kubernetes/README.md b/kubernetes/README.md index ecf376a293..3a9d898799 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.36 -- Package version: 36.0.1 +- Package version: 36.0.2 - Build package: org.openapitools.codegen.languages.PythonLegacyClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index 0eb0bb6c16..84f5bfaee6 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__ = "36.0.1" +__version__ = "36.0.2" from . import client from . import config diff --git a/kubernetes/aio/README.md b/kubernetes/aio/README.md index a24c769708..4d739c65dc 100644 --- a/kubernetes/aio/README.md +++ b/kubernetes/aio/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.36 -- Package version: 36.0.1 +- Package version: 36.0.2 - Build package: org.openapitools.codegen.languages.PythonLegacyClientCodegen ## Requirements. diff --git a/kubernetes/aio/__init__.py b/kubernetes/aio/__init__.py index 7309ef63be..5d74f97f55 100644 --- a/kubernetes/aio/__init__.py +++ b/kubernetes/aio/__init__.py @@ -14,7 +14,7 @@ __project__ = "kubernetes_aio" # The version is auto-updated. Please do not edit. -__version__ = "36.0.1" +__version__ = "36.0.2" import kubernetes.aio.client as client diff --git a/kubernetes/aio/client/__init__.py b/kubernetes/aio/client/__init__.py index 271d87cc43..5323b4bf82 100644 --- a/kubernetes/aio/client/__init__.py +++ b/kubernetes/aio/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "36.0.1" +__version__ = "36.0.2" # import apis into sdk package from kubernetes.aio.client.api.well_known_api import WellKnownApi diff --git a/kubernetes/aio/client/api_client.py b/kubernetes/aio/client/api_client.py index fed8b124b5..4f18901e10 100644 --- a/kubernetes/aio/client/api_client.py +++ b/kubernetes/aio/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/36.0.1/python' + self.user_agent = 'OpenAPI-Generator/36.0.2/python' self.client_side_validation = configuration.client_side_validation async def __aenter__(self): diff --git a/kubernetes/aio/client/api_client.py.orig b/kubernetes/aio/client/api_client.py.orig index ccd36a876e..03d1ac9757 100644 --- a/kubernetes/aio/client/api_client.py.orig +++ b/kubernetes/aio/client/api_client.py.orig @@ -78,7 +78,7 @@ class ApiClient(object): self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/36.0.1/python' + self.user_agent = 'OpenAPI-Generator/36.0.2/python' self.client_side_validation = configuration.client_side_validation async def __aenter__(self): diff --git a/kubernetes/aio/client/configuration.py b/kubernetes/aio/client/configuration.py index 71c0d74d24..3334d3071b 100644 --- a/kubernetes/aio/client/configuration.py +++ b/kubernetes/aio/client/configuration.py @@ -435,7 +435,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: release-1.36\n"\ - "SDK Package Version: 36.0.1".\ + "SDK Package Version: 36.0.2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/kubernetes/aio/client/configuration.py.orig b/kubernetes/aio/client/configuration.py.orig index 73f90f2bd5..9779936845 100644 --- a/kubernetes/aio/client/configuration.py.orig +++ b/kubernetes/aio/client/configuration.py.orig @@ -432,7 +432,7 @@ conf = client.Configuration( "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: release-1.36\n"\ - "SDK Package Version: 36.0.1".\ + "SDK Package Version: 36.0.2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/kubernetes/aio/setup.py b/kubernetes/aio/setup.py index 6c7bbc6353..4f252c56f2 100644 --- a/kubernetes/aio/setup.py +++ b/kubernetes/aio/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "client" -VERSION = "36.0.1" +VERSION = "36.0.2" # To install the library, run the following # # python setup.py install diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 5882145d9a..acb29a2340 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "36.0.1" +__version__ = "36.0.2" # import apis into sdk package from kubernetes.client.api.well_known_api import WellKnownApi diff --git a/kubernetes/client/api_client.py b/kubernetes/client/api_client.py index a6d09827f6..4662b9934c 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/36.0.1/python' + self.user_agent = 'OpenAPI-Generator/36.0.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/kubernetes/client/configuration.py b/kubernetes/client/configuration.py index 70d1e6bb7a..6a6a81c4e0 100644 --- a/kubernetes/client/configuration.py +++ b/kubernetes/client/configuration.py @@ -426,7 +426,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: release-1.36\n"\ - "SDK Package Version: 36.0.1".\ + "SDK Package Version: 36.0.2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/setup-asyncio.py b/setup-asyncio.py index e91b34739b..aef2b09be7 100644 --- a/setup-asyncio.py +++ b/setup-asyncio.py @@ -16,7 +16,7 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -CLIENT_VERSION = "36.0.1" +CLIENT_VERSION = "36.0.2" PACKAGE_NAME = "kubernetes.aio" DEVELOPMENT_STATUS = "5 - Production/Stable" diff --git a/setup-release.py b/setup-release.py index 7406d11358..8cf710992f 100644 --- a/setup-release.py +++ b/setup-release.py @@ -16,7 +16,7 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -CLIENT_VERSION = "36.0.1" +CLIENT_VERSION = "36.0.2" PACKAGE_NAME = "kubernetes" DEVELOPMENT_STATUS = "5 - Production/Stable" diff --git a/setup.py b/setup.py index c94edcf90f..ddd7f41e07 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ # Do not edit these constants. They will be updated automatically # by scripts/update-client.sh. -CLIENT_VERSION = "36.0.1" +CLIENT_VERSION = "36.0.2" PACKAGE_NAME = "kubernetes" DEVELOPMENT_STATUS = "5 - Production/Stable" From 70e680e93bb72bf2b67a42033af9b2180b56c4fd Mon Sep 17 00:00:00 2001 From: yliao Date: Fri, 29 May 2026 20:49:35 +0000 Subject: [PATCH 4/4] Apply hotfix for commit: 5621a4c2cf5cc278e8f45ce759ce44c057f1dbe2 Restore bearer-token fallback in Configuration.auth_settings() --- kubernetes/aio/client/configuration.py | 10 ++++-- kubernetes/client/configuration.py | 10 ++++-- kubernetes/test/test_api_client.py | 42 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/kubernetes/aio/client/configuration.py b/kubernetes/aio/client/configuration.py index 3334d3071b..13dea3c9ab 100644 --- a/kubernetes/aio/client/configuration.py +++ b/kubernetes/aio/client/configuration.py @@ -415,13 +415,19 @@ async def auth_settings(self): :return: The Auth Settings information dict. """ auth = {} - if 'BearerToken' in self.api_key: + # Backward compatibility: prior to v36.0.0 the bearer token was + # stored under the 'authorization' api_key. Continue to honor it + # so user code that sets ``config.api_key['authorization']`` + # directly keeps working with the new 'BearerToken' key the + # generated client now looks for. + # See: https://github.com/kubernetes-client/python/issues/2595 + if 'BearerToken' in self.api_key or 'authorization' in self.api_key: auth['BearerToken'] = { 'type': 'api_key', 'in': 'header', 'key': 'authorization', 'value': await self.get_api_key_with_prefix( - 'BearerToken', + 'BearerToken', alias='authorization', ), } return auth diff --git a/kubernetes/client/configuration.py b/kubernetes/client/configuration.py index 6a6a81c4e0..0797299eb1 100644 --- a/kubernetes/client/configuration.py +++ b/kubernetes/client/configuration.py @@ -406,13 +406,19 @@ def auth_settings(self): :return: The Auth Settings information dict. """ auth = {} - if 'BearerToken' in self.api_key: + # Backward compatibility: prior to v36.0.0 the bearer token was + # stored under the 'authorization' api_key. Continue to honor it + # so user code that sets ``config.api_key['authorization']`` + # directly keeps working with the new 'BearerToken' key the + # generated client now looks for. + # See: https://github.com/kubernetes-client/python/issues/2595 + if 'BearerToken' in self.api_key or 'authorization' in self.api_key: auth['BearerToken'] = { 'type': 'api_key', 'in': 'header', 'key': 'authorization', 'value': self.get_api_key_with_prefix( - 'BearerToken', + 'BearerToken', alias='authorization', ), } return auth diff --git a/kubernetes/test/test_api_client.py b/kubernetes/test/test_api_client.py index 2dd1a0e755..9a7789fd1a 100644 --- a/kubernetes/test/test_api_client.py +++ b/kubernetes/test/test_api_client.py @@ -78,3 +78,45 @@ def test_rest_proxycare(self): # test client = kubernetes.client.ApiClient(configuration=config) self.assertEqual( expected_pool, type(client.rest_client.pool_manager) ) + + +class TestConfigurationAuthSettings(unittest.TestCase): + """Regression tests for Configuration.auth_settings() bearer-token lookup. + + Prior to v36.0.0 the generated client stored the bearer token under + ``api_key['authorization']`` (e.g. set by ``load_kube_config`` or by + user code directly). v36.0.0 switched the lookup to + ``api_key['BearerToken']`` without a fallback, which silently dropped + the Authorization header from every outgoing request and caused 401 + Unauthorized against any cluster relying on bearer tokens. + See: https://github.com/kubernetes-client/python/issues/2595 + """ + + def _bearer_value(self, config): + settings = config.auth_settings() + self.assertIn('BearerToken', settings) + return settings['BearerToken']['value'] + + def test_auth_settings_with_bearer_token_key(self): + """The new key 'BearerToken' continues to work.""" + config = Configuration() + config.api_key['BearerToken'] = 'Bearer abc123' + self.assertEqual(self._bearer_value(config), 'Bearer abc123') + + def test_auth_settings_with_authorization_key(self): + """Legacy key 'authorization' is honored as a fallback.""" + config = Configuration() + config.api_key['authorization'] = 'Bearer abc123' + self.assertEqual(self._bearer_value(config), 'Bearer abc123') + + def test_auth_settings_bearer_token_takes_precedence(self): + """When both keys are set, 'BearerToken' wins.""" + config = Configuration() + config.api_key['BearerToken'] = 'Bearer new' + config.api_key['authorization'] = 'Bearer old' + self.assertEqual(self._bearer_value(config), 'Bearer new') + + def test_auth_settings_with_no_token(self): + """No api_key entry yields an empty auth dict.""" + config = Configuration() + self.assertEqual(config.auth_settings(), {})