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

Separate autoscalerRef specs for Canary and Primary Scalers #1347

Closed
akshay-gupta-meesho opened this issue Jan 21, 2023 · 2 comments
Closed

Comments

@akshay-gupta-meesho
Copy link

akshay-gupta-meesho commented Jan 21, 2023

Describe the feature

We can mention separate scaler configs for Canary and Primary Scaler.

What problem are you trying to solve?
During a new deployment, same number of min pods will be spawned, which throttles DB pool connections and hence new service is never up and running, which causes issue in further deployment.

Proposed solution

What do you want to happen? Add any considered drawbacks.
We want to use separate sclaer configs for canary and primary, so that 5-10% os min pods will do canary analysis and then rollout will start happening in primary after successful analysis.
Drawbacks - not as of now.

Any alternatives you've considered?

We tried disbaling autoscalerRef and configured and managed 2 HPAs but when canary analysis was successfully done, then flagger will bring primary HPA to min pods state of canary HPA. Example - currently desired pods or primary delploy are 100 and min pods of canary HPA are set to be 50, so after canary analysis, flagger will reset desired pods of primary HPA to min pods of canary HPA, instead of rollout to the primary HPA's desried number of pods.

Is there another way to solve this problem that isn't as good a solution?
N/A

I can see this feature to be mentioned in official docs

The autoscaler reference is optional, when specified, Flagger will pause the traffic increase while the target and primary deployments are scaled up or down. HPA can help reduce the resource usage during the canary analysis. When the autoscaler reference is specified, any changes made to the autoscaler are only made active in the primary autoscaler when a rollout for the deployment starts and completes successfully. Optionally, you can create two HPAs, one for canary and one for the primary to update the HPA without doing a new rollout. As the canary deployment will be scaled to 0, the HPA on the canary will be inactive.

Ref - https://docs.flagger.app/usage/how-it-works

Root Cause - This issue is happening as Flagger is copying specs of canary HPA into primary HPA.

Screenshot 2023-01-22 at 4 34 56 PM

Screenshot 2023-01-22 at 3 34 54 PM

@stefanprodan
Copy link
Member

I think this PR solves your issue: #1343

@akshay-gupta-meesho
Copy link
Author

Thanks. This helped a lot.
I tested it, it resolves both issues:

  1. Primary Replica = Canary Replica
  2. Canary Pods not reducing to 0 (PauseScalerTarget() was not getting triggerred)

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

No branches or pull requests

2 participants