Skip to content

Commit

Permalink
feat: make HPA metrics generic (#66)
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Haley <[email protected]>
  • Loading branch information
charlie-haley authored Jan 11, 2024
1 parent b9b53a8 commit c4a1ac2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 41 deletions.
22 changes: 3 additions & 19 deletions templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,10 @@ spec:
name: {{ include "benthos.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
{{- with .Values.autoscaling.metrics }}
metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- with .Values.autoscaling.customMetric -}}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.autoscaling.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
Expand Down
44 changes: 22 additions & 22 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.


deployment:
deployment:
replicaCount: 1
podAnnotations: {}
podLabels: {}
Expand All @@ -12,8 +11,6 @@ deployment:
# Default 60. ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
terminationGracePeriodSeconds: 60



# commonLabels -- Add additional labels to all created resources.
commonLabels: {}

Expand Down Expand Up @@ -103,24 +100,27 @@ resources: {}
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# autoscaling.customMetric -- Target a custom metric for autoscaling.
customMetric: {}
# - type: Pods
# pods:
# metric:
# name: utilization
# target:
# type: AverageValue
# averageValue: 95

# autoscaling.behavior -- Configure separate scale-up and scale-down behaviors.
behavior: {}
# scaleDown:
# stabilizationWindowSeconds: 300
maxReplicas: 12
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
# - type: Resource
# resource:
# name: memory
# target:
# type: Utilization
# averageUtilization: 80
# behavior:
# scaleDown:
# stabilizationWindowSeconds: 300
# policies:
# - type: Pods
# value: 1
# periodSeconds: 60

nodeSelector: {}

Expand Down

0 comments on commit c4a1ac2

Please sign in to comment.