Skip to content

Commit

Permalink
fix(project_cleanup): check all cluster locations and defer when dele…
Browse files Browse the repository at this point in the history
…ting (#248)
  • Loading branch information
apeabody authored Jul 29, 2024
1 parent 4287d62 commit 14e7ce1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/project_cleanup/function_source/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func invoke(ctx context.Context) {

removeProjectClusters := func(projectId string) int {
logger.Printf("Try to remove clusters for [%s]", projectId)
reqLCR := &containerpb.ListClustersRequest{Parent: fmt.Sprintf("projects/%s/locations/*", projectId)}
reqLCR := &containerpb.ListClustersRequest{Parent: fmt.Sprintf("projects/%s/locations/-", projectId)}
listResponse, err := containerService.ListClusters(ctx, reqLCR)
if err != nil {
logger.Printf("Failed to list clusters for [%s], error [%s]", projectId, err.Error())
Expand Down Expand Up @@ -695,6 +695,7 @@ func invoke(ctx context.Context) {
logger.Printf("Try to remove project [%s]", projectId)
if clusters := removeProjectClusters(projectId); clusters != 0 {
logger.Printf("Defer removing project [%s], %d clusters marked for deletion", projectId, clusters)
return
}
err := removeProjectById(projectId)
if err != nil {
Expand Down

0 comments on commit 14e7ce1

Please sign in to comment.