membphis commented on a change in pull request #5:
URL: https://github.com/apache/apisix-control-plane/pull/5#discussion_r463420254
##########
File path: doc/yaml_struct.md
##########
@@ -0,0 +1,223 @@
+## Currently, 4 types are defined, namely
+1.Gateway
+2.Traffic distribution rules
+3.Define the target service
+4.Plug-in extension
+
+### Gateway
+For edge traffic, extract the host separately and define a Gateway type
+
+```yaml
+kind:Gateway
+name: baidu-gw
+servers:
+ - port:
+ number: 80
+ name: http
+ protocol: HTTP
+ hosts:
+ - "a.domain.com"
+ - "b.domain.com"
+```
+| object/field | describition |
+| ---- | ---- |
+| Gateway | the type for Edge traffic |
+| Gateway.servers | Define edge traffic service list |
+| Gateway.servers.port | the port for service |
+| Gateway.servers.port.protocol | Specify protocol |
+| Gateway.servers.hosts | List of domain names that a certain service can
accept |
+
+### Define traffic distribution rules
+
+```yaml
+kind: Rule
+name: xxx-rules
+hosts:
+- "domain.com"
+gateways:
+- baidu-gw
+http:
+- route:
+ - destination:
+ port: 28002
+ host: baidu-server
+ subset: baidu-v1
+ weight: 10
+ label:
+ app: baidu
+ version: v1
+ match:
+ - headers:
+ product_id:
+ exact: v1
+- route:
+ - destination:
+ port: 28002
+ host: baidu-server
+ subset: v2
+ label:
+ app: baidu
+ version: v2
+
+```
+| object/field | describition |
+| ---- | ---- |
+| Rule | the rule type for traffic |
+| Rule.hosts | Specify the list of accepted hosts |
+| Rule.gateways | Specify which gateway it belongs to, receive traffic from
the edge gateway |
+| Rule.http | Specify the HTTP protocol (similar to other protocols) |
+| Rule.http.route | define route|
+| Rule.http.match | Conditions for hitting the route|
+| Rule.http.route.destination | Target service definition|
+
+### Define the target service
+
+```yaml
+kind: destinations
+name: baidu-dest
+host: baidu-server
+subsets:
+- name: baidu-v1
+ ips:
+ - 127.0.0.1
+ - 127.0.0.2
+- name: v2
+ selector:
+ labels:
+ tag: v2
+
+```
+| object/field | describition |
+| ---- | ---- |
+| destinations | Target service |
+| destinations.host | Target service internal host |
+| destinations.subsets | Target service collection |
+
+### Plug-in extension
+The logic of the plugin itself is not defined here, only known plugins will be
referenced here
Review comment:
we'd better add a blank line between the title and context.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]