Skip to content

feat: add hpa configuration

Boros Gábor requested to merge gabor/add-hpa into main

Description

This MR adds HPA configuration and sensible defaults for scaling. The scaling is turned on by default, though it can be turned off on cluster or instance level. The configuration can be adjusted per instance, based on the needs.

The config allows memory and/or CPU based scaling, though -- for now -- we only use CPU based scaling. The current default settings were assigned based on quick measurements visible below.

Supporting information

This MR is related to grove!95 (merged) and https://github.com/overhangio/tutor/pull/677

Testing instructions

Steps to test the changes:

  1. Run ./kubectl -n tutor14 get hpa and validate that the number of replicas are 1 for every pod
  2. Run ./kubectl -n tutor14 get hpa --watch to see the changes
  3. Install hey
  4. Run hey -disable-keepalive -n 1000 -c 10 'https://tutor14.staging.do.opencraft.hosting/heartbeat?extended' -- this will put "some" load on the cluster
  5. Validate that the replicas will increase in a bit -- note: it will take time to cool down after the pressure

Dependencies

N/A

Screenshots

before scaling

Screenshot 2022-06-29 at 9 47 24

after scaling

Screenshot 2022-06-29 at 9 47 28

memory usage

Screenshot 2022-06-29 at 9 51 33
Edited by Boros Gábor

Merge request reports