Skip to content

Commit f990f9d

Browse files
committed
Prevent errors if testsys log group already exists
1 parent fc9e01c commit f990f9d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

controller/src/job/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use k8s_openapi::api::core::v1::Pod;
99
use k8s_openapi::chrono::{Duration, Utc};
1010
use kube::api::{DeleteParams, ListParams, LogParams, PropagationPolicy};
1111
use kube::{Api, ResourceExt};
12-
use log::{debug, info, warn};
12+
use log::{debug, info, trace, warn};
1313
use snafu::{ensure, OptionExt, ResultExt};
1414
use std::env;
1515
use std::time::{SystemTime, UNIX_EPOCH};
@@ -206,15 +206,16 @@ pub(crate) async fn archive_logs(k8s_client: kube::Client, job_name: &str) -> Jo
206206
SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()
207207
);
208208

209-
client
209+
if client
210210
.create_log_stream()
211211
.log_group_name("testsys")
212212
.log_stream_name(&name)
213213
.send()
214214
.await
215-
.context(error::CreateLogStreamSnafu {
216-
log_stream: name.to_string(),
217-
})?;
215+
.is_err()
216+
{
217+
trace!("Unable to create log group it is possible it already exists.");
218+
}
218219

219220
client
220221
.put_log_events()

0 commit comments

Comments
 (0)