This is an automated email from the ASF dual-hosted git repository.
jooks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-helm-chart.git
The following commit(s) were added to refs/heads/main by this push:
new ec01b0a [TASk] add shenyu-admin ingress and hpa (#27)
ec01b0a is described below
commit ec01b0af7cfab933a31ff2bfcee9d4c81105c9af
Author: Misaya295 <[email protected]>
AuthorDate: Fri Dec 2 11:23:18 2022 +0800
[TASk] add shenyu-admin ingress and hpa (#27)
* hpa done
* add ingress and hpa
* add shenyu-admin ingress and hpa
* fix style
* fix style
* change default false
---
charts/shenyu/Chart.yaml | 2 +-
charts/shenyu/templates/shenyu-admin-hpa.yaml | 32 ++++++++++++
charts/shenyu/templates/shenyu-admin-ingress.yaml | 64 +++++++++++++++++++++++
charts/shenyu/templates/shenyu-admin-svc.yaml | 6 +--
charts/shenyu/templates/shenyu-bootstrap-svc.yaml | 6 +--
charts/shenyu/values.yaml | 61 +++++++++++++++------
6 files changed, 147 insertions(+), 24 deletions(-)
diff --git a/charts/shenyu/Chart.yaml b/charts/shenyu/Chart.yaml
index b6353b5..974f763 100644
--- a/charts/shenyu/Chart.yaml
+++ b/charts/shenyu/Chart.yaml
@@ -2,7 +2,7 @@ apiVersion: v2
name: shenyu
description: Helm Chart for deploying Apache ShenYu in Kubernetes
type: application
-version: 0.5.2
+version: 0.5.3
appVersion: "2.5.0"
icon: https://shenyu.apache.org/img/logo.png
maintainers:
diff --git a/charts/shenyu/templates/shenyu-admin-hpa.yaml
b/charts/shenyu/templates/shenyu-admin-hpa.yaml
new file mode 100644
index 0000000..2538063
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-admin-hpa.yaml
@@ -0,0 +1,32 @@
+{{- if .Values.admin.autoscaling.enabled }}
+apiVersion: autoscaling/v2beta1
+kind: HorizontalPodAutoscaler
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "common.names.fullname" . }}-admin
+ labels:
+ "app.kubernetes.io/name": '{{ template "common.names.name" . }}-admin'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{ template "common.names.fullname" . }}-admin
+ minReplicas: {{ .Values.admin.autoscaling.minReplicas }}
+ maxReplicas: {{ .Values.admin.autoscaling.maxReplicas }}
+ metrics:
+ {{- if .Values.admin.autoscaling.targetCPUUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: cpu
+ targetAverageUtilization: {{
.Values.admin.autoscaling.targetCPUUtilizationPercentage }}
+ {{- end }}
+ {{- if .Values.admin.autoscaling.targetMemoryUtilizationPercentage }}
+ - type: Resource
+ resource:
+ name: memory
+ targetAverageUtilization: {{
.Values.admin.autoscaling.targetMemoryUtilizationPercentage }}
+ {{- end }}
+{{- end }}
\ No newline at end of file
diff --git a/charts/shenyu/templates/shenyu-admin-ingress.yaml
b/charts/shenyu/templates/shenyu-admin-ingress.yaml
new file mode 100644
index 0000000..4eaff00
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-admin-ingress.yaml
@@ -0,0 +1,64 @@
+{{- if .Values.admin.ingress.enabled -}}
+{{- $fullName := include "common.names.fullname" . -}}
+{{- $svcPort := .Values.admin.service.port -}}
+{{- if and .Values.admin.ingress.className (not (semverCompare ">=1.18-0"
.Capabilities.KubeVersion.GitVersion)) }}
+ {{- if not (hasKey .Values.admin.ingress.annotations
"kubernetes.io/ingress.class") }}
+ {{- $_ := set .Values.admin.ingress.annotations
"kubernetes.io/ingress.class" .Values.admin.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 }}-admin
+ labels:
+ "app.kubernetes.io/name": '{{ template "common.names.name" . }}-admin'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ {{- with .Values.admin.ingress.annotations }}
+ annotations:
+ {{- toYaml . | nindent 4 }}
+ {{- end }}
+spec:
+ {{- if and .Values.admin.ingress.className (semverCompare ">=1.18-0"
.Capabilities.KubeVersion.GitVersion) }}
+ ingressClassName: {{ .Values.admin.ingress.className }}
+ {{- end }}
+ {{- if .Values.admin.ingress.tls }}
+ tls:
+ {{- range .Values.admin.ingress.tls }}
+ - hosts:
+ {{- range .hosts }}
+ - {{ . | quote }}
+ {{- end }}
+ secretName: {{ .secretName }}
+ {{- end }}
+ {{- end }}
+ rules:
+ {{- range .Values.admin.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 }}-admin
+ port:
+ number: {{ $svcPort }}
+ {{- else }}
+ serviceName: {{ $fullName }}-admin
+ servicePort: {{ $svcPort }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+{{- end }}
diff --git a/charts/shenyu/templates/shenyu-admin-svc.yaml
b/charts/shenyu/templates/shenyu-admin-svc.yaml
index 1338484..06ced5e 100644
--- a/charts/shenyu/templates/shenyu-admin-svc.yaml
+++ b/charts/shenyu/templates/shenyu-admin-svc.yaml
@@ -17,7 +17,7 @@ spec:
type: NodePort
ports:
- protocol: TCP
- port: 9095
- targetPort: 9095
- nodePort: {{ .Values.admin.nodePort }}
+ port: {{ .Values.admin.service.port }}
+ targetPort: {{ .Values.admin.service.targetPod }}
+ nodePort: {{ .Values.admin.service.nodePort }}
{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
b/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
index 0c0e976..4bef437 100644
--- a/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
+++ b/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
@@ -17,7 +17,7 @@ spec:
type: NodePort
ports:
- protocol: TCP
- port: 9195
- targetPort: 9195
- nodePort: {{ .Values.bootstrap.nodePort }}
+ port: {{ .Values.bootstrap.service.port }}
+ targetPort: {{ .Values.bootstrap.service.targetPod }}
+ nodePort: {{ .Values.bootstrap.service.nodePort }}
{{- end -}}
diff --git a/charts/shenyu/values.yaml b/charts/shenyu/values.yaml
index 8c5cb5d..2245d99 100644
--- a/charts/shenyu/values.yaml
+++ b/charts/shenyu/values.yaml
@@ -8,35 +8,62 @@ admin:
# replicas of admin, K8s will load balance the requests
replicas: 1
image: apache/shenyu-admin
- # if you want to change "admin service port", please edit here
- nodePort: 31095
+ service:
+ port: 9095
+ targetPod: 9095
+ # if you want to change "admin service port", please edit here
+ nodePort: 31095
# jvm options for admin
javaOpts: ""
# K8s resources quota for admin
resources:
-# requests:
-# cpu: 100m
-# memory: 512Mi
-# limits:
-# cpu: 1000m
-# memory: 1024Mi
+ # requests:
+ # cpu: 100m
+ # memory: 512Mi
+ # 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-admin.local
+ paths:
+ - path: /
+ pathType: ImplementationSpecific
+ tls: []
+ # - secretName: chart-example-tls
+ # hosts:
+ # - chart-example.local
bootstrap:
enabled: true
# replicas of bootstrap, K8s will load balance the requests
replicas: 2
image: apache/shenyu-bootstrap
- # if you want to change "bootstrap service port", please edit here
- nodePort: 31195
+ service:
+ port: 9195
+ targetPod: 9195
+ # if you want to change "bootstrap service port", please edit here
+ nodePort: 31195
# jvm options for bootstrap
javaOpts: ""
# K8s resources quota for bootstrap
resources:
-# requests:
-# cpu: 100m
-# memory: 512Mi
-# limits:
-# cpu: 1000m
-# memory: 1024Mi
+ # requests:
+ # cpu: 100m
+ # memory: 512Mi
+ # limits:
+ # cpu: 1000m
+ # memory: 1024Mi
#################################################
# datasource config of shenyu-admin #
@@ -236,7 +263,7 @@ applicationConfig:
allowedMethods: "*"
# the same of Access-Control-Allow-Origin: "*"
allowedAnyOrigin: true
- # allowedOrigin:
+ # allowedOrigin:
# format : schema://prefix spacer domain
# Access-Control-Allow-Origin:
"http://a.apache.org,http://b.apache.org"
# spacer: "."