Skip to content

Commit

Permalink
chore(doc, chart): add traffic-qos.md, update chart version to v0.3.1, (
Browse files Browse the repository at this point in the history
#376)

update example

Signed-off-by: xuanyuan300 <xuanyuan300@gmail.com>

Signed-off-by: xuanyuan300 <xuanyuan300@gmail.com>
  • Loading branch information
xuanyuan300 authored Nov 7, 2022
1 parent 2184ac1 commit d0a419b
Show file tree
Hide file tree
Showing 17 changed files with 496 additions and 5 deletions.
4 changes: 2 additions & 2 deletions charts/pisa-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ version: 0.2.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.0"
appVersion: "0.3.1"

dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
tags:
- bitnami-common
version: 1.x.x
version: 1.x.x
4 changes: 2 additions & 2 deletions charts/pisa-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ image:
repository: pisanixio/controller
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.3.0"
tag: "v0.3.1"
imagePullSecrets: [ ]

## @param proxyImage.repository 需要注入的 pisa-proxy 的镜像名
## @param proxyImage.tag 需要注入的 pisa-proxy 镜像tag
proxyImage:
repository: pisanixio/proxy
tag: "v0.3.0"
tag: "v0.3.1"

## @param resources.limits pisa-controller 资源限制数值
## @param resources.requests.cpu pisa-controller 资源申请cpu核数
Expand Down
86 changes: 86 additions & 0 deletions docs/docs/Features/traffic-qos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
sidebar_position: 8
---

# Pisa-Daemon

Pisa-Daemon 是用 rust 实现的数据面,主要通过主机内核的各种能力来实现资源管理。
目前的主要功能是:
* 运行时流量管理
借助 eBPF 技术为数据库访问流量提供 QoS 保证,以减少流量之间的互相干扰。

Pisa-Daemon 即可以部署在 kubernetes 中以 daemonset 的方式部署,也可以单独部署。

# 现状
当前 Pisa-Damon 实现了 Service 级别的 QoS,Service 来自 VirtualDatabase 中的定义。

主要实现技术是 ebpf + tc。

# 配置

* 在 kubernetes 中部署,需要依赖 `QoSClaim` CRD, Spec 配置项如下:

| 属性 | 值类型 | 是否依赖 | 默认值 | 含义 |
|-----|-------|---------|-------|-----|
|trafficQoS | [object](#trafficQoS-配置) ||| traffic qos |


## trafficQoS 配置
| 属性 | 值类型 | 是否依赖 | 默认值 | 含义 |
|-----|-------|---------|-------|-----|
|name | string||| qos 名称 |
|qos_group| [object](#qos_group-配置)||| 具体带宽限制 |

### qos_group 配置
| 属性 | 值类型 | 是否依赖 | 默认值 | 含义 |
|-----|-------|---------|-------|-----|
|rate | string||| 带宽最大值|
|ceil | string||| 如果带宽有剩余,带宽可以达到的最大值 |

rate 和 ceil 的单位可以是

bit, kbit, mbit, gbit,tbit 表示 bit/s。

bps,kbps, mbps, gbps, tbps 表示 bps/s。


注意点:

* 配置了 QoSClaim 后,需要在 VirtualDatabase 中配置 `qosClaim` 以生效。
* trafficQos 的 name 名称要包含在 VirtualDatabase 的 Serivice 中。

示例:
``` yaml
apiVersion: core.database-mesh.io/v1alpha1
kind: QoSCliam
metadata:
name: test
namespace: default
spec:
trafficQoS:
name: svc1
qos_group:
rate: 1mps
ceil: 2mps
```
* 单独部署配置如下:
``` toml
[global]
egress_device = "cali16adef18cfd"
bridge_device = "tunl0"

[[app]]
name = "test1"

[[app.service]]
name = "test"
[[app.service.endpoints]]
ip = "192.168.136.29"
port = 5201

[app.service.qos_group]
rate = "5mbps"
ceil = "5mbps"
```
File renamed without changes.
31 changes: 31 additions & 0 deletions example/sharding/database-strategy/databaseendpoint1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##
## Copyright 2022 SphereEx Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

apiVersion: core.database-mesh.io/v1alpha1
kind: DatabaseEndpoint
metadata:
labels:
source: test
name: ds001
namespace: default
spec:
database:
MySQL:
db: test
host: mysql1.default
password: root
port: 3306
user: root
31 changes: 31 additions & 0 deletions example/sharding/database-strategy/databaseendpoint2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
##
## Copyright 2022 SphereEx Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

apiVersion: core.database-mesh.io/v1alpha1
kind: DatabaseEndpoint
metadata:
labels:
source: test
name: ds002
namespace: default
spec:
database:
MySQL:
db: test
host: mysql2.default
password: root
port: 3306
user: root
35 changes: 35 additions & 0 deletions example/sharding/database-strategy/datashard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
##
## Copyright 2022 SphereEx Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

apiVersion: core.database-mesh.io/v1alpha1
kind: DataShard
metadata:
name: test
namespace: default
labels:
source: test
spec:
rules:
- tableName: "t_order"
databaseStrategy:
databaseShardingAlgorithmName: "mod"
databaseShardingColumn: "id"
actualDatanodes:
valueSource:
nodes:
- value: "ds001"
- value: "ds002"

70 changes: 70 additions & 0 deletions example/sharding/database-strategy/mysql1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
##
## Copyright 2022 SphereEx Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mysql1
name: mysql1
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: mysql1
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql1
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: root
image: mysql:5.7
imagePullPolicy: IfNotPresent
name: mysql
ports:
- containerPort: 3306
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: mysql1
namespace: default
spec:
ports:
- port: 3306
protocol: TCP
targetPort: 3306
selector:
app: mysql1
sessionAffinity: None
type: ClusterIP
70 changes: 70 additions & 0 deletions example/sharding/database-strategy/mysql2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
##
## Copyright 2022 SphereEx Authors
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mysql2
name: mysql2
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: mysql2
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql2
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: root
image: mysql:5.7
imagePullPolicy: IfNotPresent
name: mysql
ports:
- containerPort: 3306
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: mysql2
namespace: default
spec:
ports:
- port: 3306
protocol: TCP
targetPort: 3306
selector:
app: mysql2
sessionAffinity: None
type: ClusterIP
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d0a419b

Please sign in to comment.