Use Apps/v1 API

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
diff --git a/ready.py b/ready.py
index 0640ed5..2195a49 100755
--- a/ready.py
+++ b/ready.py
@@ -56,8 +56,7 @@
 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 @@
     """
     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 @@
     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