Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to requeue in the broker controller reconcile loop #588

Open
jxs1211 opened this issue Jan 21, 2025 · 0 comments
Open

No need to requeue in the broker controller reconcile loop #588

jxs1211 opened this issue Jan 21, 2025 · 0 comments
Labels
kind/bug Something isn't working

Comments

@jxs1211
Copy link

jxs1211 commented Jan 21, 2025

Current Behavior

If the resource is created successfully, it's not necessary to requeue the request in the broker controller loop.

Expected Behavior

Continue to create objects if each object is created successfully, the reconcile loop will be more efficient.

Screenshots/Logs

func (r *BrokerReconciler) reconcileBroker(ctx context.Context, enable bool, baseResource *mesheryv1alpha1.Broker, req ctrl.Request) (ctrl.Result, error) {
	objects := brokerpackage.GetObjects(baseResource)
	for _, object := range objects {
		object.SetNamespace(baseResource.Namespace)
		err := r.Get(ctx,
			types.NamespacedName{
				Name:      object.GetName(),
				Namespace: object.GetNamespace(),
			},
			object,
		)
		if err != nil && kubeerror.IsNotFound(err) && enable {
			_ = ctrl.SetControllerReference(baseResource, object, r.Scheme)
			er := r.Create(ctx, object)
			if er != nil {
				return ctrl.Result{}, ErrCreateMeshsync(er)
			}
			// do not requeue here because it's not necessary
			return ctrl.Result{Requeue: true}, nil

Environment

  • Host OS: Mac Linux Windows
  • Platform: Docker or Kubernetes

Contributor Guides and Resources

@jxs1211 jxs1211 added the kind/bug Something isn't working label Jan 21, 2025
@jxs1211 jxs1211 changed the title No need to requeue n the broker controller reconcile loop No need to requeue in the broker controller reconcile loop Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant