You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by jo...@apache.org on 2022/10/04 06:34:35 UTC

[shenyu-helm-chart] branch main updated: [type: feat] Support PostgreSQL && update Readme in English (#16)

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 8396704  [type: feat] Support PostgreSQL && update Readme in English (#16)
8396704 is described below

commit 83967048a4d7eb3aa4667d6fc84b44829dfe7a7e
Author: Bird <af...@gmail.com>
AuthorDate: Tue Oct 4 14:34:30 2022 +0800

    [type: feat] Support PostgreSQL && update Readme in English (#16)
    
    * feat: support PostgreSQL and Oracle
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * feat: add param check
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * doc: update README
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * fix: namespace error
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * doc: update README
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * doc: reformat table in README
    
    Signed-off-by: Bird <af...@gmail.com>
    
    * doc: update README
    
    Signed-off-by: Bird <af...@gmail.com>
    
    Signed-off-by: Bird <af...@gmail.com>
---
 .github/workflows/ci.yaml                          |   4 +-
 charts/shenyu/Chart.yaml                           |   2 +-
 charts/shenyu/README.md                            | 176 ++++++++++++++++++++-
 charts/shenyu/templates/ConfigMap.yaml             |  39 ++++-
 .../shenyu/templates/shenyu-admin-deployment.yaml  |  87 +++++++++-
 charts/shenyu/templates/shenyu-datasource.yaml     |  84 ++++++++++
 charts/shenyu/templates/shenyu-endpoint.yaml       |  26 ---
 charts/shenyu/values.yaml                          |  27 +++-
 8 files changed, 390 insertions(+), 55 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index fbd1148..fb41f8d 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,8 +1,6 @@
 name: Lint and Test Charts
 
-on:
-  push:
-  pull_request:
+on: pull_request
 
 jobs:
   lint-test:
diff --git a/charts/shenyu/Chart.yaml b/charts/shenyu/Chart.yaml
index d0b7ce2..8754871 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.2.1
+version: 0.3.1
 appVersion: "2.5.0"
 icon: https://shenyu.apache.org/img/logo.png
 maintainers:
diff --git a/charts/shenyu/README.md b/charts/shenyu/README.md
index 75abc3e..862f2a1 100644
--- a/charts/shenyu/README.md
+++ b/charts/shenyu/README.md
@@ -6,14 +6,151 @@ Helm deployment documentation written for Apache/Shenyu.
 
 [Apache/ShenYu](https://shenyu.apache.org/docs/index/) is an asynchronous, high-performance, cross-language, responsive API gateway.
 
-## Get Repo Info
+## Add Helm repository
 
 ```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._
+## Install
+
+### Deployment prerequisites
+
+Before reading this document, you need to read [Deployment prerequisites](https://shenyu.apache.org/docs/deployment/deployment-before/) to complete the environment preparation before deploying ShenYu.
+
+### Instructions
+
+* **Install the application**: By default, both admin and bootstrap are installed.
+* **Service Exposure**: Use NodePort to expose the service, the default port is `31095` for admin and `31195` for bootstrap.
+* **Database**: Currently supports h2, MySQL, PostgreSQL as database. Default is h2.
+
+### h2 as database
+
+Running the following command will install admin and bootstrap under shenyu namespace and create namespace.
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --create-namespace
+```
+
+### MySQL as database
+
+Modify and copy the following command and execute.
+
+```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.username=root \
+      --set dataSource.mysql.password=123456 
+```
+
+## PostgreSQL as database(Version of ShenYu > 2.5.0)
+
+Modify the following command and copy it to execute.
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --create-namespace \
+      --set dataSource.active=pg \
+      --set dataSource.pg.ip=127.0.0.1 \
+      --set dataSource.pg.port=5432 \
+      --set dataSource.pg.username=postgres \
+      --set dataSource.pg.password=123456
+```
+
+## Q & A
+
+### 1. you need to modify a lot of configuration information, such as modify the application.yaml, how to install
+
+1. download the complete values.yaml
+* Latest chart version: `helm show values shenyu/shenyu > values.yaml`
+* Specific chart version, e.g. `0.2.0`: `helm show values shenyu/shenyu --version=0.2.0 > values.yaml`
+2. modify the values.yaml file
+3. Change the corresponding configuration and execute the `helm install` command with the format `-f values.yaml`.
+   For example: `helm install shenyu shenyu/shenyu -n=shenyu --create-namespace -f values.yaml`
+
+### 2. How to install only admin or bootstrap
+
+* Install only admin: add `-set bootstrap.enabled=false` to the end of the helm install command
+* Install only bootstrap: add `--set admin.enabled=false` to the end of the helm install command
+
+### 3. How to install old version ShenYu
+
+```shell
+helm search repo shenyu -l
+```
+
+You will get output similar to
+
+```shell
+NAME CHART VERSION APP VERSION DESCRIPTION
+shenyu/shenyu 0.2.0 2.5.0 Helm Chart for deploying Apache ShenYu in Kubernetes
+...
+...
+```
+
+where `APP_VERSION` is the version of ShenYu and `CHART_VERSION` is the version of Helm Chart.
+
+Select the corresponding Chart version according to the version of ShenYu you want to install, and add the `-version=CHART_VERSION` parameter at the end of the command. For example
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --version=0.2.0 --create-namespace
+```
+
+## Values configuration instructions
+
+### Global Configuration
+| configuration-item | type   | default                     | description                                                                                        |
+|--------------------|--------|-----------------------------|----------------------------------------------------------------------------------------------------|
+| replicas           | int    | `1`                         | Number of replicas                                                                                 |
+| version            | string | `"2.5.0"`                   | shenyu version, it is not recommended to modify, please install the corresponding version directly |
+| admin.enabled      | bool   | `true`                      | Whether to install shenyu-admin                                                                    |
+| admin.image        | string | `"apache/shenyu-admin"`     | shenyu-admin image                                                                                 |
+| admin.nodePort     | int    | `31095`                     | shenyu-admin NodePort                                                                              |
+| bootstrap.enabled  | bool   | `true`                      | whether to install shenyu-bootstrap                                                                |
+| bootstrap.image    | string | `"apache/shenyu-bootstrap"` | shenyu-bootstrap image                                                                             |
+| bootstrap.nodePort | int    | `31195`                     | shenyu-bootstrap NodePort                                                                          |
+
+### Database configuration
+
+#### General database configuration
+| configuration-item     | type   | default | description                                     |
+|------------------------|--------|---------|-------------------------------------------------|
+| dataSource.active      | string | `"h2"`  | Database to use, supports `h2`, `mysql`, `pg`   |
+| dataSource.initEnabled | bool   | `true`  | Initialize the database, only `h2` is available |
+
+#### h2
+| configuration item     | type   | default | description |
+|------------------------|--------|---------|-------------|
+| dataSource.h2.username | string | `"sa"`  | username    |
+| dataSource.h2.password | string | `"sa"`  | password    |
+
+#### MySQL
+| Configuration Item                | Type   | Default                      | Description                                                                                           |
+|-----------------------------------|--------|------------------------------|-------------------------------------------------------------------------------------------------------|
+| dataSource.mysql.ip               | string | `""`                         | IP                                                                                                    |
+| dataSource.mysql.port             | int    | `3306`                       | port                                                                                                  |
+| dataSource.mysql.username         | string | `"root"`                     | Username                                                                                              |
+| dataSource.mysql.password         | string | `""`                         | Password                                                                                              |
+| dataSource.mysql.driverClass      | string | `"com.mysql.cj.jdbc.Driver"` | mysql driver class name                                                                               |
+| dataSource.mysql.connectorVersion | string | `"8.0.23"`                   | connector version([maven connector list](https://repo1.maven.org/maven2/mysql/mysql-connector-java/)) |
+
+### PostgreSQL
+| configuration-item             | type   | default           | description                                                                                           |
+|--------------------------------|--------|-------------------|-------------------------------------------------------------------------------------------------------|
+| dataSource.pg.ip               | string | `""`              | IP                                                                                                    |
+| dataSource.pg.port             | int    | `5432`            | port                                                                                                  |
+| dataSource.pg.username         | string | `"postgres"`      | username                                                                                              |
+| dataSource.pg.password         | string | `"postgres"`      | password                                                                                              |
+| dataSource.pg.driverClass      | string | `"org.pg.Driver"` | PostgreSQL driver class name                                                                          |
+| dataSource.pg.connectorVersion | string | `"42.2.18"`       | connector version ([maven connector list](https://repo1.maven.org/maven2/org/postgresql/postgresql/)) |
+
+### application.yml configuration
+| configuration-item          | type   | default  | description                                                                                                                                          |
+|-----------------------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------|
+| applicationConfig.bootstrap | string | slightly | bootstrap configuration, [bootstrap configuration description](https://shenyu.apache.org/zh/docs/user-guide/property-config/gateway-property-config) |
+| applicationConfig.admin     | string | omit     | admin configuration, [admin configuration description](https://shenyu.apache.org/zh/docs/user-guide/property-config/admin-property-config)           |
 
 ---
 
@@ -38,8 +175,8 @@ helm repo update
 ### 说明
 
 * **安装应用**:默认同时安装 admin 与 bootstrap。
-* **服务暴露**:使用 NodePort 暴露服务,admin 默认端口为 31095, bootstrap 为 31195。
-* **数据库**:目前支持 h2 与 MySQL 两种数据库。默认使用 h2。
+* **服务暴露**:使用 NodePort 暴露服务,admin 默认端口为 `31095`, bootstrap 为 `31195`。
+* **数据库**:目前支持 h2, MySQL, PostgreSQL 作为数据库。默认使用 h2。
 
 ### h2 作为数据库
 
@@ -58,8 +195,21 @@ 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.username=root
-      --set dataSource.mysql.password=123456 \
+      --set dataSource.mysql.username=root \
+      --set dataSource.mysql.password=123456 
+```
+
+## PostgreSQL 作为数据库(ShenYu 版本 > 2.5.0)
+
+修改以下命令并复制,执行:
+
+```shell
+helm install shenyu shenyu/shenyu -n=shenyu --create-namespace \
+      --set dataSource.active=pg \
+      --set dataSource.pg.ip=127.0.0.1 \
+      --set dataSource.pg.port=5432 \
+      --set dataSource.pg.username=postgres \
+      --set dataSource.pg.password=123456
 ```
 
 ## Q&A
@@ -130,14 +280,24 @@ helm install shenyu shenyu/shenyu -n=shenyu --version=0.2.0 --create-namespace
 | dataSource.h2.password | string | `"sa"` | 密码   |
 
 #### MySQL
-| 配置项                             | 类型    | 默认值                          | 描述                                                                                               |
+| 配置项                             | 类型    | 默认值                        | 描述                                                                                               |
 |-----------------------------------|--------|------------------------------|---------------------------------------------------------------------------------------------------|
 | dataSource.mysql.ip               | string | `""`                         | IP                                                                                                |
 | dataSource.mysql.port             | int    | `3306`                       | 端口                                                                                               |
 | dataSource.mysql.username         | string | `"root"`                     | 用户名                                                                                             |
 | dataSource.mysql.password         | string | `""`                         | 密码                                                                                               |
-| dataSource.mysql.connectorVersion | string | `"8.0.23"`                   | connector 版本([maven connector 列表](https://repo1.maven.org/maven2/mysql/mysql-connector-java/)) |
 | dataSource.mysql.driverClass      | string | `"com.mysql.cj.jdbc.Driver"` | mysql driver class 名字                                                                            |
+| dataSource.mysql.connectorVersion | string | `"8.0.23"`                   | connector 版本([maven connector 列表](https://repo1.maven.org/maven2/mysql/mysql-connector-java/)) |
+
+### PostgreSQL
+| 配置项                          | 类型    | 默认值                     | 描述                                                                                              |
+|--------------------------------|--------|---------------------------|--------------------------------------------------------------------------------------------------|
+| dataSource.pg.ip               | string | `""`                      | IP                                                                                               |
+| dataSource.pg.port             | int    | `5432`                    | 端口                                                                                              |
+| dataSource.pg.username         | string | `"postgres"`              | 用户名                                                                                            |
+| dataSource.pg.password         | string | `""`                      | 密码                                                                                              |
+| dataSource.pg.driverClass      | string | `"org.postgresql.Driver"` | postgresql driver class 名字                                                                      |
+| dataSource.pg.connectorVersion | string | `"42.2.18"`               | connector 版本([maven connector 列表](https://repo1.maven.org/maven2/org/postgresql/postgresql/)) |
 
 ### application.yml 配置
 | 配置项                       | 类型    | 默认值 | 描述                                                                                                                      |
diff --git a/charts/shenyu/templates/ConfigMap.yaml b/charts/shenyu/templates/ConfigMap.yaml
index 480e9e4..e798d32 100644
--- a/charts/shenyu/templates/ConfigMap.yaml
+++ b/charts/shenyu/templates/ConfigMap.yaml
@@ -23,8 +23,8 @@ data:
     spring:
       datasource:
         url: jdbc:h2:mem:~/shenyu;DB_CLOSE_DELAY=-1;MODE=MySQL;
-        username: {{ .Values.dataSource.h2.username }}
-        password: {{ .Values.dataSource.h2.password }}
+        username: {{ required ".dataSource.h2.username is required" .Values.dataSource.h2.username }}
+        password: {{ required ".dataSource.h2.password is required" .Values.dataSource.h2.password }}
         driver-class-name: org.h2.Driver
   {{- end }}
   {{- if eq .Values.dataSource.active "mysql" }}
@@ -35,8 +35,39 @@ data:
         init_enable: {{ .Values.dataSource.initEnabled }}
     spring:
       datasource:
-        url: jdbc:mysql://{{ template "common.names.fullname" . }}-mysql.shenyu.svc.cluster.local:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
-        username: {{ .Values.dataSource.mysql.username }}
+        url: jdbc:mysql://{{ template "common.names.fullname" . }}-mysql.{{.Release.Namespace}}.svc.cluster.local:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+        username: {{ required ".dataSource.mysql.username is required" .Values.dataSource.mysql.username }}
         password: {{ required "`dataSource.mysql.password` is required" .Values.dataSource.mysql.password }}
         driver-class-name: {{ .Values.dataSource.mysql.driverClass }}
   {{- end }}
+  {{- if eq .Values.dataSource.active "pg" }}
+  application-pg.yml: |-
+    shenyu:
+      database:
+        dialect: postgresql
+        init_enable: {{ .Values.dataSource.initEnabled }}
+
+    spring:
+      datasource:
+        url: jdbc:postgresql://{{ template "common.names.fullname" . }}-pg.{{.Release.Namespace}}.svc.cluster.local:5432/shenyu
+        username: {{ required ".dataSource.pg.username is required" .Values.dataSource.pg.username }}
+        password: {{ required "`dataSource.pg.password` is required" .Values.dataSource.pg.password }}
+        driver-class-name: {{ .Values.dataSource.pg.driverClass }}
+
+    mybatis:
+      type-handlers-package: org.apache.shenyu.admin.mybatis.pg.handler
+  {{- end }}
+  {{- if eq .Values.dataSource.active "oracle" }}
+  application-oracle.yml: |-
+    shenyu:
+      database:
+        dialect: oracle
+        init_enable: {{ .Values.dataSource.initEnabled }}
+
+    spring:
+      datasource:
+        url: jdbc:oracle:thin:@{{ template "common.names.fullname" . }}-oracle.{{.Release.Namespace}}.svc.cluster.local:1521/shenyu
+        username: {{ required ".dataSource.oracle.username is required" .Values.dataSource.oracle.username }}
+        password: {{ required "`dataSource.oracle.password` is required" .Values.dataSource.oracle.password }}
+        driver-class-name: oracle.jdbc.OracleDriver
+  {{- end}}
diff --git a/charts/shenyu/templates/shenyu-admin-deployment.yaml b/charts/shenyu/templates/shenyu-admin-deployment.yaml
index 7baf5bd..93c7b19 100644
--- a/charts/shenyu/templates/shenyu-admin-deployment.yaml
+++ b/charts/shenyu/templates/shenyu-admin-deployment.yaml
@@ -23,20 +23,62 @@ spec:
         "app.kubernetes.io/component": "shenyu-admin"
         "app.kubernetes.io/instance": "{{ .Release.Name }}"
     spec:
+      {{/* check if database type is valid */}}
+      {{- $dataSourceTypeValid := has .Values.dataSource.active (list "h2" "mysql" "pg") -}}
+      {{- if not $dataSourceTypeValid -}}{{- required "Invalid `.dataSource.active`. Must be one of h2, mysql, pg" "" -}}{{- end}}
       {{- if eq .Values.dataSource.active "mysql"}}
-      {{- $mysqlConnectorVersion := (required "once `dataSource.active` is set to mysql, `dataSource.mysql.connectorVersion` should not be empty" .Values.dataSource.mysql.connectorVersion)}}
+      {{- $mysqlConnectorVersion := (required "once `dataSource.active` is set to 'mysql', `dataSource.mysql.connectorVersion` should not be empty" .Values.dataSource.mysql.connectorVersion)}}
       initContainers:
         - name: download-mysql-jar
           image: busybox:1.35.0
-          command: [ "sh","-c","wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{$mysqlConnectorVersion}}/mysql-connector-java-{{$mysqlConnectorVersion}}.jar;
-                wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{$mysqlConnectorVersion}}/mysql-connector-java-{{.Values.dataSource.mysql.connectorVersion}}.jar.md5;
+          command:
+            - "sh"
+            - "-c"
+            - "wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{$mysqlConnectorVersion}}/mysql-connector-java-{{$mysqlConnectorVersion}}.jar;
+                wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{$mysqlConnectorVersion}}/mysql-connector-java-{{$mysqlConnectorVersion}}.jar.md5;
                 if [ $(md5sum mysql-connector-java-{{$mysqlConnectorVersion}}.jar | cut -d ' ' -f1) = $(cat mysql-connector-java-{{$mysqlConnectorVersion}}.jar.md5) ];
                 then echo success;
-                else echo failed;exit 1;fi;mv /mysql-connector-java-{{$mysqlConnectorVersion}}.jar /opt/shenyu-admin/ext-lib/mysql-connector.jar" ]
+                else echo failed;exit 1;fi;mv /mysql-connector-java-{{$mysqlConnectorVersion}}.jar /opt/shenyu-admin/ext-lib/mysql-connector.jar"
           volumeMounts:
             - name: mysql-connector-volume
               mountPath: /opt/shenyu-admin/ext-lib
       {{- end }}
+      {{- if eq .Values.dataSource.active "pg"}}
+      {{- $pgConnectorVersion := (required "once `dataSource.active` is set to 'pg', `dataSource.pg.connectorVersion` should not be empty" .Values.dataSource.pg.connectorVersion)}}
+      initContainers:
+        - name: download-pg-jar
+          image: busybox:1.35.0
+          command:
+            - "sh"
+            - "-c"
+            - "wget https://repo1.maven.org/maven2/org/postgresql/postgresql/{{$pgConnectorVersion}}/postgresql-{{$pgConnectorVersion}}.jar;
+                wget https://repo1.maven.org/maven2/org/postgresql/postgresql/{{$pgConnectorVersion}}/postgresql-{{$pgConnectorVersion}}.jar.md5;
+                if [ $(md5sum postgresql-{{$pgConnectorVersion}}.jar | cut -d ' ' -f1) = $(cat postgresql-{{$pgConnectorVersion}}.jar.md5) ];
+                then echo success;
+                else echo failed;exit 1;fi;mv /postgresql-{{$pgConnectorVersion}}.jar /opt/shenyu-admin/ext-lib/postgresql-connector.jar"
+          volumeMounts:
+            - name: pg-connector-volume
+              mountPath: /opt/shenyu-admin/ext-lib
+      {{- end }}
+      # same as oracle
+      {{- if eq .Values.dataSource.active "oracle"}}
+      {{- $oracleConnectorVersion := (required "once `dataSource.active` is set to 'oracle', `dataSource.oracle.connectorVersion` should not be empty" .Values.dataSource.oracle.connectorVersion)}}
+      initContainers:
+        - name: download-oracle-jar
+          image: busybox:1.35.0
+          command:
+            # fixme: oracle jdbc driver is not free, so we can't download it from maven central, we need to download it from oracle official website
+            - "sh"
+            - "-c"
+            - "wget https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc8/{{$oracleConnectorVersion}}/ojdbc8-{{$oracleConnectorVersion}}.jar;
+                wget https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc8/{{$oracleConnectorVersion}}/ojdbc8-{{$oracleConnectorVersion}}.jar.md5;
+                if [ $(md5sum ojdbc8-{{$oracleConnectorVersion}}.jar | cut -d ' ' -f1) = $(cat ojdbc8-{{$oracleConnectorVersion}}.jar.md5) ];
+                then echo success;
+                else echo failed;exit 1;fi;mv /ojdbc8-{{$oracleConnectorVersion}}.jar /opt/shenyu-admin/ext-lib/oracle-connector.jar"
+          volumeMounts:
+            - name: oracle-connector-volume
+              mountPath: /opt/shenyu-admin/ext-lib
+      {{- end }}
       containers:
         - name: shenyu-admin
           image: {{ .Values.admin.image }}:{{ required "A valid .Values.version entry required!" .Values.version }}
@@ -57,24 +99,53 @@ spec:
             mountPath: /opt/shenyu-admin/conf/application-mysql.yml
             subPath: application-mysql.yml
           {{- end}}
+          {{- if eq .Values.dataSource.active "pg" }}
+          - name: pg-connector-volume
+            mountPath: /opt/shenyu-admin/ext-lib
+          - name: shenyu-admin-config
+            mountPath: /opt/shenyu-admin/conf/application-pg.yml
+            subPath: application-pg.yml
+          {{- end}}
+          {{- if eq .Values.dataSource.active "oracle" }}
+          - name: oracle-connector-volume
+            mountPath: /opt/shenyu-admin/ext-lib
+          - name: shenyu-admin-config
+            mountPath: /opt/shenyu-admin/conf/application-oracle.yml
+            subPath: application-oracle.yml
+          {{- end}}
       volumes:
         {{- if eq .Values.dataSource.active "mysql" }}
         - name: mysql-connector-volume
           emptyDir: { }
         {{- end }}
+        {{- if eq .Values.dataSource.active "pg" }}
+        - name: pg-connector-volume
+          emptyDir: { }
+        {{- end }}
+        {{- if eq .Values.dataSource.active "oracle" }}
+        - name: oracle-connector-volume
+          emptyDir: { }
+        {{- end }}
         - name: shenyu-admin-config
           configMap:
             name: {{ template "common.names.fullname" . }}-configmap
             items:
             - key: application-admin.yml
               path: application.yml
+            {{- if eq .Values.dataSource.active "h2" }}
+            - key: application-h2.yml
+              path: application-h2.yml
+            {{- end }}
             {{- 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
+            {{- if eq .Values.dataSource.active "pg" }}
+            - key: application-pg.yml
+              path: application-pg.yml
+            {{- end }}
+            {{- if eq .Values.dataSource.active "oracle" }}
+            - key: application-oracle.yml
+              path: application-oracle.yml
             {{- end }}
-
 {{- end -}}
diff --git a/charts/shenyu/templates/shenyu-datasource.yaml b/charts/shenyu/templates/shenyu-datasource.yaml
new file mode 100644
index 0000000..605c065
--- /dev/null
+++ b/charts/shenyu/templates/shenyu-datasource.yaml
@@ -0,0 +1,84 @@
+{{- if .Values.admin.enabled -}}
+{{ if eq .Values.dataSource.active "mysql" -}}
+############# MySQL Begin #############
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ template "common.names.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 "common.names.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 -}}
+
+---
+
+{{ if eq .Values.dataSource.active "pg" -}}
+############# PostgreSQL Begin #############
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ template "common.names.fullname" . }}-pg
+  namespace: {{ .Release.Namespace }}
+spec:
+  ports:
+    - port: 5432
+      name: pg
+      targetPort: {{ required "database.pg.port is required" .Values.dataSource.pg.port }}
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+  name: {{ template "common.names.fullname" . }}-pg
+  namespace: {{ .Release.Namespace }}
+subsets:
+  - addresses:
+      - ip: {{ required "database.pg.ip is required" .Values.dataSource.pg.ip }}
+    ports:
+      - port: {{ required "database.pg.port is required" .Values.dataSource.pg.port }}
+        name: pg
+{{ end -}}
+
+---
+
+{{ if eq .Values.dataSource.active "oracle" -}}
+############# Oracle Begin #############
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ template "common.names.fullname" . }}-oracle
+  namespace: {{ .Release.Namespace }}
+spec:
+    ports:
+    - port: 1521
+      name: oracle
+      targetPort: {{ required "database.oracle.port is required" .Values.dataSource.oracle.port }}
+---
+kind: Endpoints
+apiVersion: v1
+metadata:
+  name: {{ template "common.names.fullname" . }}-oracle
+  namespace: {{ .Release.Namespace }}
+subsets:
+- addresses:
+  - ip: {{ required "database.oracle.ip is required" .Values.dataSource.oracle.ip }}
+  ports:
+  - port: {{ required "database.oracle.port is required" .Values.dataSource.oracle.port }}
+    name: oracle
+{{ end -}}
+
+{{- end -}}
diff --git a/charts/shenyu/templates/shenyu-endpoint.yaml b/charts/shenyu/templates/shenyu-endpoint.yaml
deleted file mode 100644
index b262d57..0000000
--- a/charts/shenyu/templates/shenyu-endpoint.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-{{- if .Values.admin.enabled -}}
-{{- if eq .Values.dataSource.active "mysql" -}}
-kind: Service
-apiVersion: v1
-metadata:
-  name: {{ template "common.names.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 "common.names.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/values.yaml b/charts/shenyu/values.yaml
index ebdce70..b64cd1b 100644
--- a/charts/shenyu/values.yaml
+++ b/charts/shenyu/values.yaml
@@ -20,7 +20,7 @@ bootstrap:
 #################################################
 
 dataSource:
-  # options: [h2, mysql]
+  # options: [h2, mysql, pg]
   active: h2
   # init database and tables
   initEnabled: true
@@ -37,6 +37,23 @@ dataSource:
     # mysql6-8 : com.mysql.cj.jdbc.Driver
     driverClass: com.mysql.cj.jdbc.Driver
     connectorVersion: 8.0.23
+  pg:
+    ip:
+    port: 5432
+    username: postgres
+    password:
+    # pg driver class name
+    driverClass: org.postgresql.Driver
+    connectorVersion: 42.5.0
+  # not supported yet, coming soon
+  oracle:
+    ip:
+    port: 1521
+    username: root
+    password:
+    # oracle driver class name
+    driverClass: oracle.jdbc.OracleDriver
+    connectorVersion: 19.3.0.0
 
 #################################################
 #     application.yml of admin and bootstrap    #
@@ -218,14 +235,14 @@ applicationConfig:
         maxSize: 10
       sync:
         websocket:
-          urls: ws://{{ template "common.names.fullname" . }}-admin.shenyu.svc.cluster.local:9095/websocket
-          allowOrigin: ws://{{ template "common.names.fullname" . }}-bootstrap.shenyu.svc.cluster.local:9195
+          urls: ws://{{ template "common.names.fullname" . }}-admin.{{.Release.Namespace}}.svc.cluster.local:9095/websocket
+          allowOrigin: ws://{{ template "common.names.fullname" . }}-bootstrap.{{.Release.Namespace}}.svc.cluster.local:9195
       #    zookeeper:
       #      url: localhost:2181
       #      sessionTimeout: 5000
       #      connectionTimeout: 2000
       #    http:
-      #      url: http://{{ template "common.names.fullname" . }}-admin.shenyu.svc.cluster.local:9095
+      #      url: http://{{ template "common.names.fullname" . }}-admin.{{.Release.Namespace}}.svc.cluster.local:9095
       #      username:
       #      password:
       #    nacos:
@@ -351,7 +368,7 @@ applicationConfig:
         websocket:
           enabled: true
           messageMaxSize: 10240
-          allowOrigins: ws://{{ template "common.names.fullname" . }}-admin.shenyu.svc.cluster.local:9095;ws://{{ template "common.names.fullname" . }}-bootstrap.shenyu.svc.cluster.local:9195;
+          allowOrigins: ws://{{ template "common.names.fullname" . }}-admin.{{.Release.Namespace}}.svc.cluster.local:9095;ws://{{ template "common.names.fullname" . }}-bootstrap.{{.Release.Namespace}}.svc.cluster.local:9195;
       #      zookeeper:
       #        url: localhost:2181
       #        sessionTimeout: 5000