Add Default backend HPA autoscaling.

This commit is contained in:
Adam Hamsik 2020-11-04 14:03:50 +01:00
parent 6c729e9cc7
commit ab9ba3e970
6 changed files with 44 additions and 7 deletions

View file

@ -4,6 +4,9 @@ This file documents all notable changes to [ingress-nginx](https://github.com/ku
### Unreleased ### Unreleased
### 3.9.0
- [X] [#6423](https://github.com/kubernetes/ingress-nginx/pull/6423) Add Default backend HPA autoscaling
### 3.8.0 ### 3.8.0

View file

@ -1,6 +1,6 @@
apiVersion: v1 apiVersion: v1
name: ingress-nginx name: ingress-nginx
version: 3.8.0 version: 3.9.0
appVersion: 0.41.0 appVersion: 0.41.0
home: https://github.com/kubernetes/ingress-nginx home: https://github.com/kubernetes/ingress-nginx
description: Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer description: Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer
@ -16,8 +16,4 @@ engine: gotpl
kubeVersion: ">=1.16.0-0" kubeVersion: ">=1.16.0-0"
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- Update jettech/kube-webhook-certgen image - Add Default backend HPA autoscaling
- Added loadBalancerSourceRanges for internal lbs
- Add securitycontext settings on defaultbackend
- Fix controller service annotations
- Initial helm chart changelog

View file

@ -11,7 +11,9 @@ spec:
matchLabels: matchLabels:
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }} {{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: default-backend app.kubernetes.io/component: default-backend
{{- if not .Values.defaultBackend.autoscaling.enabled }}
replicas: {{ .Values.defaultBackend.replicaCount }} replicas: {{ .Values.defaultBackend.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template: template:
metadata: metadata:

View file

@ -0,0 +1,29 @@
{{- if .Values.defaultBackend.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
labels:
{{- include "ingress-nginx.labels" . | nindent 4 }}
app.kubernetes.io/component: default-backend
name: {{ template "nginx-ingress.defaultBackend.fullname" . }}
spec:
scaleTargetRef:
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
name: {{ template "nginx-ingress.defaultBackend.fullname" . }}
minReplicas: {{ .Values.defaultBackend.autoscaling.minReplicas }}
maxReplicas: {{ .Values.defaultBackend.autoscaling.maxReplicas }}
metrics:
{{- with .Values.defaultBackend.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ . }}
{{- end }}
{{- with .Values.defaultBackend.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}

View file

@ -1,4 +1,4 @@
{{- if gt (.Values.defaultBackend.replicaCount | int) 1 -}} {{- if or (gt (.Values.defaultBackend.replicaCount | int) 1) (gt (.Values.defaultBackend.autoscaling.minReplicas | int) 1) }}
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:

View file

@ -627,6 +627,13 @@ defaultBackend:
# cpu: 10m # cpu: 10m
# memory: 20Mi # memory: 20Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 2
targetCPUUtilizationPercentage: 50
targetMemoryUtilizationPercentage: 50
service: service:
annotations: {} annotations: {}