Use Apps/v1 API 59/110459/1 3.0.0
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Wed, 22 Jul 2020 15:47:06 +0000 (17:47 +0200)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Wed, 22 Jul 2020 15:47:06 +0000 (17:47 +0200)
Instead of old APIs, use Apps/v1 API so readiness can be used on v1.16+
clusters.

Issue-ID: OOM-2519
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I428f32a500a6175653990c10fb8e6b6811dbc8e0

ready.py

index 0640ed5..2195a49 100755 (executable)
--- a/ready.py
+++ b/ready.py
@@ -56,8 +56,7 @@ configuration.ssl_ca_cert = cert
 configuration.api_key['authorization'] = token
 configuration.api_key_prefix['authorization'] = 'Bearer'
 coreV1Api = client.CoreV1Api(client.ApiClient(configuration))
-api_instance = client.ExtensionsV1beta1Api(client.ApiClient(configuration))
-api = client.AppsV1beta1Api(client.ApiClient(configuration))
+api = client.AppsV1(client.ApiClient(configuration))
 batchV1Api = client.BatchV1Api(client.ApiClient(configuration))
 
 
@@ -158,7 +157,7 @@ def wait_for_daemonset_complete(daemonset_name):
     """
     complete = False
     try:
-        response = api_instance.read_namespaced_daemon_set(
+        response = api.read_namespaced_daemon_set(
             daemonset_name, namespace)
         status = response.status
         if status.desired_number_scheduled == status.number_ready:
@@ -240,8 +239,8 @@ def get_deployment_name(replicaset):
     Returns:
         the name of the Deployment owning the ReplicatSet
     """
-    api_response = api_instance.read_namespaced_replica_set_status(replicaset,
-                                                                   namespace)
+    api_response = api.read_namespaced_replica_set_status(replicaset,
+                                                          namespace)
     deployment_name = read_name(api_response)
     return deployment_name