Skip to content

Commit

Permalink
Fix the bug of ResourceQuota removal (#6188)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunzhaochang committed Feb 8, 2023
1 parent 74f020e commit 1552c90
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/profile-controller/controllers/profile_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,19 @@ func (r *ProfileReconciler) Reconcile(ctx context.Context, request ctrl.Request)
return reconcile.Result{}, err
}
} else {
logger.Info("No update on resource quota", "spec", instance.Spec.ResourceQuotaSpec.String())
found := &corev1.ResourceQuota{}
err := r.Get(ctx, types.NamespacedName{Name: KFQUOTA, Namespace: instance.Name}, found)
if err == nil {
if err := r.Delete(ctx, found); err != nil {
logger.Error(err, "error deleting resource quota", "namespace", instance.Name)
return ctrl.Result{}, err
}
} else if !apierrors.IsNotFound(err) {
logger.Error(err, "error getting resource quota", "namespace", instance.Name)
return ctrl.Result{}, err
} else {
logger.Info("No update on resource quota", "spec", instance.Spec.ResourceQuotaSpec.String())
}
}
if err := r.PatchDefaultPluginSpec(ctx, instance); err != nil {
IncRequestErrorCounter("error patching DefaultPluginSpec", SEVERITY_MAJOR)
Expand Down

0 comments on commit 1552c90

Please sign in to comment.