Skip to content

Commit 83e0ab3

Browse files
committed
[platform] Autoscale the autoscaler
The Vertical Pod Autoscaler is a component with resource requirements highly dependent on the environment it is running in, hence it also needs to be autoscaled to reduce the number of configuration parameters that platform admins need to manage. This patch introduces an ancillary autoscaler that watches only the primary autoscaler's namespace and adjusts its resource requests and limits, since the autoscaler cannot autoscale itself. In turn, the primary autoscaler can autoscale the ancillary autoscaler. [platform] Implement autoscaling for the Vertical Pod Autoscaler itself. Signed-off-by: Timofei Larkin <[email protected]>
1 parent 1b7a597 commit 83e0ab3

2 files changed

Lines changed: 88 additions & 6 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{{- if .Values.vpaForVPA }}
2+
---
3+
apiVersion: v1
4+
kind: Namespace
5+
metadata:
6+
labels:
7+
cozystack.io/system: "true"
8+
name: cozy-vpa-for-vpa
9+
---
10+
apiVersion: helm.toolkit.fluxcd.io/v2
11+
kind: HelmRelease
12+
metadata:
13+
labels:
14+
cozystack.io/repository: system
15+
cozystack.io/system-app: "true"
16+
name: vpa-for-vpa
17+
namespace: cozy-vpa-for-vpa
18+
spec:
19+
chart:
20+
spec:
21+
chart: cozy-vertical-pod-autoscaler
22+
reconcileStrategy: Revision
23+
sourceRef:
24+
kind: HelmRepository
25+
name: cozystack-system
26+
namespace: cozy-system
27+
version: '>= 0.0.0-0'
28+
dependsOn:
29+
- name: monitoring-agents
30+
namespace: cozy-monitoring
31+
install:
32+
crds: Skip
33+
remediation:
34+
retries: -1
35+
interval: 5m
36+
releaseName: vertical-pod-autoscaler
37+
upgrade:
38+
crds: Skip
39+
remediation:
40+
retries: -1
41+
values:
42+
vpaForVPA: false
43+
vertical-pod-autoscaler:
44+
nameOverride: vpa-for-vpa
45+
fullnameOverride: vpa-for-vpa
46+
admissionController:
47+
enabled: false
48+
recommender:
49+
extraArgs:
50+
vpa-object-namespace: {{ .Release.Namespace }}
51+
recommender-name: vpa-for-vpa
52+
resources:
53+
limits:
54+
memory: 512Mi
55+
requests:
56+
cpu: 100m
57+
memory: 512Mi
58+
---
59+
apiVersion: autoscaling.k8s.io/v1
60+
kind: VerticalPodAutoscaler
61+
metadata:
62+
name: vpa-for-vpa
63+
namespace: {{ .Release.Namespace }}
64+
spec:
65+
recommenders:
66+
- name: vpa-for-vpa
67+
targetRef:
68+
apiVersion: apps/v1
69+
kind: Deployment
70+
name: {{ dig "vertical-pod-autoscaler" "nameOverride" "" .Values.AsMap | default "vertical-pod-autoscaler" | trunc 63 | trimSuffix "-" }}-recommender
71+
updatePolicy:
72+
updateMode: Auto
73+
---
74+
apiVersion: autoscaling.k8s.io/v1
75+
kind: VerticalPodAutoscaler
76+
metadata:
77+
name: vpa-for-vpa
78+
namespace: cozy-vpa-for-vpa
79+
spec:
80+
targetRef:
81+
apiVersion: apps/v1
82+
kind: Deployment
83+
name: vpa-for-vpa-recommender
84+
updatePolicy:
85+
updateMode: Auto
86+
{{- end }}

‎packages/system/vertical-pod-autoscaler/values.yaml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
vpaForVPA: true
2+
13
vertical-pod-autoscaler:
24
crds:
35
enabled: false
@@ -23,12 +25,6 @@ vertical-pod-autoscaler:
2325
pod-namespace-label: namespace
2426
prometheus-address: http://vmselect-shortterm.tenant-root.svc.cozy.local:8481/select/0/prometheus/
2527
prometheus-cadvisor-job-name: cadvisor
26-
resources:
27-
limits:
28-
memory: 160Mi
29-
requests:
30-
cpu: 100m
31-
memory: 160Mi
3228

3329
admissionController:
3430
resources:

0 commit comments

Comments
 (0)