feat: refactor to maintain policy state in-memory#49
feat: refactor to maintain policy state in-memory#49cmaclaughlin wants to merge 25 commits intoAzure:mainfrom
Conversation
…notations. unit tests for key functionality.
helayoty
left a comment
There was a problem hiding this comment.
The way you implemented it is great. Thank you for your efforts!
aramase
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I've reviewed core.go and policy.go mostly and added comments. I'll review the other files next and add comments if any.
| p.qualifiedPods = p.qualifiedPods.Delete(key) | ||
|
|
||
| if p.PodIsManagedByPolicy(key) { | ||
| p.managedPods = p.managedPods.Delete(key) |
There was a problem hiding this comment.
Do you know if Delete from the set is thread safe?
There was a problem hiding this comment.
I don't think it is since it is implemented via map[string]struct{} and delete(map, key) is not thread safe.
There was a problem hiding this comment.
Would you like a thread safe implementation or leave it as-is?
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
aramase
left a comment
There was a problem hiding this comment.
Added few more comments!
One thing I noticed is that PreScore now depends on cycle state set by the PreFilter phase. If a user wants to to use the scheduler plugin only for the preScore and score extension points and not configure it for preFilter and filter the plugin will now not work. IMO we should not depend on state being set by a different extension point.
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Co-authored-by: Anish Ramasekar <anish.ramasekar@gmail.com>
I've removed that dependency now. For context, I had been looking at the Volume Binding plugin which sets state data in |
|
@aramase what is the status of the PR? Can we merge it soon? |
Re: #25
The capacity scheduling plugin was used for frame of reference. A collection of policy information is kept in-memory on the PlacementPolicyManager. Instead of annotations, the policy info in the collection includes 2 sets:
An event handler was attached to the pod informer so pod deletion can trigger updating the in-memory version of the policy accordingly. Additionally, the custom info object is included in the state object added to cycle state as a part of
PreFilterandPreScorestages so thatFilterandScorestages have access to it as well.