feat(argo-rollouts): Add hpa to handle controller scaling
Signed-off-by: vitor.cassiano <vitor.cassiano@picpay.com>
This commit is contained in:
parent
bdfd2afe6d
commit
d71c2a214a
3 changed files with 55 additions and 0 deletions
|
@ -109,3 +109,11 @@ Return the appropriate apiVersion for pod disruption budget
|
||||||
{{- print "policy/v1" -}}
|
{{- print "policy/v1" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Expand the namespace of the release.
|
||||||
|
Allows overriding it for multi-namespace deployments in combined charts.
|
||||||
|
*/}}
|
||||||
|
{{- define "argo-rollouts.namespace" -}}
|
||||||
|
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end }}
|
||||||
|
|
41
charts/argo-rollouts/templates/controller/hpa.yaml
Normal file
41
charts/argo-rollouts/templates/controller/hpa.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{{- if .Values.controller.autoscaling.enabled }}
|
||||||
|
apiVersion: autoscaling/v2
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: {{ include "argo-rollouts.fullname" . }}
|
||||||
|
namespace: {{ include "argo-rollouts.namespace" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "argo-rollouts.labels" (dict "context" .) | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: {{ include "argo-rollouts.fullname" . }}
|
||||||
|
minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
|
||||||
|
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
|
||||||
|
metrics:
|
||||||
|
{{- with .Values.controller.autoscaling.metrics }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- else }}
|
||||||
|
{{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: memory
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.controller.autoscaling.behavior }}
|
||||||
|
behavior:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -61,6 +61,12 @@ controller:
|
||||||
tolerations: []
|
tolerations: []
|
||||||
# -- Assign custom [affinity] rules to the deployment
|
# -- Assign custom [affinity] rules to the deployment
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
autoscaling:
|
||||||
|
enabled: true
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 2
|
||||||
|
targetCPUUtilizationPercentage: 80
|
||||||
|
targetMemoryUtilizationPercentage: 80
|
||||||
logging:
|
logging:
|
||||||
# -- Set the logging level (one of: `debug`, `info`, `warn`, `error`)
|
# -- Set the logging level (one of: `debug`, `info`, `warn`, `error`)
|
||||||
level: info
|
level: info
|
||||||
|
|
Loading…
Reference in a new issue