Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

feat(autoscale): add autoscaling support to application on per proc type basis#1018

Merged
helgi merged 1 commit intodeis:masterfrom
helgi:hpa
Sep 1, 2016
Merged

feat(autoscale): add autoscaling support to application on per proc type basis#1018
helgi merged 1 commit intodeis:masterfrom
helgi:hpa

Conversation

@helgi
Copy link
Copy Markdown
Contributor

@helgi helgi commented Aug 26, 2016

  • docs
  • e2e
  • cli
  • sdk

@helgi helgi added this to the v2.5 milestone Aug 26, 2016
@helgi helgi self-assigned this Aug 26, 2016
@deis-bot
Copy link
Copy Markdown

@kmala, @bacongobbler and @mboersma are potential reviewers of this pull request based on my analysis of git blame information. Thanks @helgi!

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 26, 2016

Current coverage is 87.01% (diff: 81.01%)

Merging #1018 into master will decrease coverage by 0.14%

@@             master      #1018   diff @@
==========================================
  Files            41         41          
  Lines          3473       3542    +69   
  Methods           0          0          
  Messages          0          0          
  Branches        579        600    +21   
==========================================
+ Hits           3027       3082    +55   
- Misses          291        301    +10   
- Partials        155        159     +4   

Powered by Codecov. Last update b907ee1...9938546

Comment thread rootfs/api/models/appsettings.py Outdated
return

# if nothing changed copy the settings from previous
if new is None and data is not None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since the default is {} i don't think this check passes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True - pushing change

@helgi helgi force-pushed the hpa branch 2 times, most recently from 0de4562 to c402aef Compare August 29, 2016 15:47
changes = []
old_autoscale = getattr(previous_settings, 'autoscale', {})
diff = dict_diff(self.autoscale, old_autoscale)
# try to be as succinct as possible
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the following lines take a while to grok. any chance they can be split up so they're more understandable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a copy pasta of our Config / Release summary (and other things) :| I had talked to @bacongobbler about doing a more unified way of doing changelog summaries (if possible) across multiple models. Will refactor the below during that.

@arschles
Copy link
Copy Markdown
Member

g2g, except for #1018 (comment). I wouldn't consider that blocking for this PR though

raise UnprocessableEntity('{} does not exist under {}'.format(proc, 'autoscale')) # noqa
del data[proc]
else:
data[proc] = scale
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this depends a lot on how the cli sends the data....can user edit the hpa configuration and if so what does the cli ux looks like?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

deis autoscale:set cmd --min=3 --max=5 --cpu-percent=60 -a test-app

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So they can update / edit an existing rule by applying a full rule again with the same proc type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i am interested about edit....if he wants to edit max to 10 after he set it using the above command, what should he do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Runs the exact same command as above but changes the max

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes...but i think handling them is better asking user to enter the whole thing again...right now there are only 3 parameters but in future it might grow into more right?
can we override create method https://docs.djangoproject.com/en/1.10/ref/models/instances/#django.db.models.Model to copy previous into current if its get called before the serializers but am not sure if it works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Inclined to say we solve that problem when we get to it unless we have a clear cut way towards that right now. @slack ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kmala how do healthchecks behave in this same situation? They are far more complicated tbh but still

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it has only one mandatory argument(port/command) and remaining are optional...even there to edit you have to enter the mandatory argument again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

going by the kubectl autoscale help (I have to review HPA again to double check if it is identical) then max is the only required element, as such, but if we made that even optional to allow editing only min or only cpu % then we'd have to do something smart on the Controller side and have the CLI understand that as well

@slack
Copy link
Copy Markdown
Member

slack commented Aug 29, 2016

I don't have a strong opinion. The "override/set single value" UX is nice as long as the implementation doesn't become unruly.

Seems that there are two options, driven mostly by "what happens when you first create this thing without some values":

What does k8s do if the values are not set? I assume it takes some default value? If we could look up those defaults and store them off on the app/proc-type after creating the HPA, that would probably be preferable to a masked set of values. That could confuse the operator.

The other option would be for Workflow to hold HPA defaults for unspecified values. Benefit there is that you would get the same thing every time, no matter the k8s version. I think there is a strong argument there as well.

@slack
Copy link
Copy Markdown
Member

slack commented Aug 29, 2016

And to be fair. I'm okay with the "give me all of the values every time" even though it is annoying... I think there is going to be a bit of time before we declare autoscaling stable...

Comment thread rootfs/api/models/app.py
self._scheduler.hpa.update(
self.id, name, proc_type, target, **autoscale
)
except KubeHTTPException as e:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't we re-throw/raise the exception if its not 404.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah and looking at it I should split this into 2 separate things

@helgi
Copy link
Copy Markdown
Contributor Author

helgi commented Aug 30, 2016

https://ci.deis.io/job/workflow-test-pr/6082/console finished fine even if it didn't get reported back here

@helgi helgi force-pushed the hpa branch 3 times, most recently from 8b70f3d to 813b2a2 Compare September 1, 2016 18:25
@helgi
Copy link
Copy Markdown
Contributor Author

helgi commented Sep 1, 2016

@helgi helgi merged commit 5c83d80 into deis:master Sep 1, 2016
@helgi helgi deleted the hpa branch September 1, 2016 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants