ingress-nginx-helm/charts/ingress-nginx/templates/controller-hpa.yaml

30 lines
1 KiB
YAML
Raw Normal View History

2020-03-02 14:49:26 +00:00
{{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) -}}
2020-02-24 19:25:57 +00:00
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
labels:
{{- include "ingress-nginx.labels" . | nindent 4 }}
app.kubernetes.io/component: controller
name: {{ include "ingress-nginx.controller.fullname" . }}
2020-02-24 19:25:57 +00:00
spec:
scaleTargetRef:
apiVersion: apps/v1
2020-02-24 19:25:57 +00:00
kind: Deployment
name: {{ include "ingress-nginx.controller.fullname" . }}
2020-02-24 19:25:57 +00:00
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
metrics:
2020-03-02 14:49:26 +00:00
{{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
2020-02-24 19:25:57 +00:00
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ . }}
2020-03-02 14:49:26 +00:00
{{- end }}
{{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
2020-02-24 19:25:57 +00:00
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ . }}
2020-03-02 14:49:26 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
{{- end }}