Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize hpa & pdb version select #40

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions helm/higress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -9,4 +9,4 @@ name: higress
sources:
- http://github.com/alibaba/higress
type: application
version: 0.5.0
version: 0.5.1
47 changes: 37 additions & 10 deletions helm/higress/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand All @@ -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 }}
10 changes: 7 additions & 3 deletions helm/higress/values.yaml
Original file line number Diff line number Diff line change
@@ -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: ""
Expand All @@ -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: ""

Expand Down Expand Up @@ -82,7 +86,7 @@ gateway:
memory: 2048Mi

autoscaling:
enabled: true
enabled: false
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
Expand All @@ -100,7 +104,7 @@ controller:
name: "higress-controller"
replicaCount: 1
image: higress
tag: ""
tag: "04cfef254aade907478c2b70cf576bb5eb310047"
env: {}
replicaCount: 1

Expand Down
4 changes: 2 additions & 2 deletions helm/istio/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: 1.12.0
appVersion: 1.12.1
description: Helm chart for deploying higress istio
name: istio
sources:
Expand All @@ -12,4 +12,4 @@ dependencies:
repository: "file://../istiod"
version: 1.12.0
type: application
version: 1.12.0
version: 1.12.1
33 changes: 33 additions & 0 deletions helm/istiod/templates/autoscale.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}
4 changes: 4 additions & 0 deletions helm/istiod/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
9 changes: 6 additions & 3 deletions helm/istiod/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

## Discovery Settings
pilot:
autoscaleEnabled: true
autoscaleEnabled: false
autoscaleMin: 1
autoscaleMax: 5
replicaCount: 1
rollingMaxSurge: 100%
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
Expand Down Expand Up @@ -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
johnlanni marked this conversation as resolved.
Show resolved Hide resolved
higressName: "higress-controller"
higressNamespace: "higress-system"
higressPort: "15051"
Expand All @@ -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

Expand Down