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

Prevent pod scaling if app is the target of an HPA #201

Merged
merged 5 commits into from
Dec 1, 2021
Merged

Conversation

DavisFrench
Copy link
Contributor

Description

If there is an HPA for an app, we do not want units to be scaled in canary deployment

Fixes # 2147

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (documentation addition or typo, file relocation)

Testing

  • New tests were added with this PR that prove my fix is effective or that my feature works (describe below this bullet)
  • This change requires no testing (i.e. documentation update)

Documentation

  • All added public packages, funcs, and types have been documented with doc comments
  • I have commented my code, particularly in hard-to-understand areas

Final Checklist:

  • I followed standard GitHub flow guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Additional Information (omit if empty)

Please include anything else relevant to this PR that may be useful to know.

@DavisFrench DavisFrench marked this pull request as ready for review November 30, 2021 14:51
internal/controllers/app_controller.go Outdated Show resolved Hide resolved
internal/controllers/app_controller.go Outdated Show resolved Hide resolved
internal/controllers/app_controller.go Outdated Show resolved Hide resolved
@@ -556,7 +556,7 @@ func (app *App) DoCanary(now metav1.Time, logger logr.Logger, recorder record.Ev
eventStep := newCanaryNextStepEvent(app)
recorder.AnnotatedEventf(app, eventStep.Event.Annotations, v1.EventTypeNormal, eventStep.Event.Name, eventStep.Message())

if app.Spec.Canary.Target != nil {
if app.Spec.Canary.Target != nil && !disableScale {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely will work with shipa because it creates an HPA object for each process of each deployment.

What if an application has two deployments with web and worker processes and there is only one HPA targeting the worker process of the first deployment.

I think we can easily disable scaling per deployment per process.

@stinkyfingers @koncar what do you think guys? I'm OK with the single disableScale flag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with trying to disable per process, but I think either approach works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have implemented a version that will allow for disabling scaling per process. I was having some trouble thinking of a clean way of also being able to limit based on Version.

Something like using a map where the key is the process appended with the deployment version I think would work, but would need some string parsing in the doCanary function. Do we want to have that level of control or leave it at the process level?

Copy link
Contributor

@aleksej-paschenko aleksej-paschenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@DavisFrench DavisFrench merged commit 3bf72db into main Dec 1, 2021
@DavisFrench DavisFrench deleted the SHIPA-2147 branch December 1, 2021 18:00
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.

3 participants