Skip to content

Commit

Permalink
feat: higress helm support kubernetes latest version
Browse files Browse the repository at this point in the history
Signed-off-by: iutx <root@viper.run>
  • Loading branch information
iutx committed Nov 8, 2022
1 parent 04cfef2 commit 83a0828
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion helm/higress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ keywords:
- gateways
name: higress
sources:
- http://github.com/alibaba/higress
- https://github.com/alibaba/higress
type: application
version: 0.5.0
19 changes: 19 additions & 0 deletions helm/higress/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
{{/*
Return the target Kubernetes version
*/}}
{{- define "capabilities.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for autoscaling.
*/}}
{{- define "capabilities.autoscaling.apiVersion" -}}
{{- if semverCompare ">=1.23-0" (include "capabilities.kubeVersion" .) }}
{{- print "autoscaling/v2" -}}
{{- else -}}
{{- print "autoscaling/v2beta2" -}}
{{- end -}}
{{- end -}}


{{- define "gateway.name" -}}
{{- .Values.gateway.name | default "higress-gateway" -}}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion helm/higress/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.gateway.autoscaling.enabled }}
apiVersion: autoscaling/v2beta2
apiVersion: {{ include "capabilities.autoscaling.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "gateway.name" . }}
Expand Down
1 change: 1 addition & 0 deletions helm/higress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,4 @@ controller:
maxReplicas: 5
targetCPUUtilizationPercentage: 80

kubeVersionOverride: ""
2 changes: 1 addition & 1 deletion helm/istio/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ dependencies:
repository: file://../istiod
version: 1.12.0
digest: sha256:12dd680ac6eee11750941f56aab434cc35c5df09ac784a5ef8f5b84e0984f8c7
generated: "2022-10-31T14:49:23.29643+08:00"
generated: "2022-11-08T21:31:35.660761+08:00"
2 changes: 1 addition & 1 deletion helm/istio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: 1.12.0
description: Helm chart for deploying higress istio
name: istio
sources:
- http://github.com/alibaba/higress
- https://github.com/alibaba/higress
dependencies:
- name: base
repository: "file://../base"
Expand Down
16 changes: 11 additions & 5 deletions helm/istiod/templates/autoscale.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{- if and .Values.pilot.autoscaleEnabled .Values.pilot.autoscaleMin .Values.pilot.autoscaleMax }}
apiVersion: autoscaling/v2beta1
{{- 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 }}
Expand All @@ -18,9 +22,11 @@ spec:
kind: Deployment
name: istiod{{- if not (eq .Values.revision "") }}-{{ .Values.revision }}{{- end }}
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.pilot.cpu.targetAverageUtilization }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.pilot.cpu.targetAverageUtilization }}
---
{{- 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

0 comments on commit 83a0828

Please sign in to comment.