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

View File

@@ -1,5 +1,6 @@
{{- if .Values.gateway.autoscaling.enabled }} {{- if .Values.gateway.autoscaling.enabled }}
apiVersion: autoscaling/v2beta2 {{- if not .Values.global.autoscalingv2API }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ include "gateway.name" . }} name: {{ include "gateway.name" . }}
@@ -9,20 +10,46 @@ metadata:
annotations: annotations:
{{- .Values.gateway.annotations | toYaml | nindent 4 }} {{- .Values.gateway.annotations | toYaml | nindent 4 }}
spec: spec:
minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
scaleTargetRef: scaleTargetRef:
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
name: {{ include "gateway.name" . }} 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 }} minReplicas: {{ .Values.gateway.autoscaling.minReplicas }}
maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }} maxReplicas: {{ .Values.gateway.autoscaling.maxReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "gateway.name" . }}
metrics: metrics:
{{- if .Values.gateway.autoscaling.targetCPUUtilizationPercentage }} - type: Resource
- type: Resource resource:
resource: name: cpu
name: cpu target:
target: type: Utilization
averageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }} averageUtilization: {{ .Values.gateway.autoscaling.targetCPUUtilizationPercentage }}
type: Utilization ---
{{- end }} {{- end }}
{{- 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 hub: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress
ingressClass: "" ingressClass: ""
watchNamespace: "" watchNamespace: ""
@@ -9,7 +13,7 @@ gateway:
name: "higress-gateway" name: "higress-gateway"
replicaCount: 2 replicaCount: 2
image: gateway image: gateway
tag: "" tag: "04cfef254aade907478c2b70cf576bb5eb310047"
# revision declares which revision this gateway is a part of # revision declares which revision this gateway is a part of
revision: "" revision: ""
@@ -82,7 +86,7 @@ gateway:
memory: 2048Mi memory: 2048Mi
autoscaling: autoscaling:
enabled: true enabled: false
minReplicas: 1 minReplicas: 1
maxReplicas: 5 maxReplicas: 5
targetCPUUtilizationPercentage: 80 targetCPUUtilizationPercentage: 80
@@ -100,7 +104,7 @@ controller:
name: "higress-controller" name: "higress-controller"
replicaCount: 1 replicaCount: 1
image: higress image: higress
tag: "" tag: "04cfef254aade907478c2b70cf576bb5eb310047"
env: {} env: {}
replicaCount: 1 replicaCount: 1

View File

@@ -1,5 +1,5 @@
apiVersion: v2 apiVersion: v2
appVersion: 1.12.0 appVersion: 1.12.1
description: Helm chart for deploying higress istio description: Helm chart for deploying higress istio
name: istio name: istio
sources: sources:
@@ -12,4 +12,4 @@ dependencies:
repository: "file://../istiod" repository: "file://../istiod"
version: 1.12.0 version: 1.12.0
type: application 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 and .Values.pilot.autoscaleEnabled .Values.pilot.autoscaleMin .Values.pilot.autoscaleMax }}
{{- if not .Values.global.autoscalingv2API }}
apiVersion: autoscaling/v2beta1 apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler kind: HorizontalPodAutoscaler
metadata: metadata:
@@ -23,4 +24,36 @@ spec:
name: cpu name: cpu
targetAverageUtilization: {{ .Values.pilot.cpu.targetAverageUtilization }} 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 }} {{- end }}

View File

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

View File

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