Skip to content

Commit

Permalink
Fix service account requiring access to every resource to delete a da…
Browse files Browse the repository at this point in the history
…tabase
  • Loading branch information
NoOverflow committed Apr 21, 2024
1 parent f2125a8 commit 75d6ba1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn setup_logger() -> Result<(), log::SetLoggerError> {
})
.level(if cfg!(debug_assertions) {
// TODO: Add a flag to enable debug logging
log::LevelFilter::Info
log::LevelFilter::Debug
} else {
log::LevelFilter::Debug
})
Expand Down
14 changes: 12 additions & 2 deletions src/routes/delete_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,19 @@ async fn delete_database(
.as_str(),
), //.labels(format!("app.kubernetes.io/managed-by=Moonscale").as_str()
)
.await?;
.await;

for item in list.items {
if list.is_err() {
warn!(
"Failed to list resources while deleting instance {} ({}/{})",
instance,
ar.kind,
list.err().unwrap()
);
continue;
}

for item in list.unwrap().items {
let name = item.name_any();
let ns = item.metadata.namespace.map(|s| s + "/").unwrap_or_default();

Expand Down

0 comments on commit 75d6ba1

Please sign in to comment.