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

refactor endpoint slice packing strategy #51

Closed
wants to merge 1 commit into from
Closed

Conversation

haouc
Copy link
Contributor

@haouc haouc commented Nov 21, 2023

What type of PR is this?

improvement
Which issue does this PR fix:

What does this PR do / Why do we need it:
Currently we pack endpoints of rules and pods to splitted slices based on configured chunk size. The issue is slices are packed eventually and unbounded growing when doing frequent resources scaling. We want to implement bin packing to ensure the slices are evenly packed and slice number growing expect-able and manage-able.

If an issue # is not available please add steps to reproduce and the controller logs:

Testing done on this change:

The change has been tested with rules and pods by scaling up/down. The slices were verified being filled evenly and bin packed.

For example:
chunk size is 5

% k scale deploy nginx --replicas=5                                                      
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length'      
5
% k scale deploy nginx --replicas=15                                                
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length' 
5
5
5
% k scale deploy nginx --replicas=17                                                
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length' 
5
5
2
5
% k scale deploy nginx --replicas=15                                                
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length' 
5
5
5
% k scale deploy nginx --replicas=11                                                
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length' 
1
5
5
% k scale deploy nginx --replicas=5                                                 
deployment.apps/nginx scaled
% k get policyendpoint -ojson | jq -r '.items[].spec.podSelectorEndpoints | length' 
5

Automation added to e2e:

Will this PR introduce any new dependencies?:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@haouc haouc requested a review from a team as a code owner November 21, 2023 22:09
@haouc
Copy link
Contributor Author

haouc commented Dec 2, 2023

Close this PR since we want to implement it different way.

@haouc haouc closed this Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant