Skip to content

Commit e1f0293

Browse files
authored
Create hpa.yaml
1 parent aed2d9b commit e1f0293

File tree

1 file changed

+46
-0
lines changed
  • charts/nginx-gateway-fabric/templates

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{{- if and (eq .Values.nginxGateway.kind "deployment") .Values.nginxGateway.autoscaling.enabled -}}
2+
apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
{{- with .Values.autoscaling.annotations }}
6+
annotations: {{ toYaml . | nindent 4 }}
7+
{{- end }}
8+
labels:
9+
{{- include "nginx-gateway.labels" . | nindent 4 }}
10+
{{- with .Values.nginxGateway.labels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
name: {{ include "nginx-gateway.fullname" . }}
14+
namespace: {{ .Release.Namespace }}
15+
spec:
16+
scaleTargetRef:
17+
apiVersion: apps/v1
18+
kind: Deployment
19+
name: {{ include "nginx-gateway.fullname" . }}
20+
minReplicas: {{ .Values.autoscaling.minReplicas }}
21+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
22+
metrics:
23+
{{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
24+
- type: Resource
25+
resource:
26+
name: memory
27+
target:
28+
type: Utilization
29+
averageUtilization: {{ . }}
30+
{{- end }}
31+
{{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
32+
- type: Resource
33+
resource:
34+
name: cpu
35+
target:
36+
type: Utilization
37+
averageUtilization: {{ . }}
38+
{{- end }}
39+
{{- with .Values.autoscalingTemplate }}
40+
{{- toYaml . | nindent 2 }}
41+
{{- end }}
42+
{{- with .Values.autoscaling.behavior }}
43+
behavior:
44+
{{- toYaml . | nindent 4 }}
45+
{{- end }}
46+
{{- end }}

0 commit comments

Comments
 (0)