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

[BUG]fix cache leak in yurtappoverrider controller #1793

Closed
rambohe-ch opened this issue Nov 14, 2023 · 3 comments
Closed

[BUG]fix cache leak in yurtappoverrider controller #1793

rambohe-ch opened this issue Nov 14, 2023 · 3 comments
Labels
help wanted help wanted kind/bug kind/bug kind/good-first-issue kind/good-first-issue

Comments

@rambohe-ch
Copy link
Member

What happened:

  1. when a yurtappoverrider instance is deleted, the cache data in CacheOverriderMap should also be removed. so we can add cache cleanup in the following code snippet.

  1. when entires of yurtappoverrider are changed, we should update the new instance into CacheOverriderMap.

if cacheOverrider, ok := r.CacheOverriderMap[instance.Namespace+"/"+instance.Name]; ok {
if reflect.DeepEqual(cacheOverrider.Entries, instance.Entries) {
return reconcile.Result{}, nil
}
} else {
r.CacheOverriderMap[instance.Namespace+"/"+instance.Name] = instance.DeepCopy()
}

so we can improve the up codes as following:

	if cacheOverrider, ok := r.CacheOverriderMap[instance.Namespace+"/"+instance.Name]; ok {
		if reflect.DeepEqual(cacheOverrider.Entries, instance.Entries) {
			return reconcile.Result{}, nil
		}
	}
	r.CacheOverriderMap[instance.Namespace+"/"+instance.Name] = instance.DeepCopy()

Environment:

  • OpenYurt version: v1.4.0
  • Kubernetes version (use kubectl version):
  • OS (e.g: cat /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

others

/kind bug

@YTGhost
Copy link
Member

YTGhost commented Nov 16, 2023

I think it can be closed.

@rambohe-ch
Copy link
Member Author

/close

@openyurt-bot
Copy link
Collaborator

@rambohe-ch: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted help wanted kind/bug kind/bug kind/good-first-issue kind/good-first-issue
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants