Skip to content

Commit

Permalink
updating taint
Browse files Browse the repository at this point in the history
rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
paigerube14 committed May 1, 2024
1 parent 0168942 commit c549f5d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions cerberus/kubernetes/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit c549f5d

Please sign in to comment.