Files
charts/bitnami/nginx-ingress-controller/templates/controller-hpa.yaml
rubemlrm 0bd0614314 [bitnami/nginx-ingress-controller] Validation for autoscalling (#9602)
* [bitnami/nginx-ingress-controller] Validation for autoscalling

Added kubernetes version to euse the autoscalling v2 instead of v2beta.

Signed-off-by: Rubem Mota <rubemmota89@gmail.com>

* [bitnami/nginx-ingress-controller] Bumped Chart version

Signed-off-by: Rubem Mota <rubemmota89@gmail.com>

* Update bitnami/nginx-ingress-controller/templates/controller-hpa.yaml

Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
Signed-off-by: Rubem Mota <rubemmota89@gmail.com>

Co-authored-by: Miguel Ruiz <miruiz@vmware.com>
2022-03-29 15:12:04 +02:00

40 lines
1.4 KiB
YAML

{{- if and .Values.autoscaling.enabled (eq .Values.kind "Deployment") }}
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
apiVersion: autoscaling/v2beta1
{{- else }}
apiVersion: autoscaling/v2
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: controller
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ template "common.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemory }}
{{- end }}
{{- if .Values.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPU }}
{{- end }}
{{- end }}