mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-01 07:47:15 +00:00
runtime-rs: fix handling of TTRCP_ADDRESS
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>
This commit is contained in:
parent
f0256fded5
commit
6346e04cf7
@ -38,12 +38,14 @@ 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(
|
||||
// an empty address doesn't match the arm above so catch it here
|
||||
// and handle it the same way as if it's missing altogether
|
||||
Ok(_) | Err(_) => Box::new(
|
||||
LogForwarder::new(namespace)
|
||||
.await
|
||||
.context("new log forwarder")?,
|
||||
|
Loading…
Reference in New Issue
Block a user