Skip to content

Commit

Permalink
feat: smartLimiter and dubbo support
Browse files Browse the repository at this point in the history
  • Loading branch information
trickMin committed Dec 22, 2022
1 parent 738d26a commit 149f92e
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ data:
cfg: |
{"bundle":{"modules":[{"name":"plugin","kind":"plugin"},{"name":"limiter","kind":"limiter"},{"name":"meshregistry","kind":"meshregistry"}]},"enable":true,"global":{"service":"","istioNamespace":"hango-system","slimeNamespace":"hango-system","istioRev":"","configRev":"mesh-reg","configSources":[{"address":"ss://"}],"log":{"klogLevel":5,"logLevel":"info"},"misc":{"pathRedirect":"/ready->/meshregistry/ready,/pc->/meshregistry/pc,/nc->/meshregistry/nc,/zk->/meshregistry/zk,/zks->/meshregistry/zks,/xdsCache->/meshregistry/xdsCache","xdsSourceEnableIncPush":"true"}},"name":"bundle"}
cfg_limiter: |
{"enable":true,"general":{"disableAdaptive":true,"disableGlobalRateLimit":true,"disableInsertGlobalRateLimit":true},"kind":"limiter","mode":"BundleItem","name":"limiter"}
{"enable":true,"general":{"disableInsertLocalRateLimit":true,"disableAdaptive":true,"disableGlobalRateLimit":true,"disableInsertGlobalRateLimit":true},"kind":"limiter","mode":"BundleItem","name":"limiter"}
cfg_plugin: |
{"enable":true,"kind":"plugin","mode":"BundleItem","name":"plugin"}
cfg_meshregistry: |
{"name":"meshregistry","kind":"meshregistry","enable":true,"mode":"BundleItem","general":{"LEGACY":{"MeshConfigFile":"","RevCrds":"","Mcp":{},"K8SSource":{"Enabled":false},"EurekaSource":{"Enabled":{{ .Values.registry.eureka.enable }},"Address":[{{ .Values.registry.eureka.address }}],"RefreshPeriod":"{{ .Values.registry.eureka.refresh_period }}","GatewayModel":true},"NacosSource":{"Enabled":{{ .Values.registry.nacos.enable }},"Address":[{{ .Values.registry.nacos.address }}],"GatewayModel":true,"Group":"{{ .Values.registry.nacos.service_group }}"}}}}
{"name":"meshregistry","kind":"meshregistry","enable":true,"mode":"BundleItem","general":{"LEGACY":{"MeshConfigFile":"","RevCrds":"","Mcp":{},"K8SSource":{"Enabled":false},"EurekaSource":{"Enabled":{{ .Values.registry.eureka.enable }},"Address":[{{ .Values.registry.eureka.address }}],"RefreshPeriod":"{{ .Values.registry.eureka.refresh_period }}","GatewayModel":true},"NacosSource":{"Enabled":{{ .Values.registry.nacos.enable }},"Address":[{{ .Values.registry.nacos.address }}],"GatewayModel":true,"Group":"{{ .Values.registry.nacos.service_group }}"},"ZookeeperSource":{"Enabled":{{ .Values.registry.zk.enable }},"WaitTime":{{ .Values.registry.zk.refresh_period }},"GatewayModel":true,"Address":[{{ .Values.registry.zk.address }}]}}}}
kind: ConfigMap
metadata:
name: slime-hango
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- name: NCE_PORT
value: "10880"
- name: NCE_JAVA_OPTS
value: "-DistioNamespace={{ .Values.namespace }} -DistioName=istiod -DstartInformer=false -DresourceNamespace={{ .Values.namespace }} "
value: "-DistioNamespace={{ .Values.namespace }} -DistioName=istiod -DstartInformer=false -DresourceNamespace={{ .Values.namespace }} -DmeshRegistryName=slime-hango"
image: "{{.Values.images.hango_apiplane_image}}"
name: tomcat
volumeMounts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,24 @@ data:
"name": "local-limiting"
},
"layouts": [
{
"key": "IsSafe",
"alias": "是否线程独立",
"type": "switch",
"help": "默认使用锁机制保证安全;如果打开该字段,代表线程独立。限流规则上限为rate*proxy worker"
},
{
"key": "limit_by_list",
"alias": "限流标识列表",
"alias": "限制规则列表",
"type": "array",
"layouts": [
{
"key": "headers",
"alias": "限流headers",
"alias": "请求头匹配",
"type": "array",
"layouts": [
{
"key": "headerKey",
"alias": "限流header",
"type": "input"
"alias": "请求头名称",
"type": "input",
"rules": [
"Required",
"MaxLength(200)"
]
},
{
"key": "match_type",
Expand All @@ -195,16 +193,18 @@ data:
"text": "正则表达式",
"value": "safe_regex_match"
}
],
"rules": [
"Required"
]
},
{
"key": "value",
"type": "input",
"alias": "取值",
"invisible": {
"present_match": ["this", "match_type"],
"present_match_invert": ["this", "match_type"]
}
"rules": [
"Required"
]
}
]
},
Expand All @@ -214,7 +214,7 @@ data:
"type": "number",
"rules": [
"Number",
"MinNumber(0)"
"MinNumber(1)"
]
},
{
Expand All @@ -223,7 +223,7 @@ data:
"type": "number",
"rules": [
"Number",
"MinNumber(0)"
"MinNumber(1)"
]
},
{
Expand All @@ -232,7 +232,7 @@ data:
"type": "number",
"rules": [
"Number",
"MinNumber(0)"
"MinNumber(1)"
]
},
{
Expand All @@ -241,7 +241,7 @@ data:
"type": "number",
"rules": [
"Number",
"MinNumber(0)"
"MinNumber(1)"
]
}
]
Expand Down Expand Up @@ -654,6 +654,9 @@ data:
"alias": "请求头名称",
"type": "input"
},
"rules": [
"MaxLength(200)"
],
{
"key": "match_type",
"alias": "匹配方式",
Expand Down Expand Up @@ -749,6 +752,9 @@ data:
"alias": "响应头名称",
"type": "input"
},
"rules": [
"MaxLength(200)"
],
{
"key": "match_type",
"alias": "匹配方式",
Expand Down Expand Up @@ -807,7 +813,7 @@ data:
"Required",
"Number",
"MinNumber(0)",
"MaxNumber(99999999)"
"MaxNumber(86400000)"
]
},
{
Expand All @@ -822,7 +828,10 @@ data:
"help": "支持输入具体的响应码及X..,如2..代表2XX响应码",
"type": "input",
"rules": [
"Required"
"Required",
"Number",
"MinNumber(200)",
"MaxNumber(599)"
]
},
{
Expand All @@ -833,7 +842,7 @@ data:
"Required",
"Number",
"MinNumber(0)",
"MaxNumber(99999999)"
"MaxNumber(86400000)"
]
}
]
Expand Down Expand Up @@ -866,13 +875,19 @@ data:
"key": "queryString",
"alias": "自定义查询参数",
"help": "自定义查询参数参与key计算",
"type": "multi_input"
"type": "multi_input",
"rules": [
"MaxLength(200)"
]
},
{
"key": "headers",
"alias": "自定义请求头",
"type": "multi_input",
"help": "自定义请求头参与key计算"
"help": "自定义请求头参与key计算",
"rules": [
"MaxLength(200)"
]
}
]
}
Expand Down Expand Up @@ -1083,7 +1098,8 @@ data:
"this.operation": "delete"
},
"rules": [
"Required"
"Required",
"MaxLength(200)"
]
}
]
Expand Down Expand Up @@ -1158,12 +1174,12 @@ data:
"alias": "最小请求次数",
"help": "与错误百分比阈值搭配生效,仅在统计窗口内,最小请求次数与错误百分比阈值同时满足时触发熔断",
"type": "input",
"placeholder": "范围 [1, 4294967295] 之间",
"placeholder": "范围 [1, 1000000] 之间",
"rules": [
"Required",
"Number",
"MinNumber(1)",
"MaxNumber(4294967295)"
"MaxNumber(1000000)"
]
}
]
Expand Down Expand Up @@ -1194,13 +1210,13 @@ data:
{
"key": "consecutiveSlowRequests",
"alias": "连续慢响应次数",
"help": "与响应时间阈值,范围 [1, 4294967295] 之间,与慢响应时间阈值搭配生效,当连续有",
"help": "与响应时间阈值,范围 [1, 10000] 之间,与慢响应时间阈值搭配生效,当连续有",
"type": "input",
"rules": [
"Required",
"Number",
"MinNumber(1)",
"MaxNumber(4294967295)"
"MaxNumber(10000)"
]
}
]
Expand All @@ -1210,25 +1226,25 @@ data:
"alias": "统计窗口",
"help": "统计窗口,单位s,默认10s,最大值为120s",
"type": "input",
"placeholder": "单位s,范围(0.0,120.0)",
"placeholder": "单位s,范围[1, 120]",
"rules": [
"Required",
"FloatNumber(5)",
"MaxFloatNumber(119.999)",
"MinFloatNumber(0.00001)"
"Number",
"MinNumber(1)",
"MaxNumber(120)"
]
},
{
"key": "breakDuration",
"alias": "惩罚时间",
"help": "当触发熔断时的惩罚时间,单位s,在该时间内不再请求后端服务而之间返回熔断后的定制响应",
"type": "input",
"placeholder": "单位s,范围 (0.0, 10000]",
"placeholder": "单位s,范围 [1, 7200]",
"rules": [
"Required",
"FloatNumber(5)",
"MaxFloatNumber(10000.0)",
"MinFloatNumber(0.00001)"
"Number",
"MinNumber(1)",
"MaxNumber(7200)"
]
},
{
Expand Down Expand Up @@ -1259,15 +1275,17 @@ data:
"type": "input",
"alias": "响应头名称",
"rules": [
"Required"
"Required",
"MaxLength(200)"
]
},
{
"key": "value",
"type": "input",
"alias": "响应头值",
"rules": [
"Required"
"Required",
"MaxLength(200)"
]
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ spec:
name: proxy.filters.http.iprestriction
port: 80
- enable: true
inline:
settings:
stat_prefix: http_local_rate_limiter
listenerType: Gateway
name: proxy.filters.http.locallimit
name: envoy.filters.http.local_ratelimit
port: 80
- enable: true
listenerType: Gateway
Expand Down
9 changes: 8 additions & 1 deletion install/helm/hango-gateway/charts/hango-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ registry:
## 刷新eureka服务缓存的时间周期,默认15s,格式为: [正整数]s
refresh_period: 15s
## 注册中心实例地址;格式:整体以英文单引号包裹,单个地址以英文双引号包裹,多个地址用英文逗号分隔
address: '"http://127.0.0.1:8761/eureka"'
address: '"http://127.0.0.1:8761/eureka"'
zk:
## zookeeper注册中心功能开关(true 或 false)
enable: false
## 刷新zookeeper服务缓存的时间周期,默认15s,格式为: [正整数]s
refresh_period: 15s
## 注册中心实例地址;格式:整体以英文单引号包裹,单个地址以英文双引号包裹,多个地址用英文逗号分隔
address: '"zookeeper.apigw-demo.svc.cluster.local:2181"'

0 comments on commit 149f92e

Please sign in to comment.