Skip to content

Commit

Permalink
Fix removing daemonsets
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnedo committed Aug 11, 2024
1 parent b5d7750 commit 7f676a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ sudo apt-get install -y gcc make libssl-dev pkg-config
- [ ] Fix pod naming to avoid collisions
- Deployments
- [x] Apply
- [ ] Remove
- [x] Remove
- [x] List
- [x] Output matches kubectl
- Daemonsets
- [x] Apply
- [ ] Remove
- [x] Remove
- [x] List
- [x] Output matches kubectl
- Ingress
Expand Down
9 changes: 4 additions & 5 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl DefaultExecutor {

let ids = exec_cmd("podman", &["pod", "ls", "--filter", &format!("label=skate.io/namespace={}", ns), "--filter", &format!("label=skate.io/deployment={}", name), "-q"])?;

let ids = ids.split("\n").collect::<Vec<&str>>();
let ids = ids.split("\n").map(|l| l.trim()).filter(|l| !l.is_empty()).collect::<Vec<&str>>();

self.remove_pods(ids, grace_period)
}
Expand All @@ -304,10 +304,9 @@ impl DefaultExecutor {
let ns = daemonset.metadata.namespace.unwrap_or("default".to_string());

let ids = exec_cmd("podman", &["pod", "ls", "--filter", &format!("label=skate.io/namespace={}", ns), "--filter", &format!("label=skate.io/daemonset={}", name), "-q"])?;
let ids = ids.split("\n").collect::<Vec<&str>>();
let result = self.remove_pods(ids, grace_period);
let _ = self.reload_ingress();
result
let ids = ids.split("\n").map(|l| l.trim()).filter(|l| !l.is_empty()).collect::<Vec<&str>>();

self.remove_pods(ids, grace_period)
}

fn remove_pods(&self, ids: Vec<&str>, grace_period: Option<usize>) -> Result<(), Box<dyn Error>> {
Expand Down

0 comments on commit 7f676a0

Please sign in to comment.