Skip to content

Commit

Permalink
fix: delete tenant with prometheus's config been deleted (#1773)
Browse files Browse the repository at this point in the history
feat: delete tenant with prometheus's config delete
  • Loading branch information
jiuker authored Oct 7, 2023
1 parent dbdf9d7 commit 11ccc22
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 11ccc22

Please sign in to comment.