fix(operator): Time to_string and phase type mismatch

- Time does not implement Display, use .0 (inner DateTime<Utc>) and
  to_rfc3339() instead.
- phase is &str, convert to String to match JobStatusResult.phase.
This commit is contained in:
ZhenYi 2026-04-15 09:38:46 +08:00
parent 2d2e295bf3
commit df976d16cb

View File

@ -71,10 +71,10 @@ async fn query_job_status(
"Pending"
};
let start_time = status.and_then(|s| s.start_time.as_ref()).map(|t| t.to_string());
let completion_time = status.and_then(|s| s.completion_time.as_ref()).map(|t| t.to_string());
let start_time = status.and_then(|s| s.start_time.as_ref()).map(|t| t.0.to_rfc3339());
let completion_time = status.and_then(|s| s.completion_time.as_ref()).map(|t| t.0.to_rfc3339());
Ok(JobStatusResult { phase, start_time, completion_time })
Ok(JobStatusResult { phase: phase.to_string(), start_time, completion_time })
}
Err(kube::Error::Api(e)) if e.code == 404 => {
Ok(JobStatusResult { phase: "Pending".to_string(), start_time: None, completion_time: None })