Skip to content

Commit

Permalink
refactor: improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Sopena Ballesteros committed Oct 25, 2024
1 parent 6b9ce31 commit d2c4965
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions src/common/kubernetes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ pub async fn get_cfs_session_container_git_clone_logs_stream(
.unwrap();

log::info!(
"Fetching logs for contaianer {} in namespace/pod {}/{}",
"Fetching logs for init container {} in namespace/pod {}/{}",
init_container_name,
cfs_session_pod.clone().metadata.namespace.unwrap(),
cfs_session_pod.clone().metadata.name.unwrap(),
Expand All @@ -503,23 +503,10 @@ pub async fn get_cfs_session_container_git_clone_logs_stream(
.into_iter()
.find(|init_container| init_container.name.eq(&git_clone_container.name));

log::debug!("Container status:\n{:#?}", init_container_status);
log::info!("Init container status:\n{:#?}", init_container_status);

let mut i = 0;
let max = 30;

/* // Check init container is terminated
if init_container_status
.clone()
.unwrap()
.state
.unwrap()
.terminated
.is_some() {
return Err(format!("Init container {} terminated", init_container_name)
.into());
} */
let max = 60;

// Waiting for init container to start
while (init_container_status.is_none()
Expand All @@ -529,17 +516,11 @@ pub async fn get_cfs_session_container_git_clone_logs_stream(
.state
.unwrap()
.waiting
.is_some()/* || !init_container_status
.clone()
.unwrap()
.state
.unwrap()
.terminated
.is_some() */)
.is_some())
&& i <= max
{
log::info!(
"Container {} state {:?}",
"Init container '{}' state:\n{:?}",
git_clone_container.name,
init_container_status.clone().unwrap().state.unwrap()
);
Expand Down

0 comments on commit d2c4965

Please sign in to comment.