diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 52ec3560b4..39d14abb2f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,5 +46,5 @@ jobs: if: "matrix.use_coverage" uses: codecov/codecov-action@v3 with: - fail_ci_if_error: true + fail_ci_if_error: false verbose: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5891fa50..5f06a7879d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v26.1.0b1 + +Kubernetes API Version: v1.26.1 + +### Bug or Regression +- The timeout unit of the WSClient update method is now always seconds for both poll and select functions. (#1976, @t-yrka) + +### Feature +- Adds support for loading CA certificates from a file using the `idp-certificate-authority` key for the oidc plugin. (#1916, @vgupta3) + # v26.1.0a1 Kubernetes API Version: v1.26.1 diff --git a/README.md b/README.md index 8b31b50a13..b17e20fb85 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ supported versions of Kubernetes clusters. - [client 23.y.z](https://pypi.org/project/kubernetes/23.6.0/): Kubernetes 1.22 or below (+-), Kubernetes 1.23 (✓), Kubernetes 1.24 or above (+-) - [client 24.y.z](https://pypi.org/project/kubernetes/24.2.0/): Kubernetes 1.23 or below (+-), Kubernetes 1.24 (✓), Kubernetes 1.25 or above (+-) - [client 25.y.z](https://pypi.org/project/kubernetes/25.3.0/): Kubernetes 1.24 or below (+-), Kubernetes 1.25 (✓), Kubernetes 1.26 or above (+-) -- [client 26.y.z](https://pypi.org/project/kubernetes/26.1.0a1/): Kubernetes 1.25 or below (+-), Kubernetes 1.26 (✓), Kubernetes 1.27 or above (+-) +- [client 26.y.z](https://pypi.org/project/kubernetes/26.1.0b1/): Kubernetes 1.25 or below (+-), Kubernetes 1.26 (✓), Kubernetes 1.27 or above (+-) > See [here](#homogenizing-the-kubernetes-python-client-versions) for an explanation of why there is no v13-v16 release. diff --git a/examples/dynamic-client/accept_header.py b/examples/dynamic-client/accept_header.py index 03373380e4..7bc27e3abc 100644 --- a/examples/dynamic-client/accept_header.py +++ b/examples/dynamic-client/accept_header.py @@ -40,4 +40,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/examples/dynamic-client/request_timeout.py b/examples/dynamic-client/request_timeout.py new file mode 100644 index 0000000000..1670ba36d3 --- /dev/null +++ b/examples/dynamic-client/request_timeout.py @@ -0,0 +1,70 @@ +# Copyright 2023 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This example demonstrates the following: + - Creation of a k8s configmap using dynamic-client + - Setting the request timeout which is time duration in seconds +""" + +from kubernetes import config, dynamic +from kubernetes.client import api_client + + +def main(): + # Creating a dynamic client + client = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + # fetching the configmap api + api = client.resources.get(api_version="v1", kind="ConfigMap") + + configmap_name = "request-timeout-test-configmap" + + configmap_manifest = { + "kind": "ConfigMap", + "apiVersion": "v1", + "metadata": { + "name": configmap_name, + "labels": { + "foo": "bar", + }, + }, + "data": { + "config.json": '{"command":"/usr/bin/mysqld_safe"}', + "frontend.cnf": "[mysqld]\nbind-address = 10.0.0.3\n", + }, + } + + # Creating configmap `request-timeout-test-configmap` in the `default` namespace + # Client-side timeout to 60 seconds + + configmap = api.create(body=configmap_manifest, namespace="default", _request_time=60) + + print("\n[INFO] configmap `request-timeout-test-configmap` created\n") + + # Listing the configmaps in the `default` namespace + # Client-side timeout to 60 seconds + + configmap_list = api.get( + name=configmap_name, namespace="default", label_selector="foo=bar", _request_time=60 + ) + + print("NAME:\n%s\n" % (configmap_list.metadata.name)) + print("DATA:\n%s\n" % (configmap_list.data)) + + +if __name__ == "__main__": + main() diff --git a/examples/pod_exec.py b/examples/pod_exec.py index 1e2d9195a6..ecfbe6c28b 100644 --- a/examples/pod_exec.py +++ b/examples/pod_exec.py @@ -71,6 +71,8 @@ def exec_commands(api_instance): '/bin/sh', '-c', 'echo This message goes to stderr; echo This message goes to stdout'] + # When calling a pod with multiple containers running the target container + # has to be specified with a keyword argument container=. resp = stream(api_instance.connect_get_namespaced_pod_exec, name, 'default', diff --git a/examples/watch/timeout-settings.md b/examples/watch/timeout-settings.md index fe8e8d9ebc..ae0828d2d1 100644 --- a/examples/watch/timeout-settings.md +++ b/examples/watch/timeout-settings.md @@ -56,6 +56,9 @@ There are two inputs available in the client, that could be used to set connecti ***Refer*** - *[https://github.com/kubernetes-client/python/blob/v17.17.0/kubernetes/client/api_client.py#L336-L339](https://github.com/kubernetes-client/python/blob/v17.17.0/kubernetes/client/api_client.py#L336-L339)* + ***Example*** + - *[request_timeout.py](../dynamic-client/request_timeout.py)* + - In case of network outage, leading to dropping all packets with no RST/FIN, the timeout value (in seconds) determined by the `request_timeout` argument, would be the time duration for how long the client will wait before dropping the connection. - When the timeout happens, an exception will be raised, for eg. ~ diff --git a/kubernetes/README.md b/kubernetes/README.md index 368591fcaa..23af221ffe 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.26 -- Package version: 26.1.0a1 +- Package version: 26.1.0b1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index aca4e2b7a5..4605597bd1 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__ = "26.1.0a1" +__version__ = "26.1.0b1" from . import client from . import config diff --git a/kubernetes/base/stream/ws_client.py b/kubernetes/base/stream/ws_client.py index 15cc3945fa..4a7356a6da 100644 --- a/kubernetes/base/stream/ws_client.py +++ b/kubernetes/base/stream/ws_client.py @@ -182,6 +182,8 @@ def update(self, timeout=0): if hasattr(select, "poll"): poll = select.poll() poll.register(self.sock.sock, select.POLLIN) + if timeout is not None: + timeout *= 1_000 # poll method uses milliseconds as the time unit r = poll.poll(timeout) poll.unregister(self.sock.sock) else: diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index c4f3a66100..f25a34da00 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "26.1.0a1" +__version__ = "26.1.0b1" # 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 0b5469be3b..227c6928bd 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/26.1.0a1/python' + self.user_agent = 'OpenAPI-Generator/26.1.0b1/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 d84cfc16aa..743bdac359 100644 --- a/kubernetes/client/configuration.py +++ b/kubernetes/client/configuration.py @@ -350,7 +350,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: release-1.26\n"\ - "SDK Package Version: 26.1.0a1".\ + "SDK Package Version: 26.1.0b1".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/kubernetes/utils/quantity.py b/kubernetes/utils/quantity.py index 75ed9fcd89..68e57d9807 100644 --- a/kubernetes/utils/quantity.py +++ b/kubernetes/utils/quantity.py @@ -64,7 +64,7 @@ def parse_quantity(quantity): else: raise ValueError("{} has unknown suffix".format(quantity)) - # handly SI inconsistency + # handle SI inconsistency if suffix == "ki": raise ValueError("{} has unknown suffix".format(quantity)) diff --git a/scripts/constants.py b/scripts/constants.py index 0f7db1b353..00e898b8aa 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,13 +18,13 @@ KUBERNETES_BRANCH = "release-1.26" # client version for packaging and releasing. -CLIENT_VERSION = "26.1.0a1" +CLIENT_VERSION = "26.1.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 cb441284f9..9ff15ecaaa 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 = "26.1.0a1" +CLIENT_VERSION = "26.1.0b1" PACKAGE_NAME = "kubernetes" -DEVELOPMENT_STATUS = "3 - Alpha" +DEVELOPMENT_STATUS = "4 - Beta" # To install the library, run the following #