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

Fix the invalid behavior in the detector to determine whether the binding object needs to be updated. #6154

Closed
CharlesQQ opened this issue Feb 24, 2025 · 2 comments · Fixed by #6157
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@CharlesQQ
Copy link
Member

CharlesQQ commented Feb 24, 2025

What would you like to be added:
After restart karmada controller, detector will always update some rb resource, those resourcebindings have dependent resources

I0224 17:12:12.236354   17981 detector.go:] Update ResourceBinding(default/xxxx-deployment) successfully.

I add new log to compare the changes in resources before updating; The reason is that the finalizers field of rb has changed from karmada.io/binding-controller,karmada.io/binding-dependencies-distributor to karmada.io/binding-controller

	existing := obj.DeepCopyObject()
	if err := mutate(f, key, obj); err != nil {
		return controllerutil.OperationResultNone, err
	}
	patchBytes, err := generateJSONPatch(existing, obj)
	if err != nil {
		panic(err)
	}
	diff := cmp.Diff(existing, obj)
	klog.Infof("after mutate,   %s , equal: %v \n", string(patchBytes), equality.Semantic.DeepEqual(existing, obj))
	if equality.Semantic.DeepEqual(existing, obj) {
		return controllerutil.OperationResultNone, nil
	}

	if err := c.Update(ctx, obj); err != nil {
		return controllerutil.OperationResultNone, err
	}
	return controllerutil.OperationResultUpdated, nil

Image

Why is this needed:
Performance optimization, reducing invalid updates to existing resources during restart and reducing work queue resource pressure

@CharlesQQ CharlesQQ added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 24, 2025
@CharlesQQ CharlesQQ changed the title potimization: detector controller update all resourcebindings with dependent resources potimization: detector controller update all resourcebindings which with dependent resources Feb 24, 2025
@XiShanYongYe-Chang
Copy link
Member

In favor of #6157
/assign @CharlesQQ

@CharlesQQ CharlesQQ changed the title potimization: detector controller update all resourcebindings which with dependent resources Fix the invalid behavior in the detector to determine whether the binding object needs to be updated. Feb 24, 2025
@RainbowMango RainbowMango added this to the v1.13 milestone Feb 25, 2025
@RainbowMango
Copy link
Member

/remove-kind feature
/kind bug

This is more like a bug.

@karmada-bot karmada-bot added kind/bug Categorizes issue or PR as related to a bug. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
Status: No status
4 participants