From 7bc9f7812d80d141b2911b6dfa0b1b957f066260 Mon Sep 17 00:00:00 2001 From: jonasdlindner Date: Thu, 29 Apr 2021 22:17:17 +0200 Subject: [PATCH 01/24] examples: comment improvement in remote_cluster.py and deployment_create.py --- examples/deployment_create.py | 4 ++++ examples/remote_cluster.py | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/deployment_create.py b/examples/deployment_create.py index ba13440ff8..e17af3b5c9 100644 --- a/examples/deployment_create.py +++ b/examples/deployment_create.py @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +""" +Creates a deployment using AppsV1Api from file nginx-deployment.yaml. +""" + from os import path import yaml diff --git a/examples/remote_cluster.py b/examples/remote_cluster.py index a09e7ed9bb..84ebeb4f64 100644 --- a/examples/remote_cluster.py +++ b/examples/remote_cluster.py @@ -12,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This example demonstrate communication with a remote Kube cluster from a -# server outside of the cluster without kube client installed on it. -# The communication is secured with the use of Bearer token. +""" +This example demonstrates the communication between a remote cluster and a +server outside the cluster without kube client installed on it. +The communication is secured with the use of Bearer token. +""" from kubernetes import client, config From 553f6aedc976c8b1012929c411191e824da19588 Mon Sep 17 00:00:00 2001 From: Priyanka Saggu Date: Sat, 1 May 2021 22:27:20 +0530 Subject: [PATCH 02/24] add-dynamic-client-examples --- .../cluster_scoped_custom_resource.py | 152 ++++++++++++++++ examples/dynamic-client/configmap.py | 85 +++++++++ .../namespaced_custom_resource.py | 164 ++++++++++++++++++ examples/dynamic-client/node.py | 49 ++++++ .../dynamic-client/replication_controller.py | 84 +++++++++ examples/dynamic-client/service.py | 89 ++++++++++ 6 files changed, 623 insertions(+) create mode 100644 examples/dynamic-client/cluster_scoped_custom_resource.py create mode 100644 examples/dynamic-client/configmap.py create mode 100644 examples/dynamic-client/namespaced_custom_resource.py create mode 100644 examples/dynamic-client/node.py create mode 100644 examples/dynamic-client/replication_controller.py create mode 100644 examples/dynamic-client/service.py diff --git a/examples/dynamic-client/cluster_scoped_custom_resource.py b/examples/dynamic-client/cluster_scoped_custom_resource.py new file mode 100644 index 0000000000..9ccb458a62 --- /dev/null +++ b/examples/dynamic-client/cluster_scoped_custom_resource.py @@ -0,0 +1,152 @@ +# Copyright 2021 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 cluster scoped custom resource definition (CRD) using dynamic-client + - Creation of custom resources (CR) using the above created CRD + - List, patch(update), delete the custom resources + - Delete the custom resource defintion +""" + +from kubernetes import config, dynamic +from kubernetes.dynamic.exceptions import ResourceNotFoundError +from kubernetes.client import api_client +import time + + +def main(): + # Creating a dynamic client + client = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + # fetching the custom resource definition (CRD) api + crd_api = client.resources.get( + api_version="apiextensions.k8s.io/v1beta1", kind="CustomResourceDefinition" + ) + + # Creating a Namespaced CRD named "ingressroutes.apps.example.com" + name = "ingressroutes.apps.example.com" + + crd_manifest = { + "apiVersion": "apiextensions.k8s.io/v1beta1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": name, + }, + "spec": { + "group": "apps.example.com", + "names": { + "kind": "IngressRoute", + "listKind": "IngressRouteList", + "plural": "ingressroutes", + "singular": "ingressroute", + }, + "scope": "Cluster", + "version": "v1", + "subresources": {"status": {}}, + }, + } + + crd_creation_respone = crd_api.create(crd_manifest) + print( + "\n[INFO] custom resource definition `ingressroutes.apps.example.com` created\n" + ) + print("%s\t\t%s" % ("SCOPE", "NAME")) + print( + "%s\t\t%s\n" + % (crd_creation_respone.spec.scope, crd_creation_respone.metadata.name) + ) + + # Fetching the "ingressroutes" CRD api + + try: + ingressroute_api = client.resources.get( + api_version="apps.example.com/v1", kind="IngressRoute" + ) + except ResourceNotFoundError: + # Need to wait a sec for the discovery layer to get updated + time.sleep(2) + + ingressroute_api = client.resources.get( + api_version="apps.example.com/v1", kind="IngressRoute" + ) + + # Creating a custom resource (CR) `ingress-route-*`, using the above CRD `ingressroutes.apps.example.com` + + ingressroute_manifest_one = { + "apiVersion": "apps.example.com/v1", + "kind": "IngressRoute", + "metadata": { + "name": "ingress-route-one", + }, + "spec": {}, + } + + ingressroute_manifest_second = { + "apiVersion": "apps.example.com/v1", + "kind": "IngressRoute", + "metadata": { + "name": "ingress-route-second", + }, + "spec": {}, + } + + ingressroute_api.create(body=ingressroute_manifest_one) + ingressroute_api.create(body=ingressroute_manifest_second) + print("\n[INFO] custom resources `ingress-route-*` created\n") + + # Listing the `ingress-route-*` custom resources + + ingress_routes_list = ingressroute_api.get() + print("%s\t\t\t\t%s" % ("NAME", "SPEC")) + for item in ingress_routes_list.items: + print("%s\t\t%s" % (item.metadata.name, item.spec)) + + # Patching the ingressroutes custom resources + + ingressroute_manifest_one["spec"]["entrypoints"] = ["websecure"] + ingressroute_manifest_second["spec"]["entrypoints"] = ["web"] + + patch_ingressroute_one = ingressroute_api.patch( + body=ingressroute_manifest_one, content_type="application/merge-patch+json" + ) + patch_ingressroute_second = ingressroute_api.patch( + body=ingressroute_manifest_second, content_type="application/merge-patch+json" + ) + + print("\n[INFO] custom resources `ingress-route-*` patched\n") + patched_ingress_routes_list = ingressroute_api.get() + print("%s\t\t\t\t%s" % ("NAME", "SPEC")) + for item in patched_ingress_routes_list.items: + print("%s\t\t%s" % (item.metadata.name, item.spec)) + + # Deleting the ingressroutes custom resources + + delete_ingressroute_one = ingressroute_api.delete(name="ingress-route-one") + delete_ingressroute_second = ingressroute_api.delete(name="ingress-route-second") + + print("\n[INFO] custom resources `ingress-route-*` deleted") + + # Deleting the ingressroutes.apps.example.com custom resource definition + + crd_api.delete(name=name) + print( + "\n[INFO] custom resource definition `ingressroutes.apps.example.com` deleted" + ) + + +if __name__ == "__main__": + main() diff --git a/examples/dynamic-client/configmap.py b/examples/dynamic-client/configmap.py new file mode 100644 index 0000000000..15094df6be --- /dev/null +++ b/examples/dynamic-client/configmap.py @@ -0,0 +1,85 @@ +# Copyright 2021 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 + - List, patch(update), delete the configmap +""" + +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 = "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 `test-configmap` in the `default` namespace + + configmap = api.create(body=configmap_manifest, namespace="default") + + print("\n[INFO] configmap `test-configmap` created\n") + + # Listing the configmaps in the `default` namespace + + configmap_list = api.get( + name=configmap_name, namespace="default", label_selector="foo=bar" + ) + + print("NAME:\n%s\n" % (configmap_list.metadata.name)) + print("DATA:\n%s\n" % (configmap_list.data)) + + # Updating the configmap's data, `config.json` + + configmap_manifest["data"]["config.json"] = "{}" + + configmap_patched = api.patch( + name=configmap_name, namespace="default", body=configmap_manifest + ) + + print("\n[INFO] configmap `test-configmap` patched\n") + print("NAME:\n%s\n" % (configmap_patched.metadata.name)) + print("DATA:\n%s\n" % (configmap_patched.data)) + + # Deleting configmap `test-configmap` from the `default` namespace + + configmap_deleted = api.delete(name=configmap_name, body={}, namespace="default") + print("\n[INFO] configmap `test-configmap` deleted\n") + + +if __name__ == "__main__": + main() diff --git a/examples/dynamic-client/namespaced_custom_resource.py b/examples/dynamic-client/namespaced_custom_resource.py new file mode 100644 index 0000000000..ffe63f4c01 --- /dev/null +++ b/examples/dynamic-client/namespaced_custom_resource.py @@ -0,0 +1,164 @@ +# Copyright 2021 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 namespaced scoped custom resource definition (CRD) using dynamic-client + - Creation of custom resources (CR) using the above created CRD + - List, patch(update), delete the custom resources + - Delete the custom resource defintion +""" + +from kubernetes import config, dynamic +from kubernetes.dynamic.exceptions import ResourceNotFoundError +from kubernetes.client import api_client +import time + + +def main(): + # Creating a dynamic client + client = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + # fetching the custom resource definition (CRD) api + crd_api = client.resources.get( + api_version="apiextensions.k8s.io/v1beta1", kind="CustomResourceDefinition" + ) + + # Creating a Namespaced CRD named "ingressroutes.apps.example.com" + name = "ingressroutes.apps.example.com" + + crd_manifest = { + "apiVersion": "apiextensions.k8s.io/v1beta1", + "kind": "CustomResourceDefinition", + "metadata": { + "name": name, + "namespace": "default", + }, + "spec": { + "group": "apps.example.com", + "names": { + "kind": "IngressRoute", + "listKind": "IngressRouteList", + "plural": "ingressroutes", + "singular": "ingressroute", + }, + "scope": "Namespaced", + "version": "v1", + "subresources": {"status": {}}, + }, + } + + crd_creation_respone = crd_api.create(crd_manifest) + print( + "\n[INFO] custom resource definition `ingressroutes.apps.example.com` created\n" + ) + print("%s\t\t%s" % ("SCOPE", "NAME")) + print( + "%s\t%s\n" + % (crd_creation_respone.spec.scope, crd_creation_respone.metadata.name) + ) + + # Fetching the "ingressroutes" CRD api + + try: + ingressroute_api = client.resources.get( + api_version="apps.example.com/v1", kind="IngressRoute" + ) + except ResourceNotFoundError: + # Need to wait a sec for the discovery layer to get updated + time.sleep(2) + + ingressroute_api = client.resources.get( + api_version="apps.example.com/v1", kind="IngressRoute" + ) + + # Creating a custom resource (CR) `ingress-route-*`, using the above CRD `ingressroutes.apps.example.com` + + ingressroute_manifest_one = { + "apiVersion": "apps.example.com/v1", + "kind": "IngressRoute", + "metadata": { + "name": "ingress-route-one", + "namespace": "default", + }, + "spec": {}, + } + + ingressroute_manifest_second = { + "apiVersion": "apps.example.com/v1", + "kind": "IngressRoute", + "metadata": { + "name": "ingress-route-second", + "namespace": "default", + }, + "spec": {}, + } + + ingressroute_api.create(body=ingressroute_manifest_one, namespace="default") + ingressroute_api.create(body=ingressroute_manifest_second, namespace="default") + print("\n[INFO] custom resources `ingress-route-*` created\n") + + # Listing the `ingress-route-*` custom resources + + ingress_routes_list = ingressroute_api.get() + print("%s\t\t\t\t%s\t%s" % ("NAME", "NAMESPACE", "SPEC")) + for item in ingress_routes_list.items: + print( + "%s\t\t%s\t\t%s" % (item.metadata.name, item.metadata.namespace, item.spec) + ) + + # Patching the ingressroutes custom resources + + ingressroute_manifest_one["spec"]["entrypoints"] = ["websecure"] + ingressroute_manifest_second["spec"]["entrypoints"] = ["web"] + + patch_ingressroute_one = ingressroute_api.patch( + body=ingressroute_manifest_one, content_type="application/merge-patch+json" + ) + patch_ingressroute_second = ingressroute_api.patch( + body=ingressroute_manifest_second, content_type="application/merge-patch+json" + ) + + print("\n[INFO] custom resources `ingress-route-*` patched\n") + patched_ingress_routes_list = ingressroute_api.get() + print("%s\t\t\t\t%s\t%s" % ("NAME", "NAMESPACE", "SPEC")) + for item in patched_ingress_routes_list.items: + print( + "%s\t\t%s\t\t%s" + % (item.metadata.name, item.metadata.namespace, str(item.spec)) + ) + + # Deleting the ingressroutes custom resources + + delete_ingressroute_one = ingressroute_api.delete( + name="ingress-route-one", namespace="default" + ) + delete_ingressroute_second = ingressroute_api.delete( + name="ingress-route-second", namespace="default" + ) + + print("\n[INFO] custom resources `ingress-route-*` deleted") + + # Deleting the ingressroutes.apps.example.com custom resource definition + + crd_api.delete(name=name) + print( + "\n[INFO] custom resource definition `ingressroutes.apps.example.com` deleted" + ) + + +if __name__ == "__main__": + main() diff --git a/examples/dynamic-client/node.py b/examples/dynamic-client/node.py new file mode 100644 index 0000000000..6dff9f5eac --- /dev/null +++ b/examples/dynamic-client/node.py @@ -0,0 +1,49 @@ +# Copyright 2021 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 how to list cluster nodes using dynamic client. + +""" + +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 node api + api = client.resources.get(api_version="v1", kind="Node") + + # Listing cluster nodes + + print("%s\t\t%s\t\t%s" % ("NAME", "STATUS", "VERSION")) + for item in api.get().items: + node = api.get(name=item.metadata.name) + print( + "%s\t%s\t\t%s\n" + % ( + node.metadata.name, + node.status.conditions[3]["type"], + node.status.nodeInfo.kubeProxyVersion, + ) + ) + + +if __name__ == "__main__": + main() diff --git a/examples/dynamic-client/replication_controller.py b/examples/dynamic-client/replication_controller.py new file mode 100644 index 0000000000..8c4bd6c21c --- /dev/null +++ b/examples/dynamic-client/replication_controller.py @@ -0,0 +1,84 @@ +# Copyright 2021 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 creation, listing & deletion of a namespaced replication controller using dynamic-client. +""" + +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 replication controller api + api = client.resources.get(api_version="v1", kind="ReplicationController") + + name = "frontend-replication-controller" + + replication_controller_manifest = { + "apiVersion": "v1", + "kind": "ReplicationController", + "metadata": {"labels": {"name": name}, "name": name}, + "spec": { + "replicas": 2, + "selector": {"name": name}, + "template": { + "metadata": {"labels": {"name": name}}, + "spec": { + "containers": [ + { + "image": "nginx", + "name": "nginx", + "ports": [{"containerPort": 80, "protocol": "TCP"}], + } + ] + }, + }, + }, + } + + # Creating replication-controller `frontend-replication-controller` in the `default` namespace + replication_controller = api.create( + body=replication_controller_manifest, namespace="default" + ) + + print("\n[INFO] replication-controller `frontend-replication-controller` created\n") + + # Listing replication-controllers in the `default` namespace + replication_controller_created = api.get(name=name, namespace="default") + + print("%s\t%s\t\t\t\t\t%s" % ("NAMESPACE", "NAME", "REPLICAS")) + print( + "%s\t\t%s\t\t%s\n" + % ( + replication_controller_created.metadata.namespace, + replication_controller_created.metadata.name, + replication_controller_created.spec.replicas, + ) + ) + + # Deleting replication-controller `frontend-service` from the `default` namespace + + replication_controller_deleted = api.delete(name=name, body={}, namespace="default") + + print("[INFO] replication-controller `frontend-replication-controller` deleted\n") + + +if __name__ == "__main__": + main() diff --git a/examples/dynamic-client/service.py b/examples/dynamic-client/service.py new file mode 100644 index 0000000000..63206fd001 --- /dev/null +++ b/examples/dynamic-client/service.py @@ -0,0 +1,89 @@ +# Copyright 2021 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 service using dynamic-client + - List, patch(update), delete the service +""" + +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 service api + api = client.resources.get(api_version="v1", kind="Service") + + name = "frontend-service" + + service_manifest = { + "apiVersion": "v1", + "kind": "Service", + "metadata": {"labels": {"name": name}, "name": name, "resourceversion": "v1"}, + "spec": { + "ports": [ + {"name": "port", "port": 80, "protocol": "TCP", "targetPort": 80} + ], + "selector": {"name": name}, + }, + } + + # Creating service `frontend-service` in the `default` namespace + + service = api.create(body=service_manifest, namespace="default") + + print("\n[INFO] service `frontend-service` created\n") + + # Listing service `frontend-service` in the `default` namespace + service_created = api.get(name=name, namespace="default") + + print("%s\t%s" % ("NAMESPACE", "NAME")) + print( + "%s\t\t%s\n" + % (service_created.metadata.namespace, service_created.metadata.name) + ) + + # Patching the `spec` section of the `frontend-service` + + service_manifest["spec"]["ports"] = [ + {"name": "new", "port": 8080, "protocol": "TCP", "targetPort": 8080} + ] + + service_patched = api.patch(body=service_manifest, name=name, namespace="default") + + print("\n[INFO] service `frontend-service` patched\n") + print("%s\t%s\t\t\t%s" % ("NAMESPACE", "NAME", "PORTS")) + print( + "%s\t\t%s\t%s\n" + % ( + service_patched.metadata.namespace, + service_patched.metadata.name, + service_patched.spec.ports, + ) + ) + + # Deleting service `frontend-service` from the `default` namespace + service_deleted = api.delete(name=name, body={}, namespace="default") + + print("\n[INFO] service `frontend-service` deleted\n") + + +if __name__ == "__main__": + main() From 83f92cc0b50f68fc50eadb4f3ae019135f96952c Mon Sep 17 00:00:00 2001 From: Priyanka Saggu Date: Sun, 2 May 2021 16:23:50 +0530 Subject: [PATCH 03/24] add example to demonstrate a rolling restart of the deployment --- .../deployment_rolling_restart.py | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 examples/dynamic-client/deployment_rolling_restart.py diff --git a/examples/dynamic-client/deployment_rolling_restart.py b/examples/dynamic-client/deployment_rolling_restart.py new file mode 100644 index 0000000000..8218e9e711 --- /dev/null +++ b/examples/dynamic-client/deployment_rolling_restart.py @@ -0,0 +1,120 @@ +# Copyright 2021 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 deployment using dynamic-client + - Rolling restart of the deployment (demonstrate patch/update action) + - Listing & deletion of the deployment +""" + + +from kubernetes import config, dynamic +from kubernetes.client import api_client +import datetime +import pytz + +def main(): + # Creating a dynamic client + client = dynamic.DynamicClient( + api_client.ApiClient(configuration=config.load_kube_config()) + ) + + # fetching the deployment api + api = client.resources.get(api_version="apps/v1", kind="Deployment") + + name = "nginx-deployment" + + deployment_manifest = { + "apiVersion": "apps/v1", + "kind": "Deployment", + "metadata": {"labels": {"app": "nginx"}, "name": name}, + "spec": { + "replicas": 3, + "selector": {"matchLabels": {"app": "nginx"}}, + "template": { + "metadata": {"labels": {"app": "nginx"}}, + "spec": { + "containers": [ + { + "name": "nginx", + "image": "nginx:1.14.2", + "ports": [{"containerPort": 80}], + } + ] + }, + }, + }, + } + + # Creating deployment `nginx-deployment` in the `default` namespace + + deployment = api.create(body=deployment_manifest, namespace="default") + + print("\n[INFO] deployment `nginx-deployment` created\n") + + # Listing deployment `nginx-deployment` in the `default` namespace + + deployment_created = api.get(name=name, namespace="default") + + print("%s\t%s\t\t\t%s\t%s" % ("NAMESPACE", "NAME", "REVISION", "RESTARTED-AT")) + print( + "%s\t\t%s\t%s\t\t%s\n" + % ( + deployment_created.metadata.namespace, + deployment_created.metadata.name, + deployment_created.metadata.annotations, + deployment_created.spec.template.metadata.annotations, + ) + ) + + # Patching the `spec.template.metadata` section to add `kubectl.kubernetes.io/restartedAt` annotation + # In order to perform a rolling restart on the deployment `nginx-deployment` + + deployment_manifest["spec"]["template"]["metadata"] = { + "annotations": { + "kubectl.kubernetes.io/restartedAt": datetime.datetime.utcnow() + .replace(tzinfo=pytz.UTC) + .isoformat() + } + } + + deployment_patched = api.patch( + body=deployment_manifest, name=name, namespace="default" + ) + + print("\n[INFO] deployment `nginx-deployment` restarted\n") + print( + "%s\t%s\t\t\t%s\t\t\t\t\t\t%s" + % ("NAMESPACE", "NAME", "REVISION", "RESTARTED-AT") + ) + print( + "%s\t\t%s\t%s\t\t%s\n" + % ( + deployment_patched.metadata.namespace, + deployment_patched.metadata.name, + deployment_patched.metadata.annotations, + deployment_patched.spec.template.metadata.annotations, + ) + ) + + # Deleting deployment `nginx-deployment` from the `default` namespace + + deployment_deleted = api.delete(name=name, body={}, namespace="default") + + print("\n[INFO] deployment `nginx-deployment` deleted\n") + + +if __name__ == "__main__": + main() From abb2a6ecbd1ddfc134b2f4581590ec677607e821 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Sun, 2 May 2021 20:58:54 -0700 Subject: [PATCH 04/24] update CHANGELOG and README in master branch to reflect the lastest v17 and v18 releases --- CHANGELOG.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 69 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0535b602..db47dd1bf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,70 @@ +# v17.17.0b1 + +Kubernetes API Version: 1.17.17 + +Changelog since v17.14.0a1: + +**New Feature:** +- Add Python 3.9 to build [kubernetes-client/python#1311](https://github.com/kubernetes-client/python/pull/1311) +- Enable leaderelection [kubernetes-client/python#1363](https://github.com/kubernetes-client/python/pull/1363) + +**API Change:** +- Add allowWatchBookmarks, resoureVersionMatch parameters to custom objects. [kubernetes-client/gen#180](https://github.com/kubernetes-client/gen/pull/180) + +**Bug Fix:** +- fix: load cache error when CacheDecoder object is not callable [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) +- raise exception when an empty config file is passed to load_kube_config [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) +- Fix bug with Watch and 410 retries [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227) + +# v18.17.0a1 + +Kubernetes API Version: 1.18.17 + +**Important Information:** + +- The Kubernetes Python client versioning scheme has changed. The version numbers used till Kubernetes Python Client v12.y.z lagged behind the actual Kubernetes minor version numbers. From this release, the client is moving a version format `vY.Z.P` where `Y` and `Z` are respectively from the Kubernetes version `v1.Y.Z` and `P` would incremented due to changes on the Python client side itself. Ref: https://github.com/kubernetes-client/python/issues/1244 +- Python 2 had reached [End of Life](https://www.python.org/doc/sunset-python-2/) on January 1, 2020. The Kubernetes Python Client has dropped support for Python 2 from this release (v18.0.0) and will no longer provide support to older clients as per the [Kubernetes support policy](https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions). + +**Deprecations:** +- The following deprecated APIs can no longer be served: + - All resources under `apps/v1beta1` and `apps/v1beta2` - use `apps/v1` instead + - `daemonsets`, `deployments`, `replicasets` resources under `extensions/v1beta1` - use `apps/v1` instead + - `networkpolicies` resources under `extensions/v1beta1` - use `networking.k8s.io/v1` instead + - `podsecuritypolicies` resources under `extensions/v1beta1` - use `policy/v1beta1` instead ([#85903](https://github.com/kubernetes/kubernetes/pull/85903), [@liggitt](https://github.com/liggitt)) [SIG API Machinery, Apps, Cluster Lifecycle, Instrumentation and Testing] + +**New Feature:** +- Support leader election. [kubernetes-client/python-base#206](https://github.com/kubernetes-client/python-base/pull/206) + +**Bug Fix:** +- Raise exception when an empty config file is passed to load_kube_config. [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) +- fix: load cache error when CacheDecoder object is not callable. [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) +- Fix Watch retries with 410 errors. [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227) +- Automatically handles chunked or non-chunked responses. Fix ResponseNotChunked error from watch. [kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231) + +**API Change:** +- Add allowWatchBookmarks, resoureVersionMatch parameters to custom objects. [kubernetes-client/gen#180](https://github.com/kubernetes-client/gen/pull/180) +- Fix bug in reflector that couldn't recover from "Too large resource version" errors ([#92537](https://github.com/kubernetes/kubernetes/pull/92537), [@wojtek-t](https://github.com/wojtek-t)) [SIG API Machinery] +- Fixed: log timestamps now include trailing zeros to maintain a fixed width ([#91207](https://github.com/kubernetes/kubernetes/pull/91207), [@iamchuckss](https://github.com/iamchuckss)) [SIG Apps and Node] +- Fixed: log timestamps now include trailing zeros to maintain a fixed width ([#91207](https://github.com/kubernetes/kubernetes/pull/91207), [@iamchuckss](https://github.com/iamchuckss)) [SIG Apps and Node] +- Resolve regression in metadata.managedFields handling in update/patch requests submitted by older API clients ([#92007](https://github.com/kubernetes/kubernetes/pull/92007), [@apelisse](https://github.com/apelisse)) [SIG API Machinery and Testing] +- A new IngressClass resource has been added to enable better Ingress configuration. ([#88509](https://github.com/kubernetes/kubernetes/pull/88509), [@robscott](https://github.com/robscott)) [SIG API Machinery, Apps, CLI, Network, Node and Testing] +- The CSIDriver API has graduated to storage.k8s.io/v1, and is now available for use. ([#84814](https://github.com/kubernetes/kubernetes/pull/84814), [@huffmanca](https://github.com/huffmanca)) [SIG Storage] +- autoscaling/v2beta2 HorizontalPodAutoscaler added a `spec.behavior` field that allows scale behavior to be configured. Behaviors are specified separately for scaling up and down. In each direction a stabilization window can be specified as well as a list of policies and how to select amongst them. Policies can limit the absolute number of pods added or removed, or the percentage of pods added or removed. ([#74525](https://github.com/kubernetes/kubernetes/pull/74525), [@gliush](https://github.com/gliush)) [SIG API Machinery, Apps, Autoscaling and CLI] +- Ingress: + - `spec.ingressClassName` replaces the deprecated `kubernetes.io/ingress.class` annotation, and allows associating an Ingress object with a particular controller. + - path definitions added a `pathType` field to allow indicating how the specified path should be matched against incoming requests. Valid values are `Exact`, `Prefix`, and `ImplementationSpecific` ([#88587](https://github.com/kubernetes/kubernetes/pull/88587), [@cmluciano](https://github.com/cmluciano)) [SIG Apps, Cluster Lifecycle and Network] +- The alpha feature `AnyVolumeDataSource` enables PersistentVolumeClaim objects to use the spec.dataSource field to reference a custom type as a data source ([#88636](https://github.com/kubernetes/kubernetes/pull/88636), [@bswartz](https://github.com/bswartz)) [SIG Apps and Storage] +- The alpha feature `ConfigurableFSGroupPolicy` enables v1 Pods to specify a spec.securityContext.fsGroupChangePolicy policy to control how file permissions are applied to volumes mounted into the pod. ([#88488](https://github.com/kubernetes/kubernetes/pull/88488), [@gnufied](https://github.com/gnufied)) [SIG Storage] +- The alpha feature `ServiceAppProtocol` enables setting an `appProtocol` field in ServicePort and EndpointPort definitions. ([#88503](https://github.com/kubernetes/kubernetes/pull/88503), [@robscott](https://github.com/robscott)) [SIG Apps and Network] +- The alpha feature `ImmutableEphemeralVolumes` enables an `immutable` field in both Secret and ConfigMap objects to mark their contents as immutable. ([#86377](https://github.com/kubernetes/kubernetes/pull/86377), [@wojtek-t](https://github.com/wojtek-t)) [SIG Apps, CLI and Testing] +- The beta feature `ServerSideApply` enables tracking and managing changed fields for all new objects, which means there will be `managedFields` in `metadata` with the list of managers and their owned fields. +- The alpha feature `ServiceAccountIssuerDiscovery` enables publishing OIDC discovery information and service account token verification keys at `/.well-known/openid-configuration` and `/openid/v1/jwks` endpoints by API servers configured to issue service account tokens. ([#80724](https://github.com/kubernetes/kubernetes/pull/80724), [@cceckman](https://github.com/cceckman)) [SIG API Machinery, Auth, Cluster Lifecycle and Testing] +- CustomResourceDefinition schemas that use `x-kubernetes-list-map-keys` to specify properties that uniquely identify list items must make those properties required or have a default value, to ensure those properties are present for all list items. See https://kubernetes.io/docs/reference/using-api/api-concepts/#merge-strategy for details. ([#88076](https://github.com/kubernetes/kubernetes/pull/88076), [@eloyekunle](https://github.com/eloyekunle)) [SIG API Machinery and Testing] +- CustomResourceDefinition schemas that use `x-kubernetes-list-type: map` or `x-kubernetes-list-type: set` now enable validation that the list items in the corresponding custom resources are unique. ([#84920](https://github.com/kubernetes/kubernetes/pull/84920), [@sttts](https://github.com/sttts)) [SIG API Machinery] + + +To read the full CHANGELOG visit [here](https://raw.githubusercontent.com/kubernetes/kubernetes/master/CHANGELOG/CHANGELOG-1.18.md). + # v17.14.0a1 Kubernetes API Version: 1.17.14 diff --git a/README.md b/README.md index 6b4fcfe7d3..f91edc0a23 100644 --- a/README.md +++ b/README.md @@ -87,6 +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.14.0a1/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) +- [client 18.y.z](https://pypi.org/project/kubernetes/18.17.0a1/): 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. @@ -124,6 +125,7 @@ between client-python versions. | 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 | ✓ | +| 18.0 Alpha/Beta | 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. From 1ff6ece818c792a5a038f583e36d310855f51125 Mon Sep 17 00:00:00 2001 From: Priyanka Saggu Date: Mon, 3 May 2021 13:32:02 +0530 Subject: [PATCH 05/24] correct CRD's apiVersion, manifest & naming typos --- .../cluster_scoped_custom_resource.py | 117 ++++++++++++---- .../namespaced_custom_resource.py | 129 +++++++++++++----- 2 files changed, 184 insertions(+), 62 deletions(-) diff --git a/examples/dynamic-client/cluster_scoped_custom_resource.py b/examples/dynamic-client/cluster_scoped_custom_resource.py index 9ccb458a62..532a763619 100644 --- a/examples/dynamic-client/cluster_scoped_custom_resource.py +++ b/examples/dynamic-client/cluster_scoped_custom_resource.py @@ -14,10 +14,10 @@ """ This example demonstrates the following: - - Creation of a cluster scoped custom resource definition (CRD) using dynamic-client - - Creation of custom resources (CR) using the above created CRD - - List, patch(update), delete the custom resources - - Delete the custom resource defintion + - Creation of a custom resource definition (CRD) using dynamic-client + - Creation of cluster scoped custom resources (CR) using the above created CRD + - List, patch (update), delete the custom resources + - Delete the custom resource defintion (CRD) """ from kubernetes import config, dynamic @@ -34,40 +34,71 @@ def main(): # fetching the custom resource definition (CRD) api crd_api = client.resources.get( - api_version="apiextensions.k8s.io/v1beta1", kind="CustomResourceDefinition" + api_version="apiextensions.k8s.io/v1", kind="CustomResourceDefinition" ) # Creating a Namespaced CRD named "ingressroutes.apps.example.com" name = "ingressroutes.apps.example.com" crd_manifest = { - "apiVersion": "apiextensions.k8s.io/v1beta1", + "apiVersion": "apiextensions.k8s.io/v1", "kind": "CustomResourceDefinition", "metadata": { "name": name, }, "spec": { "group": "apps.example.com", + "versions": [ + { + "name": "v1", + "schema": { + "openAPIV3Schema": { + "properties": { + "spec": { + "properties": { + "strategy": {"type": "string"}, + "virtualhost": { + "properties": { + "fqdn": {"type": "string"}, + "tls": { + "properties": { + "secretName": {"type": "string"} + }, + "type": "object", + }, + }, + "type": "object", + }, + }, + "type": "object", + } + }, + "type": "object", + } + }, + "served": True, + "storage": True, + } + ], + "scope": "Cluster", "names": { - "kind": "IngressRoute", - "listKind": "IngressRouteList", "plural": "ingressroutes", + "listKind": "IngressRouteList", "singular": "ingressroute", + "kind": "IngressRoute", + "shortNames": ["ir"], }, - "scope": "Cluster", - "version": "v1", - "subresources": {"status": {}}, }, } - crd_creation_respone = crd_api.create(crd_manifest) + crd_creation_response = crd_api.create(crd_manifest) print( "\n[INFO] custom resource definition `ingressroutes.apps.example.com` created\n" ) print("%s\t\t%s" % ("SCOPE", "NAME")) print( "%s\t\t%s\n" - % (crd_creation_respone.spec.scope, crd_creation_respone.metadata.name) + % (crd_creation_response.spec.scope, crd_creation_response.metadata.name) ) # Fetching the "ingressroutes" CRD api @@ -86,13 +117,19 @@ def main(): # Creating a custom resource (CR) `ingress-route-*`, using the above CRD `ingressroutes.apps.example.com` - ingressroute_manifest_one = { + ingressroute_manifest_first = { "apiVersion": "apps.example.com/v1", "kind": "IngressRoute", "metadata": { - "name": "ingress-route-one", + "name": "ingress-route-first", + }, + "spec": { + "virtualhost": { + "fqdn": "www.google.com", + "tls": {"secretName": "google-tls"}, + }, + "strategy": "RoundRobin", }, - "spec": {}, } ingressroute_manifest_second = { @@ -101,41 +138,65 @@ def main(): "metadata": { "name": "ingress-route-second", }, - "spec": {}, + "spec": { + "virtualhost": { + "fqdn": "www.yahoo.com", + "tls": {"secretName": "yahoo-tls"}, + }, + "strategy": "RoundRobin", + }, } - ingressroute_api.create(body=ingressroute_manifest_one) + ingressroute_api.create(body=ingressroute_manifest_first) ingressroute_api.create(body=ingressroute_manifest_second) print("\n[INFO] custom resources `ingress-route-*` created\n") # Listing the `ingress-route-*` custom resources ingress_routes_list = ingressroute_api.get() - print("%s\t\t\t\t%s" % ("NAME", "SPEC")) + print("%s\t\t\t%s\t\t%s\t\t\t\t%s" % ("NAME", "FQDN", "TLS", "STRATEGY")) for item in ingress_routes_list.items: - print("%s\t\t%s" % (item.metadata.name, item.spec)) + print( + "%s\t%s\t%s\t%s" + % ( + item.metadata.name, + item.spec.virtualhost.fqdn, + item.spec.virtualhost.tls, + item.spec.strategy, + ) + ) # Patching the ingressroutes custom resources - ingressroute_manifest_one["spec"]["entrypoints"] = ["websecure"] - ingressroute_manifest_second["spec"]["entrypoints"] = ["web"] + ingressroute_manifest_first["spec"]["strategy"] = "Random" + ingressroute_manifest_second["spec"]["strategy"] = "WeightedLeastRequest" - patch_ingressroute_one = ingressroute_api.patch( - body=ingressroute_manifest_one, content_type="application/merge-patch+json" + patch_ingressroute_first = ingressroute_api.patch( + body=ingressroute_manifest_first, content_type="application/merge-patch+json" ) patch_ingressroute_second = ingressroute_api.patch( body=ingressroute_manifest_second, content_type="application/merge-patch+json" ) - print("\n[INFO] custom resources `ingress-route-*` patched\n") + print( + "\n[INFO] custom resources `ingress-route-*` patched to update the strategy\n" + ) patched_ingress_routes_list = ingressroute_api.get() - print("%s\t\t\t\t%s" % ("NAME", "SPEC")) + print("%s\t\t\t%s\t\t%s\t\t\t\t%s" % ("NAME", "FQDN", "TLS", "STRATEGY")) for item in patched_ingress_routes_list.items: - print("%s\t\t%s" % (item.metadata.name, item.spec)) + print( + "%s\t%s\t%s\t%s" + % ( + item.metadata.name, + item.spec.virtualhost.fqdn, + item.spec.virtualhost.tls, + item.spec.strategy, + ) + ) # Deleting the ingressroutes custom resources - delete_ingressroute_one = ingressroute_api.delete(name="ingress-route-one") + delete_ingressroute_first = ingressroute_api.delete(name="ingress-route-first") delete_ingressroute_second = ingressroute_api.delete(name="ingress-route-second") print("\n[INFO] custom resources `ingress-route-*` deleted") diff --git a/examples/dynamic-client/namespaced_custom_resource.py b/examples/dynamic-client/namespaced_custom_resource.py index ffe63f4c01..3c0a40e0f6 100644 --- a/examples/dynamic-client/namespaced_custom_resource.py +++ b/examples/dynamic-client/namespaced_custom_resource.py @@ -14,10 +14,10 @@ """ This example demonstrates the following: - - Creation of a namespaced scoped custom resource definition (CRD) using dynamic-client - - Creation of custom resources (CR) using the above created CRD - - List, patch(update), delete the custom resources - - Delete the custom resource defintion + - Creation of a custom resource definition (CRD) using dynamic-client + - Creation of namespaced custom resources (CR) using the above CRD + - List, patch (update), delete the custom resources + - Delete the custom resource defintion (CRD) """ from kubernetes import config, dynamic @@ -34,30 +34,58 @@ def main(): # fetching the custom resource definition (CRD) api crd_api = client.resources.get( - api_version="apiextensions.k8s.io/v1beta1", kind="CustomResourceDefinition" + api_version="apiextensions.k8s.io/v1", kind="CustomResourceDefinition" ) # Creating a Namespaced CRD named "ingressroutes.apps.example.com" name = "ingressroutes.apps.example.com" crd_manifest = { - "apiVersion": "apiextensions.k8s.io/v1beta1", + "apiVersion": "apiextensions.k8s.io/v1", "kind": "CustomResourceDefinition", - "metadata": { - "name": name, - "namespace": "default", - }, + "metadata": {"name": name, "namespace": "default"}, "spec": { "group": "apps.example.com", + "versions": [ + { + "name": "v1", + "schema": { + "openAPIV3Schema": { + "properties": { + "spec": { + "properties": { + "strategy": {"type": "string"}, + "virtualhost": { + "properties": { + "fqdn": {"type": "string"}, + "tls": { + "properties": { + "secretName": {"type": "string"} + }, + "type": "object", + }, + }, + "type": "object", + }, + }, + "type": "object", + } + }, + "type": "object", + } + }, + "served": True, + "storage": True, + } + ], + "scope": "Namespaced", "names": { - "kind": "IngressRoute", - "listKind": "IngressRouteList", "plural": "ingressroutes", + "listKind": "IngressRouteList", "singular": "ingressroute", + "kind": "IngressRoute", + "shortNames": ["ir"], }, - "scope": "Namespaced", - "version": "v1", - "subresources": {"status": {}}, }, } @@ -87,14 +115,20 @@ def main(): # Creating a custom resource (CR) `ingress-route-*`, using the above CRD `ingressroutes.apps.example.com` - ingressroute_manifest_one = { + ingressroute_manifest_first = { "apiVersion": "apps.example.com/v1", "kind": "IngressRoute", "metadata": { - "name": "ingress-route-one", + "name": "ingress-route-first", "namespace": "default", }, - "spec": {}, + "spec": { + "virtualhost": { + "fqdn": "www.google.com", + "tls": {"secretName": "google-tls"}, + }, + "strategy": "RoundRobin", + }, } ingressroute_manifest_second = { @@ -104,47 +138,74 @@ def main(): "name": "ingress-route-second", "namespace": "default", }, - "spec": {}, + "spec": { + "virtualhost": { + "fqdn": "www.yahoo.com", + "tls": {"secretName": "yahoo-tls"}, + }, + "strategy": "RoundRobin", + }, } - ingressroute_api.create(body=ingressroute_manifest_one, namespace="default") + ingressroute_api.create(body=ingressroute_manifest_first, namespace="default") ingressroute_api.create(body=ingressroute_manifest_second, namespace="default") print("\n[INFO] custom resources `ingress-route-*` created\n") # Listing the `ingress-route-*` custom resources ingress_routes_list = ingressroute_api.get() - print("%s\t\t\t\t%s\t%s" % ("NAME", "NAMESPACE", "SPEC")) + print( + "%s\t\t\t%s\t%s\t\t%s\t\t\t\t%s" + % ("NAME", "NAMESPACE", "FQDN", "TLS", "STRATEGY") + ) for item in ingress_routes_list.items: print( - "%s\t\t%s\t\t%s" % (item.metadata.name, item.metadata.namespace, item.spec) + "%s\t%s\t\t%s\t%s\t%s" + % ( + item.metadata.name, + item.metadata.namespace, + item.spec.virtualhost.fqdn, + item.spec.virtualhost.tls, + item.spec.strategy, + ) ) # Patching the ingressroutes custom resources - ingressroute_manifest_one["spec"]["entrypoints"] = ["websecure"] - ingressroute_manifest_second["spec"]["entrypoints"] = ["web"] + ingressroute_manifest_first["spec"]["strategy"] = "Random" + ingressroute_manifest_second["spec"]["strategy"] = "WeightedLeastRequest" - patch_ingressroute_one = ingressroute_api.patch( - body=ingressroute_manifest_one, content_type="application/merge-patch+json" + patch_ingressroute_first = ingressroute_api.patch( + body=ingressroute_manifest_first, content_type="application/merge-patch+json" ) patch_ingressroute_second = ingressroute_api.patch( body=ingressroute_manifest_second, content_type="application/merge-patch+json" ) - print("\n[INFO] custom resources `ingress-route-*` patched\n") - patched_ingress_routes_list = ingressroute_api.get() - print("%s\t\t\t\t%s\t%s" % ("NAME", "NAMESPACE", "SPEC")) - for item in patched_ingress_routes_list.items: + print( + "\n[INFO] custom resources `ingress-route-*` patched to update the strategy\n" + ) + ingress_routes_list = ingressroute_api.get() + print( + "%s\t\t\t%s\t%s\t\t%s\t\t\t\t%s" + % ("NAME", "NAMESPACE", "FQDN", "TLS", "STRATEGY") + ) + for item in ingress_routes_list.items: print( - "%s\t\t%s\t\t%s" - % (item.metadata.name, item.metadata.namespace, str(item.spec)) + "%s\t%s\t\t%s\t%s\t%s" + % ( + item.metadata.name, + item.metadata.namespace, + item.spec.virtualhost.fqdn, + item.spec.virtualhost.tls, + item.spec.strategy, + ) ) # Deleting the ingressroutes custom resources - delete_ingressroute_one = ingressroute_api.delete( - name="ingress-route-one", namespace="default" + delete_ingressroute_first = ingressroute_api.delete( + name="ingress-route-first", namespace="default" ) delete_ingressroute_second = ingressroute_api.delete( name="ingress-route-second", namespace="default" From eb952e70f1844a93261e1521d1f7729a9e2b4a4c Mon Sep 17 00:00:00 2001 From: Priyanka Saggu Date: Mon, 3 May 2021 17:05:14 +0530 Subject: [PATCH 06/24] add 'list_ingressroute_for_all_namespaces' method --- .../namespaced_custom_resource.py | 97 ++++++++++++------- 1 file changed, 61 insertions(+), 36 deletions(-) diff --git a/examples/dynamic-client/namespaced_custom_resource.py b/examples/dynamic-client/namespaced_custom_resource.py index 3c0a40e0f6..c577672a37 100644 --- a/examples/dynamic-client/namespaced_custom_resource.py +++ b/examples/dynamic-client/namespaced_custom_resource.py @@ -21,10 +21,44 @@ """ from kubernetes import config, dynamic +from kubernetes import client as k8s_client from kubernetes.dynamic.exceptions import ResourceNotFoundError from kubernetes.client import api_client import time +def list_ingressroute_for_all_namespaces(group, version, plural): + custom_object_api = k8s_client.CustomObjectsApi() + + list_of_ingress_routes = custom_object_api.list_cluster_custom_object( + group, version, plural + ) + print( + "%s\t\t\t%s\t\t\t%s\t\t%s\t\t\t\t%s" + % ("NAME", "NAMESPACE", "FQDN", "TLS", "STRATEGY") + ) + for item in list_of_ingress_routes["items"]: + print( + "%s\t%s\t\t%s\t%s\t%s" + % ( + item["metadata"]["name"], + item["metadata"]["namespace"], + item["spec"]["virtualhost"]["fqdn"], + item["spec"]["virtualhost"]["tls"], + item["spec"]["strategy"] + ) + ) + +def create_namespace(namespace_api, name): + namespace_manifest = { + "apiVersion": "v1", + "kind": "Namespace", + "metadata": {"name": name, "resourceversion": "v1"}, + } + namespace_api.create(body=namespace_manifest) + + +def delete_namespace(namespace_api, name): + namespace_api.delete(name=name) def main(): # Creating a dynamic client @@ -37,6 +71,8 @@ def main(): api_version="apiextensions.k8s.io/v1", kind="CustomResourceDefinition" ) + namespace_api = client.resources.get(api_version="v1", kind="Namespace") + # Creating a Namespaced CRD named "ingressroutes.apps.example.com" name = "ingressroutes.apps.example.com" @@ -115,12 +151,18 @@ def main(): # Creating a custom resource (CR) `ingress-route-*`, using the above CRD `ingressroutes.apps.example.com` + namespace_first = "test-namespace-first" + namespace_second = "test-namespace-second" + + create_namespace(namespace_api, namespace_first) + create_namespace(namespace_api, namespace_second) + ingressroute_manifest_first = { "apiVersion": "apps.example.com/v1", "kind": "IngressRoute", "metadata": { "name": "ingress-route-first", - "namespace": "default", + "namespace": namespace_first, }, "spec": { "virtualhost": { @@ -136,7 +178,7 @@ def main(): "kind": "IngressRoute", "metadata": { "name": "ingress-route-second", - "namespace": "default", + "namespace": namespace_second, }, "spec": { "virtualhost": { @@ -147,28 +189,15 @@ def main(): }, } - ingressroute_api.create(body=ingressroute_manifest_first, namespace="default") - ingressroute_api.create(body=ingressroute_manifest_second, namespace="default") + ingressroute_api.create(body=ingressroute_manifest_first, namespace=namespace_first) + ingressroute_api.create(body=ingressroute_manifest_second, namespace=namespace_second) print("\n[INFO] custom resources `ingress-route-*` created\n") # Listing the `ingress-route-*` custom resources - ingress_routes_list = ingressroute_api.get() - print( - "%s\t\t\t%s\t%s\t\t%s\t\t\t\t%s" - % ("NAME", "NAMESPACE", "FQDN", "TLS", "STRATEGY") + list_ingressroute_for_all_namespaces( + group="apps.example.com", version="v1", plural="ingressroutes" ) - for item in ingress_routes_list.items: - print( - "%s\t%s\t\t%s\t%s\t%s" - % ( - item.metadata.name, - item.metadata.namespace, - item.spec.virtualhost.fqdn, - item.spec.virtualhost.tls, - item.spec.strategy, - ) - ) # Patching the ingressroutes custom resources @@ -185,34 +214,30 @@ def main(): print( "\n[INFO] custom resources `ingress-route-*` patched to update the strategy\n" ) - ingress_routes_list = ingressroute_api.get() - print( - "%s\t\t\t%s\t%s\t\t%s\t\t\t\t%s" - % ("NAME", "NAMESPACE", "FQDN", "TLS", "STRATEGY") + list_ingressroute_for_all_namespaces( + group="apps.example.com", version="v1", plural="ingressroutes" ) - for item in ingress_routes_list.items: - print( - "%s\t%s\t\t%s\t%s\t%s" - % ( - item.metadata.name, - item.metadata.namespace, - item.spec.virtualhost.fqdn, - item.spec.virtualhost.tls, - item.spec.strategy, - ) - ) # Deleting the ingressroutes custom resources delete_ingressroute_first = ingressroute_api.delete( - name="ingress-route-first", namespace="default" + name="ingress-route-first", namespace=namespace_first ) delete_ingressroute_second = ingressroute_api.delete( - name="ingress-route-second", namespace="default" + name="ingress-route-second", namespace=namespace_second ) print("\n[INFO] custom resources `ingress-route-*` deleted") + # Deleting the namespaces + + delete_namespace(namespace_api, namespace_first) + time.sleep(4) + delete_namespace(namespace_api, namespace_second) + time.sleep(4) + + print("\n[INFO] test namespaces deleted") + # Deleting the ingressroutes.apps.example.com custom resource definition crd_api.delete(name=name) From 682dfa26d7ae44689a8c0afbe8018a43f0e1f71c Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Sun, 9 May 2021 14:16:11 -0700 Subject: [PATCH 07/24] generated python-base update --- CHANGELOG.md | 12 ++++++++++++ kubernetes/base | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db47dd1bf8..fda2fad7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# v17.0.0-snapshot + +Kubernetes API Version: To Be Updated + +### Bug or Regression +- Fix watch stream non-chunked response handling ([kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231), [@dhague](https://github.com/dhague)) +- Fixed a decoding error for BOOTMARK watch events ([kubernetes-client/python-base#234](https://github.com/kubernetes-client/python-base/pull/234), [@yliaog](https://github.com/yliaog)) + +### Feature +- Load_kube_config_from_dict() support define custom temp files path ([kubernetes-client/python-base#233](https://github.com/kubernetes-client/python-base/pull/233), [@onecer](https://github.com/onecer)) +- The dynamic client now supports customizing http "Accept" header through the `header_params` parameter, which can be used to customizing API server response, e.g. retrieving object metadata only. ([kubernetes-client/python-base#236](https://github.com/kubernetes-client/python-base/pull/236), [@Yashks1994](https://github.com/Yashks1994)) + # v17.17.0b1 Kubernetes API Version: 1.17.17 diff --git a/kubernetes/base b/kubernetes/base index 060cac10e5..b4d3aad42d 160000 --- a/kubernetes/base +++ b/kubernetes/base @@ -1 +1 @@ -Subproject commit 060cac10e53169c904e0d50b7448233829019e35 +Subproject commit b4d3aad42dc23e7a6c0e5c032691f8dc385a786c From 1f50a6bdb6771ced8c689cc1273b98abef15db44 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Sun, 9 May 2021 14:22:44 -0700 Subject: [PATCH 08/24] update changelog in preparation of the v17.17.0 release --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda2fad7c4..bf79a93014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # v17.0.0-snapshot -Kubernetes API Version: To Be Updated +Kubernetes API Version: 1.17.17 + +Changelog since v17.17.0b1: ### Bug or Regression - Fix watch stream non-chunked response handling ([kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231), [@dhague](https://github.com/dhague)) From bb7bb64845c80854ba4c54e13773f4fad23f5712 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 10 May 2021 08:36:44 -0700 Subject: [PATCH 09/24] add OS X sed check to update-submodule.sh --- scripts/update-submodule.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/update-submodule.sh b/scripts/update-submodule.sh index 86aa5a4b5a..3891b557aa 100755 --- a/scripts/update-submodule.sh +++ b/scripts/update-submodule.sh @@ -31,6 +31,22 @@ set -o errexit set -o nounset set -o pipefail +# OS X sed doesn't support "--version". This way we can tell if OS X sed is +# used. +if ! sed --version &>/dev/null; then + # OS X sed and GNU sed aren't compatible with backup flag "-i". Namely + # sed -i ... - does not work on OS X + # sed -i'' ... - does not work on certain OS X versions + # sed -i '' ... - does not work on GNU + echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead: + $ brew install gnu-sed + $ brew info gnu-sed + # Find the path to the installed gnu-sed and add it to your PATH. The default + # is: + # PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\"" + exit 1 +fi + repo_root="$(git rev-parse --show-toplevel)" declare -r repo_root cd "${repo_root}" From 468115e63f0b4b4dc21d58522ee77ba2a7ccdb9e Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Mon, 10 May 2021 10:24:16 -0700 Subject: [PATCH 10/24] refactor OS X sed check into a util --- scripts/update-client.sh | 21 ++++----------------- scripts/update-submodule.sh | 18 +++--------------- scripts/util/common.sh | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 scripts/util/common.sh diff --git a/scripts/update-client.sh b/scripts/update-client.sh index f27ca60d4f..0145dd0298 100755 --- a/scripts/update-client.sh +++ b/scripts/update-client.sh @@ -24,22 +24,6 @@ set -o pipefail # The openapi-generator version used by this client export OPENAPI_GENERATOR_COMMIT="v4.3.0" -# OS X sed doesn't support "--version". This way we can tell if OS X sed is -# used. -if ! sed --version &>/dev/null; then - # OS X sed and GNU sed aren't compatible with backup flag "-i". Namely - # sed -i ... - does not work on OS X - # sed -i'' ... - does not work on certain OS X versions - # sed -i '' ... - does not work on GNU - echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead: - $ brew install gnu-sed - $ brew info gnu-sed - # Find the path to the installed gnu-sed and add it to your PATH. The default - # is: - # PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\"" - exit 1 -fi - SCRIPT_ROOT=$(dirname "${BASH_SOURCE}") CLIENT_ROOT="${SCRIPT_ROOT}/../kubernetes" CLIENT_VERSION=$(python "${SCRIPT_ROOT}/constants.py" CLIENT_VERSION) @@ -50,11 +34,14 @@ pushd "${SCRIPT_ROOT}" > /dev/null SCRIPT_ROOT=`pwd` popd > /dev/null +source ${SCRIPT_ROOT}/util/common.sh +util::common::check_sed + pushd "${CLIENT_ROOT}" > /dev/null CLIENT_ROOT=`pwd` popd > /dev/null -TEMP_FOLDER=$(mktemp -d) +TEMP_FOLDER=$(mktemp -d) trap "rm -rf ${TEMP_FOLDER}" EXIT SIGINT SETTING_FILE="${TEMP_FOLDER}/settings" diff --git a/scripts/update-submodule.sh b/scripts/update-submodule.sh index 3891b557aa..2ef51eebbc 100755 --- a/scripts/update-submodule.sh +++ b/scripts/update-submodule.sh @@ -31,27 +31,15 @@ set -o errexit set -o nounset set -o pipefail -# OS X sed doesn't support "--version". This way we can tell if OS X sed is -# used. -if ! sed --version &>/dev/null; then - # OS X sed and GNU sed aren't compatible with backup flag "-i". Namely - # sed -i ... - does not work on OS X - # sed -i'' ... - does not work on certain OS X versions - # sed -i '' ... - does not work on GNU - echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead: - $ brew install gnu-sed - $ brew info gnu-sed - # Find the path to the installed gnu-sed and add it to your PATH. The default - # is: - # PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\"" - exit 1 -fi repo_root="$(git rev-parse --show-toplevel)" declare -r repo_root cd "${repo_root}" source scripts/util/changelog.sh +source scripts/util/common.sh + +util::common::check_sed go get k8s.io/release/cmd/release-notes TARGET_RELEASE=${TARGET_RELEASE:-"v$(grep "^CLIENT_VERSION = \"" scripts/constants.py | sed "s/CLIENT_VERSION = \"//g" | sed "s/\"//g")"} diff --git a/scripts/util/common.sh b/scripts/util/common.sh new file mode 100644 index 0000000000..0955d597b2 --- /dev/null +++ b/scripts/util/common.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Copyright 2021 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. + +# check_sed returns an error and suggests installing GNU sed, if OS X sed is +# detected. +function util::common::check_sed { + # OS X sed doesn't support "--version". This way we can tell if OS X sed is + # used. + if ! sed --version &>/dev/null; then + # OS X sed and GNU sed aren't compatible with backup flag "-i". Namely + # sed -i ... - does not work on OS X + # sed -i'' ... - does not work on certain OS X versions + # sed -i '' ... - does not work on GNU + echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead: + $ brew install gnu-sed + $ brew info gnu-sed + # Find the path to the installed gnu-sed and add it to your PATH. The default + # is: + # PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\"" + exit 1 + fi +} From f73c609237dd78eed11bc05145aeb0a90805eb4b Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Fri, 13 Nov 2020 18:10:59 +0530 Subject: [PATCH 11/24] Update constants to reflect Client release 17.14.0a1 Signed-off-by: Nabarun Pal --- scripts/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/constants.py b/scripts/constants.py index 084911e92c..bcb9c8c9ee 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,7 +18,7 @@ KUBERNETES_BRANCH = "release-1.17" # client version for packaging and releasing. -CLIENT_VERSION = "17.0.0-snapshot" +CLIENT_VERSION = "17.14.0a1" # Name of the release package PACKAGE_NAME = "kubernetes" From 856b8fc344e521829a82c8a9618b6e2cf8d42a71 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Fri, 13 Nov 2020 18:11:41 +0530 Subject: [PATCH 12/24] Generate client 17.14.0a1 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 ------------- kubernetes/test/test_configuration.py | 39 --------------------- setup.py | 2 +- 10 files changed, 12 insertions(+), 89 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 8272295856..ff95e2340c 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.17 -- Package version: 17.0.0-snapshot +- Package version: 17.14.0a1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index 1ff790d7d2..768883d1fc 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__ = "17.0.0-snapshot" +__version__ = "17.14.0a1" import kubernetes.client import kubernetes.config diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 0c10454110..39c538b715 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "17.0.0-snapshot" +__version__ = "17.14.0a1" # 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 96e875686d..69c54c9d4c 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 622d721b97..79fc544b82 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/17.0.0-snapshot/python' + self.user_agent = 'OpenAPI-Generator/17.14.0a1/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 be111c8a3d..faedfcd80d 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.17\n"\ - "SDK Package Version: 17.0.0-snapshot".\ + "SDK Package Version: 17.14.0a1".\ 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/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 e5bafcf8f5..236f68d9e9 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 = "17.0.0-snapshot" +CLIENT_VERSION = "17.14.0a1" PACKAGE_NAME = "kubernetes" DEVELOPMENT_STATUS = "3 - Alpha" From e74d3badff5cdb35b1f4276f7cd6dce5afa1fc87 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Mon, 22 Jun 2020 20:43:11 +0530 Subject: [PATCH 13/24] 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 69c54c9d4c..96e875686d 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 c203601130c7cac93b072f523bacfe03081c7fcd Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Mon, 22 Jun 2020 20:46:20 +0530 Subject: [PATCH 14/24] 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 7574d7701f6b21ee95a9979ffd98723c52cb43f5 Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Thu, 6 Feb 2020 12:37:16 -0500 Subject: [PATCH 15/24] Add test to ensure kubernetes client threadpool is cleaned up --- 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 871110c9d4d0f44ac2f593a593e954d5b772a4d8 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Tue, 3 Nov 2020 17:53:30 -0800 Subject: [PATCH 16/24] add a test for default configuration behavior --- kubernetes/test/test_configuration.py | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 kubernetes/test/test_configuration.py 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 c293c6474e3c0f244a2919053513275524b55ceb Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Fri, 13 Nov 2020 18:18:50 +0530 Subject: [PATCH 17/24] Update CHANGELOG with v17.14.0a1 Signed-off-by: Nabarun Pal --- CHANGELOG.md | 81 ---------------------------------------------------- 1 file changed, 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf79a93014..fc0535b602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,84 +1,3 @@ -# v17.0.0-snapshot - -Kubernetes API Version: 1.17.17 - -Changelog since v17.17.0b1: - -### Bug or Regression -- Fix watch stream non-chunked response handling ([kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231), [@dhague](https://github.com/dhague)) -- Fixed a decoding error for BOOTMARK watch events ([kubernetes-client/python-base#234](https://github.com/kubernetes-client/python-base/pull/234), [@yliaog](https://github.com/yliaog)) - -### Feature -- Load_kube_config_from_dict() support define custom temp files path ([kubernetes-client/python-base#233](https://github.com/kubernetes-client/python-base/pull/233), [@onecer](https://github.com/onecer)) -- The dynamic client now supports customizing http "Accept" header through the `header_params` parameter, which can be used to customizing API server response, e.g. retrieving object metadata only. ([kubernetes-client/python-base#236](https://github.com/kubernetes-client/python-base/pull/236), [@Yashks1994](https://github.com/Yashks1994)) - -# v17.17.0b1 - -Kubernetes API Version: 1.17.17 - -Changelog since v17.14.0a1: - -**New Feature:** -- Add Python 3.9 to build [kubernetes-client/python#1311](https://github.com/kubernetes-client/python/pull/1311) -- Enable leaderelection [kubernetes-client/python#1363](https://github.com/kubernetes-client/python/pull/1363) - -**API Change:** -- Add allowWatchBookmarks, resoureVersionMatch parameters to custom objects. [kubernetes-client/gen#180](https://github.com/kubernetes-client/gen/pull/180) - -**Bug Fix:** -- fix: load cache error when CacheDecoder object is not callable [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) -- raise exception when an empty config file is passed to load_kube_config [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) -- Fix bug with Watch and 410 retries [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227) - -# v18.17.0a1 - -Kubernetes API Version: 1.18.17 - -**Important Information:** - -- The Kubernetes Python client versioning scheme has changed. The version numbers used till Kubernetes Python Client v12.y.z lagged behind the actual Kubernetes minor version numbers. From this release, the client is moving a version format `vY.Z.P` where `Y` and `Z` are respectively from the Kubernetes version `v1.Y.Z` and `P` would incremented due to changes on the Python client side itself. Ref: https://github.com/kubernetes-client/python/issues/1244 -- Python 2 had reached [End of Life](https://www.python.org/doc/sunset-python-2/) on January 1, 2020. The Kubernetes Python Client has dropped support for Python 2 from this release (v18.0.0) and will no longer provide support to older clients as per the [Kubernetes support policy](https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions). - -**Deprecations:** -- The following deprecated APIs can no longer be served: - - All resources under `apps/v1beta1` and `apps/v1beta2` - use `apps/v1` instead - - `daemonsets`, `deployments`, `replicasets` resources under `extensions/v1beta1` - use `apps/v1` instead - - `networkpolicies` resources under `extensions/v1beta1` - use `networking.k8s.io/v1` instead - - `podsecuritypolicies` resources under `extensions/v1beta1` - use `policy/v1beta1` instead ([#85903](https://github.com/kubernetes/kubernetes/pull/85903), [@liggitt](https://github.com/liggitt)) [SIG API Machinery, Apps, Cluster Lifecycle, Instrumentation and Testing] - -**New Feature:** -- Support leader election. [kubernetes-client/python-base#206](https://github.com/kubernetes-client/python-base/pull/206) - -**Bug Fix:** -- Raise exception when an empty config file is passed to load_kube_config. [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) -- fix: load cache error when CacheDecoder object is not callable. [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) -- Fix Watch retries with 410 errors. [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227) -- Automatically handles chunked or non-chunked responses. Fix ResponseNotChunked error from watch. [kubernetes-client/python-base#231](https://github.com/kubernetes-client/python-base/pull/231) - -**API Change:** -- Add allowWatchBookmarks, resoureVersionMatch parameters to custom objects. [kubernetes-client/gen#180](https://github.com/kubernetes-client/gen/pull/180) -- Fix bug in reflector that couldn't recover from "Too large resource version" errors ([#92537](https://github.com/kubernetes/kubernetes/pull/92537), [@wojtek-t](https://github.com/wojtek-t)) [SIG API Machinery] -- Fixed: log timestamps now include trailing zeros to maintain a fixed width ([#91207](https://github.com/kubernetes/kubernetes/pull/91207), [@iamchuckss](https://github.com/iamchuckss)) [SIG Apps and Node] -- Fixed: log timestamps now include trailing zeros to maintain a fixed width ([#91207](https://github.com/kubernetes/kubernetes/pull/91207), [@iamchuckss](https://github.com/iamchuckss)) [SIG Apps and Node] -- Resolve regression in metadata.managedFields handling in update/patch requests submitted by older API clients ([#92007](https://github.com/kubernetes/kubernetes/pull/92007), [@apelisse](https://github.com/apelisse)) [SIG API Machinery and Testing] -- A new IngressClass resource has been added to enable better Ingress configuration. ([#88509](https://github.com/kubernetes/kubernetes/pull/88509), [@robscott](https://github.com/robscott)) [SIG API Machinery, Apps, CLI, Network, Node and Testing] -- The CSIDriver API has graduated to storage.k8s.io/v1, and is now available for use. ([#84814](https://github.com/kubernetes/kubernetes/pull/84814), [@huffmanca](https://github.com/huffmanca)) [SIG Storage] -- autoscaling/v2beta2 HorizontalPodAutoscaler added a `spec.behavior` field that allows scale behavior to be configured. Behaviors are specified separately for scaling up and down. In each direction a stabilization window can be specified as well as a list of policies and how to select amongst them. Policies can limit the absolute number of pods added or removed, or the percentage of pods added or removed. ([#74525](https://github.com/kubernetes/kubernetes/pull/74525), [@gliush](https://github.com/gliush)) [SIG API Machinery, Apps, Autoscaling and CLI] -- Ingress: - - `spec.ingressClassName` replaces the deprecated `kubernetes.io/ingress.class` annotation, and allows associating an Ingress object with a particular controller. - - path definitions added a `pathType` field to allow indicating how the specified path should be matched against incoming requests. Valid values are `Exact`, `Prefix`, and `ImplementationSpecific` ([#88587](https://github.com/kubernetes/kubernetes/pull/88587), [@cmluciano](https://github.com/cmluciano)) [SIG Apps, Cluster Lifecycle and Network] -- The alpha feature `AnyVolumeDataSource` enables PersistentVolumeClaim objects to use the spec.dataSource field to reference a custom type as a data source ([#88636](https://github.com/kubernetes/kubernetes/pull/88636), [@bswartz](https://github.com/bswartz)) [SIG Apps and Storage] -- The alpha feature `ConfigurableFSGroupPolicy` enables v1 Pods to specify a spec.securityContext.fsGroupChangePolicy policy to control how file permissions are applied to volumes mounted into the pod. ([#88488](https://github.com/kubernetes/kubernetes/pull/88488), [@gnufied](https://github.com/gnufied)) [SIG Storage] -- The alpha feature `ServiceAppProtocol` enables setting an `appProtocol` field in ServicePort and EndpointPort definitions. ([#88503](https://github.com/kubernetes/kubernetes/pull/88503), [@robscott](https://github.com/robscott)) [SIG Apps and Network] -- The alpha feature `ImmutableEphemeralVolumes` enables an `immutable` field in both Secret and ConfigMap objects to mark their contents as immutable. ([#86377](https://github.com/kubernetes/kubernetes/pull/86377), [@wojtek-t](https://github.com/wojtek-t)) [SIG Apps, CLI and Testing] -- The beta feature `ServerSideApply` enables tracking and managing changed fields for all new objects, which means there will be `managedFields` in `metadata` with the list of managers and their owned fields. -- The alpha feature `ServiceAccountIssuerDiscovery` enables publishing OIDC discovery information and service account token verification keys at `/.well-known/openid-configuration` and `/openid/v1/jwks` endpoints by API servers configured to issue service account tokens. ([#80724](https://github.com/kubernetes/kubernetes/pull/80724), [@cceckman](https://github.com/cceckman)) [SIG API Machinery, Auth, Cluster Lifecycle and Testing] -- CustomResourceDefinition schemas that use `x-kubernetes-list-map-keys` to specify properties that uniquely identify list items must make those properties required or have a default value, to ensure those properties are present for all list items. See https://kubernetes.io/docs/reference/using-api/api-concepts/#merge-strategy for details. ([#88076](https://github.com/kubernetes/kubernetes/pull/88076), [@eloyekunle](https://github.com/eloyekunle)) [SIG API Machinery and Testing] -- CustomResourceDefinition schemas that use `x-kubernetes-list-type: map` or `x-kubernetes-list-type: set` now enable validation that the list items in the corresponding custom resources are unique. ([#84920](https://github.com/kubernetes/kubernetes/pull/84920), [@sttts](https://github.com/sttts)) [SIG API Machinery] - - -To read the full CHANGELOG visit [here](https://raw.githubusercontent.com/kubernetes/kubernetes/master/CHANGELOG/CHANGELOG-1.18.md). - # v17.14.0a1 Kubernetes API Version: 1.17.14 From b59092497642d506853e2fb0d8f44f8087508a93 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Sat, 14 Nov 2020 02:48:32 +0530 Subject: [PATCH 18/24] Refactor the format of compatibitility matrix Signed-off-by: Nabarun Pal --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index f91edc0a23..e3c2acaef9 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,6 @@ supported versions of Kubernetes clusters. - [client 10.y.z](https://pypi.org/project/kubernetes/10.1.0/): Kubernetes 1.13 or below (+-), Kubernetes 1.14 (✓), Kubernetes 1.14 or above (+-) - [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.14.0a1/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) -- [client 18.y.z](https://pypi.org/project/kubernetes/18.17.0a1/): 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. Key: From 27e3b670bc9d261de35c29a3779035127360ab4c Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Tue, 17 Nov 2020 03:18:40 +0530 Subject: [PATCH 19/24] Add v17.14.0a1 to the compatibility matrix Signed-off-by: Nabarun Pal --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3c2acaef9..bd8f011f81 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ supported versions of Kubernetes clusters. - [client 10.y.z](https://pypi.org/project/kubernetes/10.1.0/): Kubernetes 1.13 or below (+-), Kubernetes 1.14 (✓), Kubernetes 1.14 or above (+-) - [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.14.0a1/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) Key: From 2afe18d942121afa078a8c02e7dc6c4d63cd9185 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Tue, 17 Nov 2020 03:28:22 +0530 Subject: [PATCH 20/24] Add a note about the change in client versioning schema Signed-off-by: Nabarun Pal --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index bd8f011f81..e4ba321a0c 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ supported versions of Kubernetes clusters. - [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.14.0a1/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) +> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release. + Key: * `✓` Exactly the same features / API objects in both client-python and the Kubernetes @@ -126,6 +128,8 @@ between client-python versions. > See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release. +> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release. + Key: * `✓` Changes in main Kubernetes repo are manually ([should be automated](https://github.com/kubernetes-client/python/issues/177)) published to client-python when they are available. From 291ee0d87b68670be2150687aba13990e8853801 Mon Sep 17 00:00:00 2001 From: Haowei Cai Date: Fri, 30 Apr 2021 11:01:58 -0700 Subject: [PATCH 21/24] changelog for pulling master and corresponding submodule changes --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0535b602..38a555ab3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# v17.17.0b1 + +Kubernetes API Version: 1.17.17 + +Changelog since v17.14.0a1: + +**New Feature:** +- Add Python 3.9 to build [kubernetes-client/python#1311](https://github.com/kubernetes-client/python/pull/1311) +- Enable leaderelection [kubernetes-client/python#1363](https://github.com/kubernetes-client/python/pull/1363) + +**Bug Fix:** +- fix: load cache error when CacheDecoder object is not callable [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) +- raise exception when an empty config file is passed to load_kube_config [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) +- Fix bug with Watch and 410 retries [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227) + # v17.14.0a1 Kubernetes API Version: 1.17.14 From bdab88a1ccbbb55bc7993a2b419019c51ee47cfb Mon Sep 17 00:00:00 2001 From: Scott Lee Date: Sat, 1 May 2021 10:20:32 -0700 Subject: [PATCH 22/24] Beta release of 1.17 Update release branch and release tags Apply hotfixes Remove generated tests Address comments --- CHANGELOG.md | 3 ++ kubernetes/.gitlab-ci.yml | 33 +++++++++++++++++++ .../.openapi-generator/swagger.json.sha256 | 2 +- kubernetes/README.md | 2 +- kubernetes/__init__.py | 2 +- kubernetes/client/__init__.py | 2 +- kubernetes/client/api/custom_objects_api.py | 20 +++++++++++ kubernetes/client/api_client.py | 2 +- kubernetes/client/configuration.py | 2 +- kubernetes/docs/CustomObjectsApi.md | 16 ++++++--- kubernetes/setup.cfg | 2 ++ scripts/constants.py | 4 +-- scripts/swagger.json | 28 ++++++++++++++++ setup.py | 4 +-- 14 files changed, 108 insertions(+), 14 deletions(-) create mode 100644 kubernetes/.gitlab-ci.yml create mode 100644 kubernetes/setup.cfg diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a555ab3c..12b1d6d464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Changelog since v17.14.0a1: - Add Python 3.9 to build [kubernetes-client/python#1311](https://github.com/kubernetes-client/python/pull/1311) - Enable leaderelection [kubernetes-client/python#1363](https://github.com/kubernetes-client/python/pull/1363) +**API Change:** +- Add allowWatchBookmarks, resoureVersionMatch parameters to custom objects. [kubernetes-client/gen#180](https://github.com/kubernetes-client/gen/pull/180) + **Bug Fix:** - fix: load cache error when CacheDecoder object is not callable [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226) - raise exception when an empty config file is passed to load_kube_config [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223) diff --git a/kubernetes/.gitlab-ci.yml b/kubernetes/.gitlab-ci.yml new file mode 100644 index 0000000000..3c5125d395 --- /dev/null +++ b/kubernetes/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=client + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/kubernetes/.openapi-generator/swagger.json.sha256 b/kubernetes/.openapi-generator/swagger.json.sha256 index c0afd659c4..a9f900e298 100644 --- a/kubernetes/.openapi-generator/swagger.json.sha256 +++ b/kubernetes/.openapi-generator/swagger.json.sha256 @@ -1 +1 @@ -04859ba873ac89c62207ee4a60256edc321314c7d8521c5fd7fba41a1290d637 \ No newline at end of file +7efcb256011a28b93d9484abc205afaa57150cdcd8d375e04330fcb51cef64db \ No newline at end of file diff --git a/kubernetes/README.md b/kubernetes/README.md index ff95e2340c..3ea44eb007 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.17 -- Package version: 17.14.0a1 +- Package version: 17.17.0b1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index 768883d1fc..7140e5c0f6 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__ = "17.14.0a1" +__version__ = "17.17.0b1" import kubernetes.client import kubernetes.config diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 39c538b715..7843fefcbd 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "17.14.0a1" +__version__ = "17.17.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 96e875686d..53b3f41da7 100644 --- a/kubernetes/client/api/custom_objects_api.py +++ b/kubernetes/client/api/custom_objects_api.py @@ -1918,11 +1918,13 @@ def list_cluster_custom_object(self, group, version, plural, **kwargs): # noqa: :param str version: The custom resource's version (required) :param str plural: The custom resource's plural name. For TPRs this would be lowercase plural kind. (required) :param str pretty: If 'true', then the output is pretty printed. + :param bool allow_watch_bookmarks: allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. :param str _continue: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. :param str field_selector: A selector to restrict the list of returned objects by their fields. Defaults to everything. :param str label_selector: A selector to restrict the list of returned objects by their labels. Defaults to everything. :param int limit: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. :param str resource_version: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. + :param str resource_version_match: resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset :param int timeout_seconds: Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1953,11 +1955,13 @@ def list_cluster_custom_object_with_http_info(self, group, version, plural, **kw :param str version: The custom resource's version (required) :param str plural: The custom resource's plural name. For TPRs this would be lowercase plural kind. (required) :param str pretty: If 'true', then the output is pretty printed. + :param bool allow_watch_bookmarks: allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. :param str _continue: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. :param str field_selector: A selector to restrict the list of returned objects by their fields. Defaults to everything. :param str label_selector: A selector to restrict the list of returned objects by their labels. Defaults to everything. :param int limit: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. :param str resource_version: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. + :param str resource_version_match: resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset :param int timeout_seconds: Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. :param _return_http_data_only: response data without head status code @@ -1981,11 +1985,13 @@ def list_cluster_custom_object_with_http_info(self, group, version, plural, **kw 'version', 'plural', 'pretty', + 'allow_watch_bookmarks', '_continue', 'field_selector', 'label_selector', 'limit', 'resource_version', + 'resource_version_match', 'timeout_seconds', 'watch' ] @@ -2032,6 +2038,8 @@ def list_cluster_custom_object_with_http_info(self, group, version, plural, **kw query_params = [] if 'pretty' in local_var_params and local_var_params['pretty'] is not None: # noqa: E501 query_params.append(('pretty', local_var_params['pretty'])) # noqa: E501 + if 'allow_watch_bookmarks' in local_var_params and local_var_params['allow_watch_bookmarks'] is not None: # noqa: E501 + query_params.append(('allowWatchBookmarks', local_var_params['allow_watch_bookmarks'])) # noqa: E501 if '_continue' in local_var_params and local_var_params['_continue'] is not None: # noqa: E501 query_params.append(('continue', local_var_params['_continue'])) # noqa: E501 if 'field_selector' in local_var_params and local_var_params['field_selector'] is not None: # noqa: E501 @@ -2042,6 +2050,8 @@ def list_cluster_custom_object_with_http_info(self, group, version, plural, **kw query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'resource_version' in local_var_params and local_var_params['resource_version'] is not None: # noqa: E501 query_params.append(('resourceVersion', local_var_params['resource_version'])) # noqa: E501 + if 'resource_version_match' in local_var_params and local_var_params['resource_version_match'] is not None: # noqa: E501 + query_params.append(('resourceVersionMatch', local_var_params['resource_version_match'])) # noqa: E501 if 'timeout_seconds' in local_var_params and local_var_params['timeout_seconds'] is not None: # noqa: E501 query_params.append(('timeoutSeconds', local_var_params['timeout_seconds'])) # noqa: E501 if 'watch' in local_var_params and local_var_params['watch'] is not None: # noqa: E501 @@ -2091,11 +2101,13 @@ def list_namespaced_custom_object(self, group, version, namespace, plural, **kwa :param str namespace: The custom resource's namespace (required) :param str plural: The custom resource's plural name. For TPRs this would be lowercase plural kind. (required) :param str pretty: If 'true', then the output is pretty printed. + :param bool allow_watch_bookmarks: allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. :param str _continue: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. :param str field_selector: A selector to restrict the list of returned objects by their fields. Defaults to everything. :param str label_selector: A selector to restrict the list of returned objects by their labels. Defaults to everything. :param int limit: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. :param str resource_version: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. + :param str resource_version_match: resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset :param int timeout_seconds: Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2127,11 +2139,13 @@ def list_namespaced_custom_object_with_http_info(self, group, version, namespace :param str namespace: The custom resource's namespace (required) :param str plural: The custom resource's plural name. For TPRs this would be lowercase plural kind. (required) :param str pretty: If 'true', then the output is pretty printed. + :param bool allow_watch_bookmarks: allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. :param str _continue: The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. :param str field_selector: A selector to restrict the list of returned objects by their fields. Defaults to everything. :param str label_selector: A selector to restrict the list of returned objects by their labels. Defaults to everything. :param int limit: limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. :param str resource_version: When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. + :param str resource_version_match: resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset :param int timeout_seconds: Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. :param bool watch: Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. :param _return_http_data_only: response data without head status code @@ -2156,11 +2170,13 @@ def list_namespaced_custom_object_with_http_info(self, group, version, namespace 'namespace', 'plural', 'pretty', + 'allow_watch_bookmarks', '_continue', 'field_selector', 'label_selector', 'limit', 'resource_version', + 'resource_version_match', 'timeout_seconds', 'watch' ] @@ -2213,6 +2229,8 @@ def list_namespaced_custom_object_with_http_info(self, group, version, namespace query_params = [] if 'pretty' in local_var_params and local_var_params['pretty'] is not None: # noqa: E501 query_params.append(('pretty', local_var_params['pretty'])) # noqa: E501 + if 'allow_watch_bookmarks' in local_var_params and local_var_params['allow_watch_bookmarks'] is not None: # noqa: E501 + query_params.append(('allowWatchBookmarks', local_var_params['allow_watch_bookmarks'])) # noqa: E501 if '_continue' in local_var_params and local_var_params['_continue'] is not None: # noqa: E501 query_params.append(('continue', local_var_params['_continue'])) # noqa: E501 if 'field_selector' in local_var_params and local_var_params['field_selector'] is not None: # noqa: E501 @@ -2223,6 +2241,8 @@ def list_namespaced_custom_object_with_http_info(self, group, version, namespace query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'resource_version' in local_var_params and local_var_params['resource_version'] is not None: # noqa: E501 query_params.append(('resourceVersion', local_var_params['resource_version'])) # noqa: E501 + if 'resource_version_match' in local_var_params and local_var_params['resource_version_match'] is not None: # noqa: E501 + query_params.append(('resourceVersionMatch', local_var_params['resource_version_match'])) # noqa: E501 if 'timeout_seconds' in local_var_params and local_var_params['timeout_seconds'] is not None: # noqa: E501 query_params.append(('timeoutSeconds', local_var_params['timeout_seconds'])) # noqa: E501 if 'watch' in local_var_params and local_var_params['watch'] is not None: # noqa: E501 diff --git a/kubernetes/client/api_client.py b/kubernetes/client/api_client.py index 79fc544b82..f2c26d2372 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/17.14.0a1/python' + self.user_agent = 'OpenAPI-Generator/17.17.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 faedfcd80d..9cf51b073f 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.17\n"\ - "SDK Package Version: 17.14.0a1".\ + "SDK Package Version: 17.17.0b1".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/kubernetes/docs/CustomObjectsApi.md b/kubernetes/docs/CustomObjectsApi.md index 8e80e2d56d..2203c5d3af 100644 --- a/kubernetes/docs/CustomObjectsApi.md +++ b/kubernetes/docs/CustomObjectsApi.md @@ -949,7 +949,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_cluster_custom_object** -> object list_cluster_custom_object(group, version, plural, pretty=pretty, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, timeout_seconds=timeout_seconds, watch=watch) +> object list_cluster_custom_object(group, version, plural, pretty=pretty, allow_watch_bookmarks=allow_watch_bookmarks, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, resource_version_match=resource_version_match, timeout_seconds=timeout_seconds, watch=watch) @@ -981,16 +981,18 @@ with kubernetes.client.ApiClient(configuration) as api_client: version = 'version_example' # str | The custom resource's version plural = 'plural_example' # str | The custom resource's plural name. For TPRs this would be lowercase plural kind. pretty = 'pretty_example' # str | If 'true', then the output is pretty printed. (optional) +allow_watch_bookmarks = True # bool | allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. (optional) _continue = '_continue_example' # str | The continue option should be set when retrieving more results from the server. Since this value is server defined, kubernetes.clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the kubernetes.client needs a consistent list, it must restart their list without the continue field. Otherwise, the kubernetes.client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. (optional) field_selector = 'field_selector_example' # str | A selector to restrict the list of returned objects by their fields. Defaults to everything. (optional) label_selector = 'label_selector_example' # str | A selector to restrict the list of returned objects by their labels. Defaults to everything. (optional) limit = 56 # int | limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and kubernetes.clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, kubernetes.clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a kubernetes.client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. (optional) resource_version = 'resource_version_example' # str | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. (optional) +resource_version_match = 'resource_version_match_example' # str | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset (optional) timeout_seconds = 56 # int | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. (optional) watch = True # bool | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. (optional) try: - api_response = api_instance.list_cluster_custom_object(group, version, plural, pretty=pretty, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, timeout_seconds=timeout_seconds, watch=watch) + api_response = api_instance.list_cluster_custom_object(group, version, plural, pretty=pretty, allow_watch_bookmarks=allow_watch_bookmarks, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, resource_version_match=resource_version_match, timeout_seconds=timeout_seconds, watch=watch) pprint(api_response) except ApiException as e: print("Exception when calling CustomObjectsApi->list_cluster_custom_object: %s\n" % e) @@ -1004,11 +1006,13 @@ Name | Type | Description | Notes **version** | **str**| The custom resource's version | **plural** | **str**| The custom resource's plural name. For TPRs this would be lowercase plural kind. | **pretty** | **str**| If 'true', then the output is pretty printed. | [optional] + **allow_watch_bookmarks** | **bool**| allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. | [optional] **_continue** | **str**| The continue option should be set when retrieving more results from the server. Since this value is server defined, kubernetes.clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the kubernetes.client needs a consistent list, it must restart their list without the continue field. Otherwise, the kubernetes.client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. | [optional] **field_selector** | **str**| A selector to restrict the list of returned objects by their fields. Defaults to everything. | [optional] **label_selector** | **str**| A selector to restrict the list of returned objects by their labels. Defaults to everything. | [optional] **limit** | **int**| limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and kubernetes.clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, kubernetes.clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a kubernetes.client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. | [optional] **resource_version** | **str**| When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. | [optional] + **resource_version_match** | **str**| resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset | [optional] **timeout_seconds** | **int**| Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. | [optional] **watch** | **bool**| Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. | [optional] @@ -1034,7 +1038,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_namespaced_custom_object** -> object list_namespaced_custom_object(group, version, namespace, plural, pretty=pretty, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, timeout_seconds=timeout_seconds, watch=watch) +> object list_namespaced_custom_object(group, version, namespace, plural, pretty=pretty, allow_watch_bookmarks=allow_watch_bookmarks, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, resource_version_match=resource_version_match, timeout_seconds=timeout_seconds, watch=watch) @@ -1067,16 +1071,18 @@ version = 'version_example' # str | The custom resource's version namespace = 'namespace_example' # str | The custom resource's namespace plural = 'plural_example' # str | The custom resource's plural name. For TPRs this would be lowercase plural kind. pretty = 'pretty_example' # str | If 'true', then the output is pretty printed. (optional) +allow_watch_bookmarks = True # bool | allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. (optional) _continue = '_continue_example' # str | The continue option should be set when retrieving more results from the server. Since this value is server defined, kubernetes.clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the kubernetes.client needs a consistent list, it must restart their list without the continue field. Otherwise, the kubernetes.client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. (optional) field_selector = 'field_selector_example' # str | A selector to restrict the list of returned objects by their fields. Defaults to everything. (optional) label_selector = 'label_selector_example' # str | A selector to restrict the list of returned objects by their labels. Defaults to everything. (optional) limit = 56 # int | limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and kubernetes.clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, kubernetes.clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a kubernetes.client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. (optional) resource_version = 'resource_version_example' # str | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. (optional) +resource_version_match = 'resource_version_match_example' # str | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset (optional) timeout_seconds = 56 # int | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. (optional) watch = True # bool | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. (optional) try: - api_response = api_instance.list_namespaced_custom_object(group, version, namespace, plural, pretty=pretty, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, timeout_seconds=timeout_seconds, watch=watch) + api_response = api_instance.list_namespaced_custom_object(group, version, namespace, plural, pretty=pretty, allow_watch_bookmarks=allow_watch_bookmarks, _continue=_continue, field_selector=field_selector, label_selector=label_selector, limit=limit, resource_version=resource_version, resource_version_match=resource_version_match, timeout_seconds=timeout_seconds, watch=watch) pprint(api_response) except ApiException as e: print("Exception when calling CustomObjectsApi->list_namespaced_custom_object: %s\n" % e) @@ -1091,11 +1097,13 @@ Name | Type | Description | Notes **namespace** | **str**| The custom resource's namespace | **plural** | **str**| The custom resource's plural name. For TPRs this would be lowercase plural kind. | **pretty** | **str**| If 'true', then the output is pretty printed. | [optional] + **allow_watch_bookmarks** | **bool**| allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. | [optional] **_continue** | **str**| The continue option should be set when retrieving more results from the server. Since this value is server defined, kubernetes.clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the kubernetes.client needs a consistent list, it must restart their list without the continue field. Otherwise, the kubernetes.client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. | [optional] **field_selector** | **str**| A selector to restrict the list of returned objects by their fields. Defaults to everything. | [optional] **label_selector** | **str**| A selector to restrict the list of returned objects by their labels. Defaults to everything. | [optional] **limit** | **int**| limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and kubernetes.clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, kubernetes.clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a kubernetes.client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. | [optional] **resource_version** | **str**| When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. | [optional] + **resource_version_match** | **str**| resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset | [optional] **timeout_seconds** | **int**| Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. | [optional] **watch** | **bool**| Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. | [optional] diff --git a/kubernetes/setup.cfg b/kubernetes/setup.cfg new file mode 100644 index 0000000000..11433ee875 --- /dev/null +++ b/kubernetes/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/scripts/constants.py b/scripts/constants.py index bcb9c8c9ee..ad790fc5a6 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,13 +18,13 @@ KUBERNETES_BRANCH = "release-1.17" # client version for packaging and releasing. -CLIENT_VERSION = "17.14.0a1" +CLIENT_VERSION = "17.17.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/scripts/swagger.json b/scripts/swagger.json index 90c96f5835..2655a49c92 100644 --- a/scripts/swagger.json +++ b/scripts/swagger.json @@ -108705,6 +108705,13 @@ ], "description": "list or watch namespace scoped custom objects", "parameters": [ + { + "uniqueItems": true, + "type": "boolean", + "description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.", + "name": "allowWatchBookmarks", + "in": "query" + }, { "uniqueItems": true, "in": "query", @@ -108740,6 +108747,13 @@ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", "name": "resourceVersion" }, + { + "uniqueItems": true, + "type": "string", + "description": "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + "name": "resourceVersionMatch", + "in": "query" + }, { "uniqueItems": true, "in": "query", @@ -108931,6 +108945,13 @@ ], "description": "list or watch cluster scoped custom objects", "parameters": [ + { + "uniqueItems": true, + "type": "boolean", + "description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.", + "name": "allowWatchBookmarks", + "in": "query" + }, { "uniqueItems": true, "in": "query", @@ -108966,6 +108987,13 @@ "description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.", "name": "resourceVersion" }, + { + "uniqueItems": true, + "type": "string", + "description": "resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", + "name": "resourceVersionMatch", + "in": "query" + }, { "uniqueItems": true, "in": "query", diff --git a/setup.py b/setup.py index 236f68d9e9..5f0207fa8e 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 = "17.14.0a1" +CLIENT_VERSION = "17.17.0b1" PACKAGE_NAME = "kubernetes" -DEVELOPMENT_STATUS = "3 - Alpha" +DEVELOPMENT_STATUS = "4 - Beta" # To install the library, run the following # From 7d1114948dae591aeea646f7cae45f2dc859c801 Mon Sep 17 00:00:00 2001 From: Scott Lee Date: Mon, 10 May 2021 16:49:12 -0700 Subject: [PATCH 23/24] GA release of 1.17 Apply hotfixes --- kubernetes/README.md | 2 +- kubernetes/__init__.py | 2 +- kubernetes/client/__init__.py | 2 +- kubernetes/client/api_client.py | 2 +- kubernetes/client/configuration.py | 2 +- scripts/constants.py | 4 ++-- setup.py | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/kubernetes/README.md b/kubernetes/README.md index 3ea44eb007..9528ae11a2 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.17 -- Package version: 17.17.0b1 +- Package version: 17.17.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/kubernetes/__init__.py b/kubernetes/__init__.py index 7140e5c0f6..41f006b728 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__ = "17.17.0b1" +__version__ = "17.17.0" import kubernetes.client import kubernetes.config diff --git a/kubernetes/client/__init__.py b/kubernetes/client/__init__.py index 7843fefcbd..18b5a07153 100644 --- a/kubernetes/client/__init__.py +++ b/kubernetes/client/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "17.17.0b1" +__version__ = "17.17.0" # import apis into sdk package from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi diff --git a/kubernetes/client/api_client.py b/kubernetes/client/api_client.py index f2c26d2372..0c677adab5 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/17.17.0b1/python' + self.user_agent = 'OpenAPI-Generator/17.17.0/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 9cf51b073f..e0f6ff872d 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.17\n"\ - "SDK Package Version: 17.17.0b1".\ + "SDK Package Version: 17.17.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/scripts/constants.py b/scripts/constants.py index ad790fc5a6..6d87c24ec6 100644 --- a/scripts/constants.py +++ b/scripts/constants.py @@ -18,13 +18,13 @@ KUBERNETES_BRANCH = "release-1.17" # client version for packaging and releasing. -CLIENT_VERSION = "17.17.0b1" +CLIENT_VERSION = "17.17.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 diff --git a/setup.py b/setup.py index 5f0207fa8e..4f0c20b9f8 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 = "17.17.0b1" +CLIENT_VERSION = "17.17.0" PACKAGE_NAME = "kubernetes" -DEVELOPMENT_STATUS = "4 - Beta" +DEVELOPMENT_STATUS = "5 - Production/Stable" # To install the library, run the following # From db33e2af2885441cd4697bab58950ea413a9f333 Mon Sep 17 00:00:00 2001 From: Scott Lee Date: Mon, 10 May 2021 16:59:09 -0700 Subject: [PATCH 24/24] Update CHANGE and README Add back notices to README --- CHANGELOG.md | 10 +++++++++- README.md | 10 +++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12b1d6d464..5c461e31e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v17.17.0 + +Kubernetes API Version: 1.17.17 + +**Important Information:** + +- The Kubernetes Python client versioning scheme has changed. The version numbers used till Kubernetes Python Client v12.y.z lagged behind the actual Kubernetes minor version numbers. From this release, the client is moving a version format `vY.Z.P` where `Y` and `Z` are respectively from the Kubernetes version `v1.Y.Z` and `P` would incremented due to changes on the Python client side itself. Ref: https://github.com/kubernetes-client/python/issues/1244 +- Python 2 had reached [End of Life](https://www.python.org/doc/sunset-python-2/) on January 1, 2020. The Kubernetes Python Client will drop support for Python 2 from the next release (v18.0.0) and will no longer provide support to older clients as per the [Kubernetes support policy](https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions). + # v17.17.0b1 Kubernetes API Version: 1.17.17 @@ -25,7 +34,6 @@ Kubernetes API Version: 1.17.14 - The Kubernetes Python client versioning scheme has changed. The version numbers used till Kubernetes Python Client v12.y.z lagged behind the actual Kubernetes minor version numbers. From this release, the client is moving a version format `vY.Z.P` where `Y` and `Z` are respectively from the Kubernetes version `v1.Y.Z` and `P` would incremented due to changes on the Python client side itself. Ref: https://github.com/kubernetes-client/python/issues/1244 - Python 2 had reached [End of Life](https://www.python.org/doc/sunset-python-2/) on January 1, 2020. The Kubernetes Python Client will drop support for Python 2 from the next release (v18.0.0) and will no longer provide support to older clients as per the [Kubernetes support policy](https://kubernetes.io/docs/setup/release/version-skew-policy/#supported-versions). - **API Change:** - Fixed: log timestamps now include trailing zeros to maintain a fixed width ([#91207](https://github.com/kubernetes/kubernetes/pull/91207), [@iamchuckss](https://github.com/iamchuckss)) [SIG Apps and Node] - Resolve regression in metadata.managedFields handling in update/patch requests submitted by older API clients ([#92008](https://github.com/kubernetes/kubernetes/pull/92008), [@apelisse](https://github.com/apelisse)) [SIG API Machinery and Testing] diff --git a/README.md b/README.md index e4ba321a0c..3c5df4c7a7 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,6 @@ supported versions of Kubernetes clusters. #### Compatibility matrix of supported client versions -- [client 9.y.z](https://pypi.org/project/kubernetes/9.0.1/): Kubernetes 1.12 or below (+-), Kubernetes 1.13 (✓), Kubernetes 1.14 or above (+-) -- [client 10.y.z](https://pypi.org/project/kubernetes/10.1.0/): Kubernetes 1.13 or below (+-), Kubernetes 1.14 (✓), Kubernetes 1.14 or above (+-) - [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.14.0a1/): Kubernetes 1.16 or below (+-), Kubernetes 1.17 (✓), Kubernetes 1.18 or above (+-) @@ -118,15 +116,13 @@ between client-python versions. | 9.0 Alpha/Beta | Kubernetes main repo, 1.13 branch | ✗ | | 9.0 | Kubernetes main repo, 1.13 branch | ✗ | | 10.0 Alpha/Beta | Kubernetes main repo, 1.14 branch | ✗ | -| 10.0 | 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 | ✓ | | 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 | ✓ | -| 18.0 Alpha/Beta | 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. +| 17.0 Alpha/Beta | Kubernetes main repo, 1.17 branch | ✗ | +| 17.0 | Kubernetes main repo, 1.17 branch | ✓ | > See [here](#homogenizing-the-kubernetes-python-client-versions) for an explaination of why there is no v13-v16 release.