optimize hpa & pdb version select (#40)

This commit is contained in:
澄潭
2022-11-09 10:29:10 +08:00
committed by GitHub
parent 0fbfd57833
commit cd43403cf9
7 changed files with 91 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 0.5.0
appVersion: 0.5.1
description: Helm chart for deploying higress gateways
icon: https://higress.io/img/higress_logo_small.png
keywords:
@@ -9,4 +9,4 @@ name: higress
sources:
- http://github.com/alibaba/higress
type: application
version: 0.5.0
version: 0.5.1

View File

@@ -1,5 +1,6 @@
{{- if .Values.gateway.autoscaling.enabled }}
apiVersion: autoscaling/v2beta2
{{- if not .Values.global.autoscalingv2API }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "gateway.name" . }}
@@ -9,20 +10,46 @@ metadata:
annotations:
{{- .Values.gateway.annotations | toYaml | nindent 4 }}
spec:
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "gateway.name" . }}
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
---
{{- else }}
{{- if (semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion)}}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta2
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "gateway.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "gateway.labels" . | nindent 4 }}
annotations:
{{- .Values.gateway.annotations | toYaml | nindent 4 }}
spec:
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "gateway.name" . }}
metrics:
{{- if .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
averageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
type: Utilization
{{- end }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
---
{{- end }}
{{- end }}

View File

@@ -1,3 +1,7 @@
global:
# whether to use autoscaling/v2 template for HPA settings
# for internal usage only, not to be configured by users.
autoscalingv2API: true
hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
ingressClass: ""
watchNamespace: ""
@@ -9,7 +13,7 @@ gateway:
name: "higress-gateway"
replicaCount: 2
image: gateway
tag: ""
tag: "04cfef254aade907478c2b70cf576bb5eb310047"
# revision declares which revision this gateway is a part of
revision: ""
@@ -82,7 +86,7 @@ gateway:
memory: 2048Mi
autoscaling:
enabled: true
enabled: false
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
@@ -100,7 +104,7 @@ controller:
name: "higress-controller"
replicaCount: 1
image: higress
tag: ""
tag: "04cfef254aade907478c2b70cf576bb5eb310047"
env: {}
replicaCount: 1

View File

@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.12.0
appVersion: 1.12.1
description: Helm chart for deploying higress istio
name: istio
sources:
@@ -12,4 +12,4 @@ dependencies:
repository: "file://../istiod"
version: 1.12.0
type: application
version: 1.12.0
version: 1.12.1

View File

@@ -1,4 +1,5 @@
{{- if and .Values.pilot.autoscaleEnabled .Values.pilot.autoscaleMin .Values.pilot.autoscaleMax }}
{{- if not .Values.global.autoscalingv2API }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
@@ -23,4 +24,36 @@ spec:
name: cpu
targetAverageUtilization: {{ .Values.pilot.cpu.targetAverageUtilization }}
---
{{- else }}
{{- if (semverCompare ">=1.23-0" .Capabilities.KubeVersion.GitVersion)}}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta2
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: istiod{{- if not (eq .Values.revision "") }}-{{ .Values.revision }}{{- end }}
namespace: {{ .Release.Namespace }}
labels:
app: istiod
release: {{ .Release.Name }}
istio.io/rev: {{ .Values.revision | default "default" }}
install.operator.istio.io/owning-resource: {{ .Values.ownerName | default "unknown" }}
operator.istio.io/component: "Pilot"
spec:
maxReplicas: {{ .Values.pilot.autoscaleMax }}
minReplicas: {{ .Values.pilot.autoscaleMin }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: istiod{{- if not (eq .Values.revision "") }}-{{ .Values.revision }}{{- end }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.pilot.cpu.targetAverageUtilization }}
---
{{- end }}
{{- end }}

View File

@@ -1,5 +1,9 @@
{{- if .Values.global.defaultPodDisruptionBudget.enabled }}
{{- if (semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion) }}
apiVersion: policy/v1
{{- else }}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: istiod{{- if not (eq .Values.revision "") }}-{{ .Values.revision }}{{- end }}

View File

@@ -2,7 +2,7 @@
## Discovery Settings
pilot:
autoscaleEnabled: true
autoscaleEnabled: false
autoscaleMin: 1
autoscaleMax: 5
replicaCount: 1
@@ -10,7 +10,7 @@ pilot:
rollingMaxUnavailable: 25%
hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
tag: 1.12
tag: 04cfef254aade907478c2b70cf576bb5eb310047
# Can be a full hub/image:tag
image: pilot
@@ -221,6 +221,9 @@ meshConfig:
# No hurry to do this in 1.6, we're trying to prove the code.
global:
# whether to use autoscaling/v2 template for HPA settings
# for internal usage only, not to be configured by users.
autoscalingv2API: true
higressName: "higress-controller"
higressNamespace: "higress-system"
higressPort: "15051"
@@ -229,7 +232,7 @@ global:
# enable pod disruption budget for the control plane, which is used to
# ensure Istio control plane components are gradually upgraded or recovered.
defaultPodDisruptionBudget:
enabled: true
enabled: false
# The values aren't mutable due to a current PodDisruptionBudget limitation
# minAvailable: 1