Skip to content

Commit

Permalink
runtime-rs: fix handling of TTRCP_ADDRESS
Browse files Browse the repository at this point in the history
Since cri-o doesn't seem to use address for event publishing as mentioned
in the previous commit it will not send it.  However, the exact way of
not sending it is unfortunately different from what is assumed by
runtime-rs.  Due to an implementation detail of cri-o which uses containerd
libraries for some low-level tasks, TTRPC_ADDRESS will not be missing from
environment as assumed, instead it will be present with an empty value.

This commit contains a small adjustment to account for that and use
LogForwarder even if TTRPC_ADDRESS is present, but with an empty value.

Fixes #8985

Signed-off-by: Pavel Mores <pmores@redhat.com>
  • Loading branch information
pmores committed Feb 6, 2024
1 parent 9840d2a commit d03c916
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime-rs/crates/service/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ pub(crate) trait Forwarder {
/// `TTRPC_ADDRESS` existing. Otherwise, fall back to `LogForwarder`.
pub(crate) async fn new_event_publisher(namespace: &str) -> Result<Box<dyn Forwarder>> {
let fwd: Box<dyn Forwarder> = match env::var(TTRPC_ADDRESS_ENV) {
Ok(address) => Box::new(
Ok(address) if !address.is_empty() => Box::new(
ContainerdForwarder::new(namespace, &address)
.await
.context("new containerd forwarder")?,
),
Err(_) => Box::new(
Ok(_) | Err(_) => Box::new(
LogForwarder::new(namespace)
.await
.context("new log forwarder")?,
Expand Down

0 comments on commit d03c916

Please sign in to comment.