in cost-optimization/hpa-config-recommender/src/hpaconfigrecommender/read_workload_startuptime.py [0:0]
def _extract_pod_times(status: dict) -> tuple:
"""
Extract the 'PodScheduled' and 'Ready' times from pod status conditions.
Args:
status (dict): The status dictionary from the pod details.
Returns:
tuple: A tuple containing pod_scheduled_time and ready_time.
"""
pod_scheduled_time = None
ready_time = None
for condition in status.get("conditions", []):
if condition.get("type") == "PodScheduled":
pod_scheduled_time = pd.to_datetime(
condition.get("lastTransitionTime")
)
if condition.get("type") == "Ready":
ready_time = pd.to_datetime(condition.get("lastTransitionTime"))
return pod_scheduled_time, ready_time