Skip to content

Commit ff35f66

Browse files
authored
Merge pull request #3502 from josh-ferrell/feature-hpa
Add horizontal pod autoscaler to helm chart
2 parents 2223921 + b5c3af6 commit ff35f66

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
{{- if (semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion)}}
3+
apiVersion: autoscaling/v2
4+
{{- else }}
5+
apiVersion: autoscaling/v2beta2
6+
{{- end }}
7+
kind: HorizontalPodAutoscaler
8+
metadata:
9+
name: {{ include "aws-load-balancer-controller.fullname" . }}
10+
namespace: {{ .Release.Namespace }}
11+
labels:
12+
{{- include "aws-load-balancer-controller.labels" . | nindent 4 }}
13+
annotations:
14+
{{- .Values.annotations | toYaml | nindent 4 }}
15+
spec:
16+
scaleTargetRef:
17+
apiVersion: apps/v1
18+
kind: Deployment
19+
name: {{ include "aws-load-balancer-controller.fullname" . }}
20+
minReplicas: {{ .Values.autoscaling.minReplicas }}
21+
maxReplicas: {{ required "A valid .Values.autoscaling.maxReplicas value is required" .Values.autoscaling.maxReplicas }}
22+
metrics:
23+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
24+
- type: Resource
25+
resource:
26+
name: cpu
27+
target:
28+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
29+
type: Utilization
30+
{{- end }}
31+
{{- if .Values.autoscaling.autoscaleBehavior }}
32+
behavior: {{ toYaml .Values.autoscaling.autoscaleBehavior | nindent 4 }}
33+
{{- end }}
34+
{{- end }}

helm/aws-load-balancer-controller/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ imagePullSecrets: []
1313
nameOverride: ""
1414
fullnameOverride: ""
1515

16+
autoscaling:
17+
enabled: false
18+
minReplicas: 1
19+
maxReplicas: 5
20+
targetCPUUtilizationPercentage: 80
21+
1622
serviceAccount:
1723
# Specifies whether a service account should be created
1824
create: true

0 commit comments

Comments
 (0)