Skip to content

Commit 6048e63

Browse files
authored
Merge pull request #5704 from alexandrsemak/master
add custom metric to hpa template
2 parents 2d51fbf + baed5c6 commit 6048e63

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

charts/ingress-nginx/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v1
22
name: ingress-nginx
3-
version: 2.6.0
3+
version: 2.7.0
44
appVersion: 0.33.0
55
home: https://github.com/kubernetes/ingress-nginx
66
description: Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

charts/ingress-nginx/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Parameter | Description | Default
7979
`controller.autoscaling.maxReplicas` | If autoscaling enabled, this field sets maximum replica count | `11`
8080
`controller.autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage to scale | `"50"`
8181
`controller.autoscaling.targetMemoryUtilizationPercentage` | Target memory utilization percentage to scale | `"50"`
82+
`controller.autoscaling.autoscalingTemplate` | If autoscaling template provided, creates custom autoscaling metric | false
8283
`controller.hostPort.enabled` | This enable `hostPort` for ports defined in TCP/80 and TCP/443 | false
8384
`controller.hostPort.ports.http` | If `controller.hostPort.enabled` is `true` and this is non-empty, it sets the hostPort | `"80"`
8485
`controller.hostPort.ports.https` | If `controller.hostPort.enabled` is `true` and this is non-empty, it sets the hostPort | `"443"`
@@ -376,4 +377,4 @@ Error: UPGRADE FAILED: Service "?????-controller" is invalid: spec.clusterIP: In
376377
377378
Detail of how and why are in [this issue](https://github.com/helm/charts/pull/13646) but to resolve this you can set `xxxx.service.omitClusterIP` to `true` where `xxxx` is the service referenced in the error.
378379
379-
As of version `1.26.0` of this chart, by simply not providing any clusterIP value, `invalid: spec.clusterIP: Invalid value: "": field is immutable` will no longer occur since `clusterIP: ""` will not be rendered.
380+
As of version `1.26.0` of this chart, by simply not providing any clusterIP value, `invalid: spec.clusterIP: Invalid value: "": field is immutable` will no longer occur since `clusterIP: ""` will not be rendered.
Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) -}}
2-
apiVersion: autoscaling/v2beta1
2+
apiVersion: autoscaling/v2beta2
33
kind: HorizontalPodAutoscaler
44
metadata:
55
labels:
@@ -15,15 +15,22 @@ spec:
1515
maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
1616
metrics:
1717
{{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
18-
- type: Resource
19-
resource:
20-
name: cpu
21-
targetAverageUtilization: {{ . }}
18+
- type: Resource
19+
resource:
20+
name: cpu
21+
target:
22+
type: Utilization
23+
averageUtilization: {{ . }}
2224
{{- end }}
2325
{{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
24-
- type: Resource
25-
resource:
26-
name: memory
27-
targetAverageUtilization: {{ . }}
26+
- type: Resource
27+
resource:
28+
name: memory
29+
target:
30+
type: Utilization
31+
averageUtilization: {{ . }}
32+
{{- end }}
33+
{{- with .Values.controller.autoscalingTemplate }}
34+
{{- toYaml . | nindent 2 }}
2835
{{- end }}
2936
{{- end }}

charts/ingress-nginx/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ controller:
243243
targetCPUUtilizationPercentage: 50
244244
targetMemoryUtilizationPercentage: 50
245245

246+
autoscalingTemplate: []
247+
# Custom or additional autoscaling metrics
248+
# ref: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics
249+
# - type: Pods
250+
# pods:
251+
# metric:
252+
# name: nginx_ingress_controller_nginx_process_requests_total
253+
# target:
254+
# type: AverageValue
255+
# averageValue: 10000m
256+
246257
## Enable mimalloc as a drop-in replacement for malloc.
247258
## ref: https://github.com/microsoft/mimalloc
248259
##

0 commit comments

Comments
 (0)