[TASK] bootstrap hpa and ingress (#28)
* bootstrap hpa and ingress
* version update
diff --git a/charts/shenyu/Chart.yaml b/charts/shenyu/Chart.yaml
index 974f763..f9c975c 100644
--- a/charts/shenyu/Chart.yaml
+++ b/charts/shenyu/Chart.yaml
@@ -2,7 +2,7 @@
name: shenyu
description: Helm Chart for deploying Apache ShenYu in Kubernetes
type: application
-version: 0.5.3
+version: 0.5.4
appVersion: "2.5.0"
icon: https://shenyu.apache.org/img/logo.png
maintainers:
diff --git a/charts/shenyu/templates/shenyu-bootstrap-hpa.yaml b/charts/shenyu/templates/shenyu-bootstrap-hpa.yaml
new file mode 100644
index 0000000..174bdde
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-bootstrap-hpa.yaml
@@ -0,0 +1,32 @@
+{{- if .Values.bootstrap.autoscaling.enabled }}
+apiVersion: autoscaling/v2beta1
+kind: HorizontalPodAutoscaler
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "common.names.fullname" . }}-bootstrap
+ labels:
+ "app.kubernetes.io/name": '{{ template "common.names.name" . }}-bootstrap'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ template "common.names.fullname" . }}-bootstrap
+ minReplicas: {{ .Values.bootstrap.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.bootstrap.autoscaling.maxReplicas }}
+ metrics:
+ {{- if .Values.bootstrap.autoscaling.targetCPUUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: cpu
+ targetAverageUtilization: {{ .Values.bootstrap.autoscaling.targetCPUUtilizationPercentage }}
+ {{- end }}
+ {{- if .Values.bootstrap.autoscaling.targetMemoryUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: memory
+ targetAverageUtilization: {{ .Values.bootstrap.autoscaling.targetMemoryUtilizationPercentage }}
+ {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/charts/shenyu/templates/shenyu-bootstrap-ingress.yaml b/charts/shenyu/templates/shenyu-bootstrap-ingress.yaml
new file mode 100644
index 0000000..46169df
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-bootstrap-ingress.yaml
@@ -0,0 +1,64 @@
+{{- if .Values.bootstrap.ingress.enabled -}}
+{{- $fullName := include "common.names.fullname" . -}}
+{{- $svcPort := .Values.bootstrap.service.port -}}
+{{- if and .Values.bootstrap.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
+ {{- if not (hasKey .Values.bootstrap.ingress.annotations "kubernetes.io/ingress.class") }}
+ {{- $_ := set .Values.bootstrap.ingress.annotations "kubernetes.io/ingress.class" .Values.bootstrap.ingress.className}}
+ {{- end }}
+{{- end }}
+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1
+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
+apiVersion: networking.k8s.io/v1beta1
+{{- else -}}
+apiVersion: extensions/v1beta1
+{{- end }}
+kind: Ingress
+metadata:
+ name: {{ $fullName }}-bootstrap
+ labels:
+ "app.kubernetes.io/name": '{{ template "common.names.name" . }}-bootstrap'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ {{- with .Values.bootstrap.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if and .Values.bootstrap.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
+ ingressClassName: {{ .Values.bootstrap.ingress.className }}
+ {{- end }}
+ {{- if .Values.bootstrap.ingress.tls }}
+ tls:
+ {{- range .Values.bootstrap.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.bootstrap.ingress.hosts }}
+ - host: {{ .host | quote }}
+ http:
+ paths:
+ {{- range .paths }}
+ - path: {{ .path }}
+ {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
+ pathType: {{ .pathType }}
+ {{- end }}
+ backend:
+ {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
+ service:
+ name: {{ $fullName }}-bootstrap
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ serviceName: {{ $fullName }}-bootstrap
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/charts/shenyu/values.yaml b/charts/shenyu/values.yaml
index 2245d99..b581c09 100644
--- a/charts/shenyu/values.yaml
+++ b/charts/shenyu/values.yaml
@@ -64,6 +64,27 @@
# limits:
# cpu: 1000m
# memory: 1024Mi
+ autoscaling:
+ enabled: false
+ minReplicas: 1
+ maxReplicas: 10
+ targetCPUUtilizationPercentage: 75
+ targetMemoryUtilizationPercentage: 75
+ ingress:
+ enabled: false
+ className: ""
+ annotations: {}
+ # kubernetes.io/ingress.class: nginx
+ # kubernetes.io/tls-acme: "true"
+ hosts:
+ - host: shenyu-bootstrap.local
+ paths:
+ - path: /
+ pathType: ImplementationSpecific
+ tls: []
+ # - secretName: chart-example-tls
+ # hosts:
+ # - chart-example.local
#################################################
# datasource config of shenyu-admin #