[type:feat] complete h2 and mysql (#9)
* ci: make release ci work
Signed-off-by: Bird <aflybird0@gmail.com>
* feat: update chart template to complete h2
Signed-off-by: Bird <aflybird0@gmail.com>
* feat: support mysql as data source
Signed-off-by: Bird <aflybird0@gmail.com>
* feat: remove pv and classStorage
Signed-off-by: Bird <aflybird0@gmail.com>
* fix: pvc name error
Signed-off-by: Bird <aflybird0@gmail.com>
* fix: configMap name error
Signed-off-by: Bird <aflybird0@gmail.com>
* fix: svc url error
Signed-off-by: Bird <aflybird0@gmail.com>
* fix: endpoints name error
Signed-off-by: Bird <aflybird0@gmail.com>
* feat: support separate installation of admin and bootstrap
Signed-off-by: Bird <aflybird0@gmail.com>
* doc: update README
Signed-off-by: Bird <aflybird0@gmail.com>
* feat: update datasource config
Signed-off-by: Bird <aflybird0@gmail.com>
* ci: switch into prod env
Signed-off-by: Bird <aflybird0@gmail.com>
* doc: update README
Signed-off-by: Bird <aflybird0@gmail.com>
* doc: update README
Signed-off-by: Bird <aflybird0@gmail.com>
* chore: reset chart version
Signed-off-by: Bird <aflybird0@gmail.com>
Signed-off-by: Bird <aflybird0@gmail.com>
diff --git a/.github/actions/chart-releaser-action b/.github/actions/chart-releaser-action
new file mode 160000
index 0000000..6d70e85
--- /dev/null
+++ b/.github/actions/chart-releaser-action
@@ -0,0 +1 @@
+Subproject commit 6d70e8546cd3d35bc8981b932b83df0acc531bf4
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index fd58add..30f2631 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -2,9 +2,6 @@
on:
pull_request:
- push:
- branches:
- - main
jobs:
lint-test:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 47139fe..29949d9 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,7 +3,7 @@
on:
push:
branches:
- - "**-release"
+ - main
jobs:
release:
@@ -12,21 +12,22 @@
- name: Checkout
uses: actions/checkout@v2
with:
+ submodules: recursive
+ # ct needs history to compare
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
+
- name: Install Helm
uses: azure/setup-helm@v1
with:
- version: v3.4.1
+ version: v3.8.1
- name: Run chart-releaser
- uses: helm/chart-releaser-action@v1.1.0
- with:
- charts_dir: charts
+ uses: ./.github/actions/chart-releaser-action
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- CR_SKIP_EXISTING: true
\ No newline at end of file
+ CR_SKIP_EXISTING: true
diff --git a/.gitmodules b/.gitmodules
index 98fb360..e7cadd5 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule ".github/actions/kind-action"]
path = .github/actions/kind-action
url = https://github.com/helm/kind-action.git
+[submodule ".github/actions/chart-releaser-action"]
+ path = .github/actions/chart-releaser-action
+ url = https://github.com/helm/chart-releaser-action.git
diff --git a/README.md b/README.md
index f5e7369..fa0c370 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
-# shenyu-helm-chart
+# shenyu-helm-chart
+
+See [here](./charts/shenyu/README.md) for more information.
diff --git a/charts/shenyu/Chart.yaml b/charts/shenyu/Chart.yaml
index 4ca434a..86696cf 100644
--- a/charts/shenyu/Chart.yaml
+++ b/charts/shenyu/Chart.yaml
@@ -2,8 +2,10 @@
name: shenyu
description: Helm Chart for deploying Apache ShenYu in Kubernetes
type: application
-version: 2.4.3
-appVersion: "1.16.0"
+version: 0.1.0
+appVersion: "2.4.3"
icon: https://shenyu.apache.org/img/logo.png
maintainers:
- name: erdengk
+ - name: aFlyBird0
+ email: aflybird0@gmail.com
diff --git a/charts/shenyu/README.md b/charts/shenyu/README.md
index 0745e15..ea58d44 100644
--- a/charts/shenyu/README.md
+++ b/charts/shenyu/README.md
@@ -1,3 +1,139 @@
# shenyu-helm-chart
-Helm deployment documentation written for Apache/Shenyu
\ No newline at end of file
+Helm deployment documentation written for Apache/Shenyu.
+
+[English] [[简体中文]](#使用Helm安装ShenYu)
+
+[Apache/ShenYu](https://shenyu.apache.org/docs/index/) is an asynchronous, high-performance, cross-language, responsive API gateway.
+
+## Get Repo Info
+
+```shell
+helm repo add shenyu https://apache.github.io/shenyu-helm-chart
+helm repo update
+```
+
+_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
+
+todo: complete English version
+
+---
+
+## 使用Helm安装ShenYu
+[[English]](#shenyu-helm-chart) [简体中文]
+
+[Apache/ShenYu](https://shenyu.apache.org/zh/docs/index) 是一个异步的,高性能的,跨语言的,响应式的 API 网关。
+
+## 添加 Helm 仓库
+
+```shell
+helm repo add shenyu https://apache.github.io/shenyu-helm-chart
+helm repo update
+```
+
+## 安装
+* helm 安装方式目前支持 h2 与 MySQL 两种数据库。默认使用 h2。
+* 默认同时安装 admin 与 bootstrap。
+* 使用 NodePort 暴露服务,admin 默认端口为 31095, bootstrap 为 31195。
+
+### h2 作为数据库
+
+运行以下命令,会在 shenyu namespace 下安装 admin 与 bootstrap ,并创建命名空间。
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --create-namespace
+```
+
+### MySQL 作为数据库
+
+MySQL 安装方式需要提前安装好 MySQ,并提前创建好 pv 以存放 connector。详见 [部署先决条件](https://shenyu.apache.org/zh/docs/deployment/deployment-before/)。
+
+#### 1. 提前创建 pv
+
+可复制以下 yaml,至少**替换以下两处内容**:
+
+* `YOUR_K8S_NODE_NAME`:存放 MySQL connector 的 K8s 节点名称
+* `YOUR_PATH_TO_STORE_MYSQL_CONNECTOR`:# 指定节点上的目录, 该目录下面需要包含 mysql-connector.jar
+
+```shell
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: shenyu-pv
+spec:
+ capacity:
+ storage: 1Gi
+ volumeMode: Filesystem
+ accessModes:
+ - ReadWriteOnce
+ persistentVolumeReclaimPolicy: Delete
+ storageClassName: shenyu-local-storage
+ local:
+ path: YOUR_PATH_TO_STORE_MYSQL_CONNECTOR
+ nodeAffinity:
+ required:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: kubernetes.io/hostname
+ operator: In
+ values:
+ - YOUR_K8S_NODE_NAME
+---
+apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+ name: shenyu-local-storage
+provisioner: kubernetes.io/no-provisioner
+volumeBindingMode: WaitForFirstConsumer
+```
+
+修改并保存为 `shenyu-store.yaml`, 然后执行:
+
+```shell
+kubectl apply -f shenyu-store.yaml -n=shenyu
+```
+
+#### 2. 安装
+
+修改以下命令并复制,执行:
+
+其中,storageClass 和上面的 yaml 创建的 StorageClass 的 name 对应。
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --create-namespace \
+ --set dataSource.active=mysql \
+ --set dataSource.mysql.ip=127.0.0.1 \
+ --set dataSource.mysql.port=3306 \
+ --set dataSource.mysql.password=123456 \
+ --set dataSource.mysql.storageClass=shenyu-local-storage
+```
+
+## Q&A
+
+### 1. 如果只安装 admin 或 bootstrap
+
+* 只安装 admin: 在 helm 安装命令末尾加上 `--set bootstrap.enabled=false`
+* 只安装 bootstrap: 在 helm 安装命令末尾加上 `--set admin.enabled=false`
+
+### 2. 如何安装旧版本 ShenYu
+
+```shell
+helm search repo shenyu -l
+```
+
+你会得到类似的输出:
+
+```shell
+NAME CHART VERSION APP VERSION DESCRIPTION
+shenyu/shenyu 2.4.3 2.4.3 Helm Chart for deploying Apache ShenYu in Kuber...
+...
+...
+```
+
+其中 APP_VERSION 是 ShenYu 的版本,CHART_VERSION 是 helm chart 的版本。
+
+根据要安装的 ShenYu 版本来选择对应的 Chart 版本,在命令末尾加上 `--version=CHART_VERSION` 参数即可。例如:
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --version=2.4.3 --create-namespace
+```
diff --git a/charts/shenyu/templates/ConfigMap.yaml b/charts/shenyu/templates/ConfigMap.yaml
index 3de641f..be8cb4e 100644
--- a/charts/shenyu/templates/ConfigMap.yaml
+++ b/charts/shenyu/templates/ConfigMap.yaml
@@ -1,52 +1,86 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: shenyu-cm
- namespace: default
+ namespace: {{.Release.Namespace}}
+ name: {{ template "shenyu.fullname" . }}-configmap
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-configmap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
data:
application-local.yml: |
server:
- port: 9195
- address: 0.0.0.0
+ port: 9195
+ address: 0.0.0.0
spring:
- main:
- allow-bean-definition-overriding: true
- application:
- name: shenyu-bootstrap
+ profiles:
+ active: {{ .Values.dataSource.active }}
+ main:
+ allow-bean-definition-overriding: true
+ application:
+ name: shenyu-bootstrap
management:
- health:
- defaults:
- enabled: false
+ health:
+ defaults:
+ enabled: false
shenyu:
- local:
- enabled: true
- file:
- enabled: true
- cross:
- enabled: true
- dubbo:
- parameter: multi
- sync:
- websocket:
- urls: ws://shenyu-admin-svc.shenyu.svc.cluster.local:9095/websocket
- exclude:
- enabled: false
- paths:
- - /favicon.ico
- extPlugin:
- enabled: true
- threads: 1
- scheduleTime: 300
- scheduleDelay: 30
- scheduler:
- enabled: false
- type: fixed
- threads: 16
+ local:
+ enabled: true
+ file:
+ enabled: true
+ cross:
+ enabled: true
+ dubbo:
+ parameter: multi
+ sync:
+ websocket:
+ urls: ws://{{ template "shenyu.fullname" . }}-admin.shenyu.svc.cluster.local:9095/websocket
+ exclude:
+ enabled: false
+ paths:
+ - /favicon.ico
+ extPlugin:
+ enabled: true
+ threads: 1
+ scheduleTime: 300
+ scheduleDelay: 30
+ scheduler:
+ enabled: false
+ type: fixed
+ threads: 16
logging:
- level:
- root: info
- org.springframework.boot: info
- org.apache.ibatis: info
- org.apache.shenyu.bonuspoint: info
- org.apache.shenyu.lottery: info
- org.apache.shenyu: info
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.bonuspoint: info
+ org.apache.shenyu.lottery: info
+ org.apache.shenyu: info
+ {{- if eq .Values.dataSource.active "h2" }}
+ application-h2.yml: |
+ shenyu:
+ database:
+ dialect: h2
+ init_script: "sql-script/h2/schema.sql"
+ init_enable: {{ .Values.dataSource.initEnabled }}
+ spring:
+ datasource:
+ url: jdbc:h2:mem:~/shenyu;DB_CLOSE_DELAY=-1;MODE=MySQL;
+ username: {{ .Values.dataSource.h2.username }}
+ password: {{ .Values.dataSource.h2.password }}
+ driver-class-name: org.h2.Driver
+ {{- end }}
+ {{- if eq .Values.dataSource.active "mysql" }}
+ application-mysql.yml: |
+ shenyu:
+ database:
+ dialect: mysql
+ init_enable: {{ .Values.dataSource.initEnabled }}
+ spring:
+ datasource:
+ url: jdbc:mysql://{{ template "shenyu.fullname" . }}-mysql.shenyu.svc.cluster.local:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
+ username: {{ .Values.dataSource.mysql.username }}
+ password: {{ .Values.dataSource.mysql.password }}
+ driver-class-name: {{ .Values.dataSource.mysql.driverClass }}
+ {{- end }}
diff --git a/charts/shenyu/templates/_helpers.tpl b/charts/shenyu/templates/_helpers.tpl
new file mode 100644
index 0000000..28c199d
--- /dev/null
+++ b/charts/shenyu/templates/_helpers.tpl
@@ -0,0 +1,13 @@
+{{- define "shenyu.name" -}}
+{{- .Chart.Name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+
+{{- define "shenyu.fullname" -}}
+{{- $name := .Chart.Name -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
diff --git a/charts/shenyu/templates/deployment.yaml b/charts/shenyu/templates/deployment.yaml
deleted file mode 100644
index d9d79ae..0000000
--- a/charts/shenyu/templates/deployment.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- creationTimestamp: null
- labels:
- name: {{ .Release.Name }}
- app: {{ .Chart.Name }}-{{ .Release.Name}}
- name: {{ .Release.Name}}
-spec:
- replicas: {{ .Values.replicas}}
- selector:
- matchLabels:
- app: {{ .Values.label}}
- strategy: {}
- template:
- metadata:
- creationTimestamp: null
- labels:
- app: {{ .Values.label}}
- spec:
- containers:
- - name: shenyu-admin
- image: {{ .Values.admin.image }}:{{ default "2.4.2" .Values.admin.tag }}
- resources: {}
- - name: shenyu-bootstrap
- image: {{ .Values.bootstrap.image }}:{{ default "2.4.2" .Values.bootstrap.tag }}
- resources: {}
-status: {}
\ No newline at end of file
diff --git a/charts/shenyu/templates/service-admin.yaml b/charts/shenyu/templates/service-admin.yaml
deleted file mode 100644
index 1bc8973..0000000
--- a/charts/shenyu/templates/service-admin.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- creationTimestamp: null
- labels:
- app: {{ .Release.Name}}
- name: shenyu-admin
-spec:
- type: NodePort
- ports:
- - port: 9095
- protocol: TCP
- targetPort: 9095
- nodePort: 31095
- selector:
- app: {{ .Release.Name}}
\ No newline at end of file
diff --git a/charts/shenyu/templates/service-bootstrap.yaml b/charts/shenyu/templates/service-bootstrap.yaml
deleted file mode 100644
index 103f431..0000000
--- a/charts/shenyu/templates/service-bootstrap.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-{{ if .Values.bootstrap.enabled }}
-apiVersion: v1
-kind: Service
-metadata:
- creationTimestamp: null
- labels:
- app: {{ .Release.Name}}
- name: shenyu-bootstrap
-spec:
- type: NodePort
- ports:
- - port: 9195
- protocol: TCP
- targetPort: 9195
- nodePort: 31195
- selector:
- app: {{ .Release.Name}}
-status:
- loadBalancer: {}
-{{end}}
diff --git a/charts/shenyu/templates/shenyu-admin-deployment.yaml b/charts/shenyu/templates/shenyu-admin-deployment.yaml
new file mode 100644
index 0000000..87d7a4c
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-admin-deployment.yaml
@@ -0,0 +1,68 @@
+{{- if .Values.admin.enabled -}}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "shenyu.fullname" . }}-admin
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}-admin'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ selector:
+ matchLabels:
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ replicas: {{ .Values.replicas }}
+ template:
+ metadata:
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}-admin'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ spec:
+ containers:
+ - name: shenyu-admin
+ image: {{ .Values.admin.image }}:{{ required "A valid .Values.version entry required!" .Values.version }}
+ imagePullPolicy: Always
+ ports:
+ - containerPort: 9095
+ env:
+ - name: 'TZ'
+ value: 'Asia/Beijing'
+ {{- if eq .Values.dataSource.active "h2" }}
+ volumeMounts:
+ - name: shenyu-admin-config
+ mountPath: /opt/shenyu-admin/config/application-h2.yml
+ subPath: application-h2.yml
+ {{- end}}
+ {{- if eq .Values.dataSource.active "mysql" }}
+ volumeMounts:
+ - name: shenyu-admin-config
+ mountPath: /opt/shenyu-admin/config/application-mysql.yml
+ subPath: application-mysql.yml
+ - mountPath: /opt/shenyu-admin/ext-lib
+ name: mysql-connector-volume
+ {{- end}}
+ volumes:
+ {{- if eq .Values.dataSource.active "mysql" }}
+ - name: mysql-connector-volume
+ persistentVolumeClaim:
+ claimName: {{ template "shenyu.fullname" . }}-pvc
+ {{- end }}
+ - name: shenyu-admin-config
+ configMap:
+ name: {{ template "shenyu.fullname" . }}-configmap
+ items:
+ {{- if eq .Values.dataSource.active "mysql" }}
+ - key: application-mysql.yml
+ path: application-mysql.yml
+ {{- end }}
+ {{- if eq .Values.dataSource.active "h2" }}
+ - key: application-h2.yml
+ path: application-h2.yml
+ {{- end }}
+
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-admin-svc.yaml b/charts/shenyu/templates/shenyu-admin-svc.yaml
new file mode 100644
index 0000000..ea311b0
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-admin-svc.yaml
@@ -0,0 +1,23 @@
+{{- if .Values.admin.enabled -}}
+# Now we only support NodePort mode
+apiVersion: v1
+kind: Service
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "shenyu.fullname" . }}-admin
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}-admin'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ selector:
+ "app.kubernetes.io/component": "shenyu-admin"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ type: NodePort
+ ports:
+ - protocol: TCP
+ port: 9095
+ targetPort: 9095
+ nodePort: {{ .Values.admin.nodePort }}
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-bootstrap-deployment.yaml b/charts/shenyu/templates/shenyu-bootstrap-deployment.yaml
new file mode 100644
index 0000000..a5664bf
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-bootstrap-deployment.yaml
@@ -0,0 +1,46 @@
+{{- if .Values.bootstrap.enabled -}}
+# shenyu-bootstrap
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "shenyu.fullname" . }}-bootstrap
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}-bootstrap'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ selector:
+ matchLabels:
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ replicas: {{ .Values.replicas }}
+ template:
+ metadata:
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" . }}-bootstrap'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ spec:
+ volumes:
+ - name: shenyu-bootstrap-config
+ configMap:
+ name: {{ template "shenyu.fullname" . }}-configmap
+ items:
+ - key: application-local.yml
+ path: application-local.yml
+ containers:
+ - name: shenyu-bootstrap
+ image: {{ .Values.bootstrap.image }}:{{ required "A valid .Values.version entry required!" .Values.version }}
+ ports:
+ - containerPort: 9195
+ env:
+ - name: TZ
+ value: Asia/Beijing
+ volumeMounts:
+ - name: shenyu-bootstrap-config
+ mountPath: /opt/shenyu-bootstrap/conf/application-local.yml
+ subPath: application-local.yml
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-bootstrap-svc.yaml b/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
new file mode 100644
index 0000000..eecb17c
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-bootstrap-svc.yaml
@@ -0,0 +1,23 @@
+{{- if .Values.bootstrap.enabled -}}
+# Now we only support NodePort mode
+apiVersion: v1
+kind: Service
+metadata:
+ namespace: {{ .Release.Namespace }}
+ name: {{ template "shenyu.fullname" . }}-bootstrap
+ labels:
+ "app.kubernetes.io/name": '{{ template "shenyu.name" .}}-bootstrap'
+ "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+spec:
+ selector:
+ "app.kubernetes.io/component": "shenyu-bootstrap"
+ "app.kubernetes.io/instance": "{{ .Release.Name }}"
+ type: NodePort
+ ports:
+ - protocol: TCP
+ port: 9195
+ targetPort: 9195
+ nodePort: {{ .Values.bootstrap.nodePort }}
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-endpoint.yaml b/charts/shenyu/templates/shenyu-endpoint.yaml
new file mode 100644
index 0000000..46712d9
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-endpoint.yaml
@@ -0,0 +1,26 @@
+{{- if .Values.admin.enabled -}}
+{{- if eq .Values.dataSource.active "mysql" -}}
+kind: Service
+apiVersion: v1
+metadata:
+ name: {{ template "shenyu.fullname" . }}-mysql
+ namespace: {{ .Release.Namespace }}
+spec:
+ ports:
+ - port: 3306
+ name: mysql
+ targetPort: {{ required "database.mysql.port is required" .Values.dataSource.mysql.port }}
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+ name: {{ template "shenyu.fullname" . }}-mysql
+ namespace: {{ .Release.Namespace }}
+subsets:
+- addresses:
+ - ip: {{ required "database.mysql.ip is required" .Values.dataSource.mysql.ip }}
+ ports:
+ - port: {{ required "database.mysql.port is required" .Values.dataSource.mysql.port }}
+ name: mysql
+{{- end -}}
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-store.yaml b/charts/shenyu/templates/shenyu-store.yaml
new file mode 100644
index 0000000..ea77314
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-store.yaml
@@ -0,0 +1,18 @@
+{{- if .Values.admin.enabled -}}
+{{- if eq .Values.dataSource.active "mysql" -}}
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: {{ template "shenyu.fullname" . }}-pvc
+ namespace: {{ .Release.Namespace }}
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 1Gi
+ storageClassName: {{ required ".Values.dataSource.mysql.storageClass is required" .Values.dataSource.mysql.storageClass}}
+---
+{{- end -}}
+{{- end -}}
diff --git a/charts/shenyu/values.yaml b/charts/shenyu/values.yaml
index 1ea3621..f410d2b 100644
--- a/charts/shenyu/values.yaml
+++ b/charts/shenyu/values.yaml
@@ -1,13 +1,29 @@
+version: 2.4.3
replicas: 1
-
-label: shenyu
-version: 2.4.2
admin:
enabled: true
image: apache/shenyu-admin
- tag: 2.4.2
-
+ nodePort: 31095
bootstrap:
enabled: true
image: apache/shenyu-bootstrap
- tag: 2.4.2
+ nodePort: 31195
+dataSource:
+ # options: [h2, mysql]
+ active: h2
+ # init database and tables
+ initEnabled: true
+ h2:
+ username: sa
+ password: sa
+ mysql:
+ ip:
+ port: 3306
+ username: root
+ password:
+ # the existing storage class which stores mysql-connector.jar
+ storageClass:
+ # mysql driver class name
+ # mysql5 : com.mysql.jdbc.Driver
+ # mysql6-8 : com.mysql.cj.jdbc.Driver
+ driverClass: com.mysql.cj.Driver