4 网关配置
4.1 开放平台
4.1.1 开放平台IoT
k8s SVC 名称 |
前缀匹配 |
端口 |
命名空间 |
iot-device-manage |
/v1/manage/product/* |
8084 |
remac-middle-platform |
iot-device-manage |
/v1/manage/device/* |
|
remac-middle-platform |
iot-thing-engine |
/v1/manage/te/* |
8082 |
remac-middle-platform |
iot-td-manager |
/v1/manage/tm/* |
|
remac-middle-platform |
iot-td-manager |
/v1/manage/td/* |
8080 |
remac-middle-platform |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4.1.2 Router
4.1.2.1 iot-device-manage
{
"uri": "/v1/manage/*",
"name": "IOT-accessToken-api-sit.remacsmart.com",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416211682403025682",
"status": 1
}
4.1.2.2 iot-device-manage
{
"uri": "/v1/manage/te/*",
"name": "iot-thing-engine",
"desc": "iot-thing-engine",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416339069522412262",
"status": 1
}
4.1.2.3 iot-td-manager
{
"uris": [
"/v1/manage/tm/*",
"/v1/manage/td/*"
],
"name": "iot-td-manager",
"desc": "iot-td-manager",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416340097277887206",
"status": 1
}
4.1.2.4 开放平台帐号登录
{
"uris": [
"/v1/user/iot/access_token",
"/v1/user/iot/refresh_token",
"/v1/open/account/iot/register",
"/v1/open/token",
"/v1/user/iot/verifycode/send",
"/v1/user/random/code",
"/v1/openConsult/save",
"/v1/user/iot/access_token/jti",
"/v1/user/iot/logout"
],
"name": "开放平台帐号登录",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"cors": {
"allow_credential": true,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5
},
"real-ip": {
"source": "arg_realip",
"trusted_addresses": [
"127.0.0.0/24"
]
},
"response-rewrite": {
"headers": {
"remote_addr": "$remote_addr",
"remote_port": "$remote_port"
}
}
},
"upstream": {
"timeout": {
"connect": 6,
"send": 15,
"read": 15
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "eureka",
"pass_host": "pass",
"service_name": "IOT-MAIN-OAUTH2-SERVER",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
},
"status": 1
}
4.1.2.5 开放平台
{
"uris": [
"/v1/app/*",
"/v1/platform/*",
"/v1/tenant/*",
"/v1/openConsult/getOpenConsult",
"/v1/iot/user/*"
],
"name": "开放平台",
"desc": "开放平台",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"cors": {
"allow_credential": false,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5
},
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
],
"disable": false
}
},
"service_id": "431566059238064870",
"upstream_id": "416237855480742630",
"labels": {
"API_VERSION": "v1"
},
"status": 1
}
4.1.3 upstream
4.1.3.1 iot-device-manage
{
"retries": 2,
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "dns",
"pass_host": "pass",
"name": "iot-device-manage",
"desc": "IOT设备管理服务",
"service_name": "iot-device-manage.remac-middle-platform.svc.cluster.local:8084",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 5
}
4.1.3.2 iot-thing-engine
{
"retries": 2,
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "dns",
"pass_host": "pass",
"name": "iot-thing-engine",
"desc": "iot-thing-engine 服务",
"service_name": "iot-thing-engine.remac-middle-platform.svc.cluster.local:8080",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 6
}
4.1.3.3 iot-td-manager
{
"uris": [
"/v1/manage/tm/*",
"/v1/manage/td/*"
],
"name": "iot-td-manager",
"desc": "iot-td-manager",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api-sit.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416340097277887206",
"status": 1
}
4.1.3.4 开放平台账号认证
{
"retries": 2,
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "eureka",
"pass_host": "pass",
"name": "认证服务",
"desc": "IOT开放平台帐号登录",
"service_name": "IOT-MAIN-OAUTH2-SERVER",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 6
}
4.1.5 service
4.1.5.1 开放平台
{
"name": "开放平台",
"desc": "开放平台",
"upstream_id": "416237855480742630",
"plugins": {
"cors": {
"allow_credential": false,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5
},
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "iot-token-filter-plugin",
"value": "{\"validate_header\":\"iotAccountToken\",\"rejected_code\":\"200\"}"
}
],
"disable": false
}
},
"hosts": [
"api-sit.remacsmart.com"
]
}
4.1.4 白名单
4.2 AI风控
4.2.1 Router
{
"uri": "/v1/risk/*",
"name": "ai-risk-cloud-signToken",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "token-filter-plugin",
"value": "{\"validate_header\":\"signToken\",\"validate_url\":\"http://iot-main-oauth2-server.remac-community/v1/user/verifySignature\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416766422996222558",
"status": 1
}
4.2.2 Upstream
{
"retries": 2,
"timeout": {
"connect": 6,
"send": 35,
"read": 35
},
"type": "roundrobin",
"scheme": "http",
"discovery_type": "eureka",
"pass_host": "pass",
"name": "ai-risk-cloud",
"desc": "AI风控服务",
"service_name": "AI-RISK-CLOUD",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 5
}
4.2 测试数据
http://172.19.205.8:8084/v1/manage/product/page
https://api-sit.remacsmart.com/v1/user/iot/access_token
{
"client_id":"iot-client", "client_secret": "TKFivtoavjXyecMPDVr9S/z8nZl6dL/Ye86yTu77JiLbFDpa4z48GrI04VJ+zg/DVnxsDlQ3txVcBCuONvQUsJpEukBoAPxawXxQ9NFGNAjxIIQBf4DOf0UxzXFDm29iEWObS7GDWlME3zNVkzAx6ubq8axJN2io7q7WnVrLBBI=","pwd": "JeikPIaVoUoWqmiGY7YAnF/m4EOWugDoQBhJM/v/Az0XFx5qAP18USEi7wdyU9HJhEBghfuZ3NxMkHxN9nvttgfj2C7/Yb45JdejmrNvKAgIDEXk05Ybi6Gg03xDNaSS0mUvzSQwxWju40ea6i2FMS4hbSpY5d9Vu/TxY3mYQlU=",
"user_name": "iot_developer"
}
4.3 公众号/支付
{
"uris": [
"/gzh/*",
"/v1/iot/main/vegetaition/detail",
"/test2",
"/wx/wechat/account/apply",
"/wx/getOpenId",
"/wx/wechat/parkpay/*",
"/wx/wechat/monitor/*",
"/wx/wechat/grant",
"/wx/wechat/pay/*",
"/wx/plantwiki/*"
],
"name": "remac-pay-mid",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "iot.remacsmart.com",
"plugins": {
"cors": {
"allow_credential": false,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5,
"priority": 80
},
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "pay-token-filter-plugin",
"value": "{\"validate_header\":\"token,Authorization\",\"rejected_code\":\"200\"}"
}
],
"priority": 5
},
"response-rewrite": {
"disable": false,
"headers": {
"Location": "$schema://community-sit.remacsmart.com"
},
"priority": 100,
"status_code": 301,
"vars": [
[
"uri",
"==",
"test2"
]
]
}
},
"upstream_id": "413173183261180510",
"status": 1
}
4.4 监控
{
"uris": [
"/wechat/parklot/*",
"/parklot/*",
"/task/*"
],
"name": "remac-monitor",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "iot.remacsmart.com",
"upstream_id": "414297401268896350",
"status": 1
}
4.5 公众号H5
{
"uri": "/*",
"name": "pay.remacsmart.com",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "pay.remacsmart.com",
"plugins": {
"cors": {
"allow_credential": false,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5
}
},
"upstream": {
"nodes": [
{
"host": "172.16.130.91",
"port": 80,
"weight": 1
},
{
"host": "172.16.130.92",
"port": 80,
"weight": 1
}
],
"retries": 2,
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "http",
"pass_host": "pass",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
},
"retry_timeout": 6
},
"status": 1
}
4.6 AI 风控
{
"uri": "/v1/risk/*",
"name": "ai-risk-cloud-signToken",
"desc": "开放平台车场风控API",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"host": "api.remacsmart.com",
"plugins": {
"ext-plugin-pre-req": {
"allow_degradation": false,
"conf": [
{
"name": "token-filter-plugin",
"value": "{\"validate_header\":\"signToken\",\"validate_url\":\"http://iot-main-oauth2-server.remac-community/v1/user/verifySignature\",\"rejected_code\":\"200\"}"
}
]
}
},
"upstream_id": "416766422996222558",
"status": 1
}