From c549f5d722c651ccc90acba1893d2be2e1558966 Mon Sep 17 00:00:00 2001 From: Paige Rubendall Date: Wed, 1 May 2024 14:43:58 -0400 Subject: [PATCH] updating taint rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED --- cerberus/kubernetes/client.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cerberus/kubernetes/client.py b/cerberus/kubernetes/client.py index daf815b..32dfe34 100644 --- a/cerberus/kubernetes/client.py +++ b/cerberus/kubernetes/client.py @@ -56,7 +56,7 @@ def monitor_namespaces_status(watch_namespaces, watch_terminating_namespaces, it namespaces = [] none_terminating = True if watch_terminating_namespaces: - watch_nodes_start_time = time.time() + watch_ns_start_time = time.time() try: ret = cli.list_all_namespaces() except ApiException as e: @@ -68,7 +68,7 @@ def monitor_namespaces_status(watch_namespaces, watch_terminating_namespaces, it if namespace.status.phase != "Active": namespaces.append(namespace.metadata.name) none_terminating = False - iter_track_time["watch_terminating_namespaces"] = time.time() - watch_nodes_start_time + iter_track_time["watch_terminating_namespaces"] = time.time() - watch_ns_start_time logging.info("Iteration %s: No Terminating Namespaces status: %s" % (iteration, str(none_terminating))) else: logging.info( @@ -207,6 +207,7 @@ def namespace_sleep_tracker(namespace, pods_tracker, ignore_patterns): def monitor_namespace(namespace, ignore_pattern=None): notready_pods = set() match = False + logging.info('monitor namespace') notready_containers = defaultdict(list) all_pod_info_list = cli.get_all_pod_info(namespace) if all_pod_info_list is not None and len(all_pod_info_list) > 0: @@ -231,9 +232,11 @@ def monitor_namespace(namespace, ignore_pattern=None): if condition.type == "ContainersReady" and condition.status == "False": if pod_status.container_statuses is not None: for container in pod_status.container_statuses: + logging.info('container name') if not container.ready: notready_containers[pod].append(container.name) if pod_status.init_container_statuses is not None: + logging.info('container status is none') for container in pod_status.init_container_statuses: if not container.ready: notready_containers[pod].append(container.name) @@ -298,16 +301,12 @@ def process_cluster_operator(distribution, watch_cluster_operators, iteration, i def check_master_taint(): schedulable_masters = [] # updating to use get_nodes_infos(self) from krkn_lib - node_list_info = cli.get_nodes_infos() - for node_info in node_list_info: - node = node_info.name - NoSchedule_taint = False + taint_list_info = cli.get_nodes_infos()[1] + for taint_info in taint_list_info: + node = taint_info.node_name try: - if node_info.taint is not None: - for taint in node_info.taint: - if node_info.node_type == "master" and taint.effect == "NoSchedule": - NoSchedule_taint = True - if not NoSchedule_taint: + if taint_info is not None: + if taint_info.effect != "NoSchedule": schedulable_masters.append(node) except Exception as e: logging.info("Exception getting master nodes" + str(e))