Skip to content

Commit

Permalink
feat: delete tenant with prometheus's config delete
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuker committed Sep 13, 2023
1 parent 3baa969 commit 6516256
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/controller/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,18 @@ func (c *Controller) syncHandler(key string) (Result, error) {
// The Tenant resource may no longer exist, in which case we stop processing.
if k8serrors.IsNotFound(err) {
runtime.HandleError(fmt.Errorf("Tenant '%s' in work queue no longer exists", key))
// Try to delete PrometheusConfig.
// Can't use the tenant. That's nil for sure
err = c.deletePrometheusAddlConfig(ctx, &miniov2.Tenant{
ObjectMeta: metav1.ObjectMeta{
Name: tenantName,
Namespace: namespace,
},
})
if err != nil {
// Just output the error. Will not retry.
runtime.HandleError(fmt.Errorf("DeletePrometheusAddlConfig '%s/%s' error:%s", namespace, tenantName, err.Error()))
}
return WrapResult(Result{}, nil)
}
// will retry after 5sec
Expand Down

0 comments on commit 6516256

Please sign in to comment.