Skip to content

Commit 30f6d96

Browse files
committed
refactor namespace deletion function
1 parent 73f231c commit 30f6d96

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

  • rust/stackable-cockpit/src/utils/k8s

rust/stackable-cockpit/src/utils/k8s/client.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,16 +574,17 @@ impl Client {
574574

575575
/// Deletes a [`Namespace`] with `name` in the cluster.
576576
pub async fn delete_namespace(&self, name: String) -> Result<()> {
577-
self.delete_object(
577+
let namespace_api: Api<Namespace> = Api::all(self.client.clone());
578+
579+
kube::runtime::wait::delete::delete_and_finalize(
580+
namespace_api,
578581
&name,
579-
&ApiResource::from_gvk(&GroupVersionKind {
580-
group: "".to_owned(),
581-
version: "v1".to_owned(),
582-
kind: "Namespace".to_owned(),
583-
}),
584-
None,
582+
&DeleteParams::foreground(),
585583
)
586584
.await
585+
.context(KubeRuntimeDeleteSnafu)?;
586+
587+
Ok(())
587588
}
588589

589590
/// Creates a [`Namespace`] only if not already present in the current cluster.

0 commit comments

Comments
 (0)