Skip to content

Commit ec337ac

Browse files
author
bele
committed
fix: enable kubernetes labels for k8s with containerd
PR corresponding to the changes: hubblo-org#327
1 parent 5525c68 commit ec337ac

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.59 as planner
1+
FROM rust:1.70 as planner
22
WORKDIR app
33

44
RUN cargo install cargo-chef
@@ -7,15 +7,15 @@ COPY . .
77
# Analyze dependencies
88
RUN cargo chef prepare --recipe-path recipe.json
99

10-
FROM rust:1.59 as cacher
10+
FROM rust:1.70 as cacher
1111
WORKDIR app
1212
RUN cargo install cargo-chef
1313
COPY --from=planner /app/recipe.json recipe.json
1414

1515
# Cache dependencies
1616
RUN cargo chef cook --release --recipe-path recipe.json
1717

18-
FROM rust:1.59 as builder
18+
FROM rust:1.70 as builder
1919
WORKDIR app
2020
COPY . .
2121

src/sensors/utils.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl ProcessTracker {
419419
#[cfg(feature = "containers")]
420420
let regex_cgroup_docker = Regex::new(r"^.*/docker.*$").unwrap();
421421
#[cfg(feature = "containers")]
422-
let regex_cgroup_kubernetes = Regex::new(r"^/kubepods.*$").unwrap();
422+
let regex_cgroup_kubernetes = Regex::new(r"/kubepods.*$").unwrap();
423423
#[cfg(feature = "containers")]
424424
let regex_cgroup_containerd = Regex::new("/system.slice/containerd.service/.*$").unwrap();
425425

@@ -587,6 +587,12 @@ impl ProcessTracker {
587587
if container_id.contains("cri-containerd") {
588588
container_id = container_id.split(':').last().unwrap().to_string();
589589
}
590+
if container_id.starts_with("cri-containerd-") {
591+
container_id = container_id
592+
.strip_prefix("cri-containerd-")
593+
.unwrap()
594+
.to_string();
595+
}
590596
Ok(container_id)
591597
}
592598

0 commit comments

Comments
 (0)