Skip to content

Commit

Permalink
Merge pull request #113 from snapp-incubator/fix/delete-namespace
Browse files Browse the repository at this point in the history
Allow to delete namespaces having no team
  • Loading branch information
hoptical authored Dec 4, 2024
2 parents f7a65cf + f3c26c4 commit 6728b2c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions custom_webhooks/resourcequota_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ func (v *ResourceQuotaValidator) Handle(ctx context.Context, req admission.Reque
return admission.Allowed("updating resourcequota")
}
} else if req.Operation == "DELETE" {
teamName, ok := ns.GetLabels()[teamLabel]
if !ok {
return admission.Denied("no team found for the project. please join your project to a team")
}
if req.Name == "default" && teamName != snappcloudTeamName {
if req.Name == "default" {
teamName, ok := ns.GetLabels()[teamLabel]
if ok {
if teamName == snappcloudTeamName {
return admission.Allowed("DELETE")
}
}
return admission.Denied("default resourcequota cannot be deleted")
}
return admission.Allowed("DELETE")
Expand Down

0 comments on commit 6728b2c

Please sign in to comment.