Skip to content

Commit

Permalink
add HPA custom metrics to common helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBesson committed Sep 25, 2024
1 parent 82980b5 commit ae6749f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: A generic helm chart for Kubernetes
type: application
version: 0.7.2
version: 0.8.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
3 changes: 2 additions & 1 deletion charts/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch
| additionalPodSpec | object | `{}` | Additional Pod Spec |
| affinity | object | `{}` | Assign custom affinity rules |
| args | list | `[]` | Override default container args |
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling should be enabled for statefulsets ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ |
| autoscaling | object | `{"customMetrics":[],"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling should be enabled for statefulsets ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ |
| autoscaling.customMetrics | list | `[]` | Custom HPA metrics |
| autoscaling.enabled | bool | `false` | Enable autoscaling |
| autoscaling.maxReplicas | int | `100` | Maximum number of pods |
| autoscaling.minReplicas | int | `1` | Minimum number of pods |
Expand Down
3 changes: 3 additions & 0 deletions charts/common/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ spec:
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end }}
{{- if .Values.autoscaling.customMetrics }}
{{- toYaml .Values.autoscaling.customMetrics | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ autoscaling:
# -- Target CPU utilization percentage
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
# -- Custom HPA metrics
customMetrics: []

# -- If enabled, create service monitor of Prometheus-Operator
# ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md#include-servicemonitors
Expand Down

0 comments on commit ae6749f

Please sign in to comment.