Skip to content

Commit

Permalink
fix: Ignore audit config not found error when removing the log subsys…
Browse files Browse the repository at this point in the history
…tem (#1350)

The operator can be in a weird state when removing the log from the
tenant yaml. If removing the audit webhook succeed but the removal of
the log service fails, the operator will enter in an loop of errors
because it is not ignoring 'config not found' error when deleting
the webhook config again in the next try.

The commit ignores XMinioConfigError and XMinioConfigNotFoundError
though XMinioConfigError is not returned when a config is not found
since MinIO server Dec 2022.

Co-authored-by: Anis Elleuch <anis@min.io>
  • Loading branch information
2 people authored and harshavardhana committed Jan 3, 2023
1 parent 72f2466 commit 57020da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controller/cluster/log-search.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ func (c *Controller) deleteLogHeadlessService(ctx context.Context, tenant *minio
if k8serrors.IsNotFound(err) {
return nil
}
// Delete the audit webhook configuration and ignore config not found error
if _, err := adminClnt.DelConfigKV(ctx, fmt.Sprintf("audit_webhook:%s", tenant.LogSearchAPIDeploymentName())); err != nil {
return err
// TODO(@vadmeste): Remove XMinioConfigError check with is not returned since Dec 2022
if adminErr := madmin.ToErrorResponse(err); adminErr.Code != "XMinioConfigError" &&
adminErr.Code != "XMinioConfigNotFoundError" {
return err
}
}
klog.V(2).Infof("Deleting Log Headless Service for %s", tenant.Namespace)
err = c.kubeClientSet.CoreV1().Services(tenant.Namespace).Delete(ctx, tenant.LogHLServiceName(), metav1.DeleteOptions{})
Expand Down

0 comments on commit 57020da

Please sign in to comment.