Skip to content

Commit

Permalink
feat: specify resource metrics as percentages for HPA (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
pommelinho authored Dec 14, 2020
1 parent 2c82fb6 commit 85fccb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
26 changes: 20 additions & 6 deletions helm/charts/hydra/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@ spec:
minReplicas: {{ .Values.deployment.autoscaling.minReplicas }}
maxReplicas: {{ .Values.deployment.autoscaling.maxReplicas }}
metrics:
{{- if .Values.deployment.autoscaling.cpuAverageValue }}
{{- if .Values.deployment.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: {{ .Values.deployment.autoscaling.cpuAverageValue }}
target:
type: Utilization
averageUtilization: {{ .Values.deployment.autoscaling.targetCPUUtilizationPercentage }}
{{- else if .Values.deployment.autoscaling.targetCPUAverageValue }}
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: {{ .Values.deployment.autoscaling.targetCPUAverageValue }}
{{- end }}
{{- if .Values.deployment.autoscaling.memoryAverageValue }}
{{- if .Values.deployment.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.deployment.autoscaling.targetMemoryUtilizationPercentage }}
{{- else if .Values.deployment.autoscaling.targetMemoryAverageValue }}
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: {{ .Values.deployment.autoscaling.memoryAverageValue }}
averageValue: {{ .Values.deployment.autoscaling.targetMemoryAverageValue }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions helm/charts/hydra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ deployment:
enabled: false
# minReplicas: 1
# maxReplicas: 3
# cpuAverageValue: 200m
# memoryAverageValue: 0.5Gi
# targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Configure node affinity
affinity: {}
Expand Down

0 comments on commit 85fccb8

Please sign in to comment.