Routing rule generation method, flow routing method, server and storage medium
Through the service mesh control plane component dynamically divides the service subset and generates dynamic marking and routing rules, the problem that static routing rules cannot cover all traffic labels is solved, and stronger routing scalability and flexibility is achieved.
Patent Information
- Application Number
- CN202410014482.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-03
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, statically defined routing rules cannot cover all traffic tags and routing destinations, resulting in undefined traffic tags or routing rules being forwarded and flexible routing capabilities cannot be achieved.
User configuration data is obtained through the control plane component in the service mesh, dynamically divide application service instances into service subsets, and dynamic marking rules and routing rules are generated, and dynamic routing is performed according to traffic labels and drainage rules.
It realizes that without modifying the definition information of static routing rules, covers more traffic tags and routing rules, reduces the risk that undefined traffic tags or routing rules will cause requests to be unable to be forwarded, and improves the scalability and flexibility of routing.
Smart Images

Figure CN120263719A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a method for generating routing rules, a traffic routing method, a server, and a storage medium. Background Art
[0002] A service mesh is often used to describe the microservice network that makes up an application and the interactions between applications. As an infrastructure layer for handling communication between services, the service mesh is responsible for reliably delivering requests by constructing the complex service topologies of modern cloud-native applications. In a service mesh, an ingress gateway or a mesh proxy can receive requests from an application and route the requests to the corresponding application service instance according to the traffic labels carried by the requests. In some typical methods, routing paths corresponding to different traffic labels are defined by statically defining routing rules. However, this way of statically defining routing rules cannot cover all traffic labels and routing destinations. When a certain traffic label or routing destination is not defined in the routing rules, the traffic corresponding to the traffic label cannot be forwarded. Therefore, there is a need to propose a new solution. Summary of the Invention
[0003] Multiple aspects of this application provide a method for generating routing rules, a traffic routing method, a server, and a storage medium, which are used to dynamically generate routing rules according to lane group definition information, lane configuration data, and label configuration data.
[0004] An embodiment of this application provides a method for generating routing rules, including: obtaining, by a control plane component in a service mesh, label configuration data provided by a user, lane group definition information of a target lane group, and lane configuration data of multiple traffic lanes in the target lane group; the lane group definition information includes: at least one drainage rule of the target lane group; any drainage rule is used to describe the mapping relationship between traffic matching conditions and traffic lanes; dividing multiple application service instances in the multiple traffic lanes into multiple service subsets according to the lane group definition information and the lane configuration data of the multiple traffic lanes; generating dynamic tagging rules for each of the multiple service subsets according to the label configuration data; any dynamic tagging rule of a service subset is used to describe the way of adding traffic labels to the egress access requests of the service subset; generating dynamic routing rules based on traffic labels for each of the multiple service subsets according to the dynamic tagging rules of each of the multiple service subsets and the at least one drainage rule.
[0005] Optionally, it further includes: sending the corresponding dynamic tagging rules and dynamic routing rules of the multiple service subsets to the grid proxy components of the multiple service subsets respectively, so that any grid proxy component tags the egress access requests of the application service instances it proxies according to the received dynamic tagging rules and forwards the tagged egress access requests according to the received dynamic routing rules.
[0006] Optionally, according to the lane group definition information and the lane configuration data of the multiple traffic lanes, dividing the multiple application service instances in the multiple traffic lanes into multiple service subsets includes: determining multiple logical services included in the target lane group according to the lane group definition information; obtaining the logical services and feature tags to which the multiple application service instances in the multiple traffic lanes belong respectively from the lane configuration data of the multiple traffic lanes; dividing the application service instances that belong to the same logical service and have the same feature tag into the same service subset.
[0007] Optionally, generating the dynamic tagging rules of the multiple service subsets according to the tag configuration data includes: parsing the tagging rule description information and the effective subject information in the tag configuration data to obtain at least one dynamic tagging rule and its effective subject range; any dynamic tagging rule includes: rule effective conditions and tag generation methods; distributing the at least one dynamic tagging rule to the multiple service subsets according to the effective subject range corresponding to each of the at least one dynamic tagging rule.
[0008] Optionally, generating the dynamic routing rules based on traffic tags of the multiple service subsets according to the dynamic tagging rules of the multiple service subsets and the at least one drainage rule includes: for any target service subset among the multiple service subsets, determining the target dynamic tagging rule corresponding to the target service subset; determining the traffic destination of the target service subset under the at least one drainage rule according to the traffic lane to which the target service subset belongs and the call relationship of the multiple logical services; generating the dynamic routing rule based on traffic tags of the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one drainage rule.
[0009] Optionally, determining the traffic destination of the target service subset under the at least one traffic diversion rule according to the traffic lane to which the target service subset belongs and the call relationship of the multiple logical services includes: for any one of the at least one traffic diversion rule, if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the first traffic lane, determining the service subset corresponding to the next target logical service in the first traffic lane as the next target service subset of the target service subset; if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the call link of the first traffic lane, determining the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset; the reference traffic lane includes the application service instances of all the logical services in the target lane group; if the traffic diversion destination of the traffic diversion rule is the second traffic lane that does not include the target service subset, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determining the service subset corresponding to the next target logical service in the second traffic lane as the next target service subset of the target service subset; if the traffic diversion destination of the traffic diversion rule is the second traffic lane that does not include the target service subset, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determining the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset.
[0010] Optionally, generating a dynamic routing rule based on traffic labels for the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule, including: establishing a mapping relationship among the target dynamic tagging rule, the traffic diversion rule, and the traffic destination of the target service subset under the traffic diversion rule, to obtain a dynamic routing rule of the target service subset under the traffic diversion rule.
[0011] Optionally, it also includes: obtaining, from the lane group definition information, identification information of the ingress gateway component of the target lane group, identification information of the ingress logical service of the target lane group, and at least one diversion rule of the ingress gateway component; and according to the identification information of the ingress gateway component, sending the identification information of the ingress logical service of the target lane group and the at least one diversion rule to the ingress gateway component, so that when the ingress gateway component receives any access request, it diverts the received access request to the service subset corresponding to the ingress logical service among the multiple service subsets according to the traffic matching conditions satisfied by the received access request.
[0012] An embodiment of the present application also provides a traffic routing method, including: receiving a first access request through a first grid proxy component; determining whether the first access request meets the rule effectiveness conditions corresponding to the dynamic labeling rule; if so, generating a target traffic label according to the label generation method in the dynamic labeling rule; adding the target traffic label to the first access request to obtain a second access request; forwarding the second access request to a second grid proxy component according to the target traffic label and the dynamic routing rule; the dynamic labeling rule and the dynamic routing rule are generated using the routing rule generation method provided in the embodiment of the present application.
[0013] An embodiment of the present application also provides a server, comprising: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to: execute the steps in the method provided in the embodiment of the present application.
[0014] The embodiment of the present application also provides a computer-readable storage medium storing a computer program, which can implement the steps in the method provided in the embodiment of the present application when the computer program is executed by a processor.
[0015] In this embodiment, the control plane component can divide multiple application service instances in multiple traffic lanes into multiple service subsets based on various configuration data provided by the user, and obtain at least one traffic diversion rule for the target lane group and the dynamic tagging rules for each of the multiple service subsets; according to the dynamic tagging rules for each of the multiple service subsets and the at least one traffic diversion rule, dynamic routing rules for each of the multiple service subsets can be generated. In this implementation, without the need to modify the static routing rule definition information, dynamic tagging rules and dynamic routing rules can be obtained through various configuration data, so as to flexibly cover more traffic tags and corresponding routing rules. On the one hand, the frequency of modifying the static routing rule definition information can be reduced, and the data volume of the static routing rule definition information can be decreased. On the other hand, the data plane component can add traffic tags to requests according to the dynamic tagging rules and perform routing and forwarding of requests based on the dynamic routing rules, reducing the dependence on the static routing rule definition information, thereby reducing the risk that requests cannot be forwarded due to undefined traffic tags or undefined routing rules, and achieving a more scalable and flexible routing ability, so as to cover more communication scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0017] Figure 1 is a schematic diagram of a service mesh provided by an exemplary embodiment of the present application;
[0018] Figure 2 is a schematic flowchart of a traffic tag processing method provided by an exemplary embodiment of the present application;
[0019] Figure 3-1 is a schematic diagram of a target lane group provided by an exemplary embodiment of the present application;
[0020] Figure 3-2 is a schematic flowchart of a routing rule generation method executed in a service mesh provided by an exemplary embodiment of the present application;
[0021] Figure 4 is a schematic flowchart of a traffic routing method provided by an exemplary embodiment of the present application;
[0022] Figure 5 is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following will clearly and completely describe the technical solutions of this application in combination with specific embodiments of this application and the corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of this application.
[0024] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "the", and "said" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "Plural" generally includes at least two, but does not exclude the case of including at least one.
[0025] It should be understood that the term "and / or" used herein is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.
[0026] It should also be noted that the term "comprises", "comprising", or any other variation thereof is intended to cover a non-exclusive inclusion, such that a commodity or system including a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such commodity or system. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of another identical element in the commodity or system including the said element.
[0027] To more clearly describe the technical solutions provided by the embodiments of this application, the service mesh architecture and some related concepts involved in the embodiments of this application will be introduced below.
[0028] Among them, Service Mesh is a dedicated infrastructure layer used to achieve reliable, fast, and secure inter-service calls in a microservices architecture. Among them, Service Mesh is mainly used to facilitate secure and reliable communication between multiple microservices. Microservices refer to decomposing an application into multiple smaller services or instances and running them on different clusters / machines. Among them, an application service instance can also be called a workload. Each application service instance is bound with a mesh proxy to achieve communication and management between services.
[0029] Such as Figure 1As shown, the microservices include application service instance A and application service instance B, and application service instance A and application service instance B form the functional application layer of the service mesh 100. In one implementation, application service instances A and B run in the form of containers / processes in a machine / workload container group.
[0030] In one implementation, application service instance A can be a product query service, and application service instance B can be a product order placement service.
[0031] As Figure 1 shown, application service instance A and mesh proxy (sidecar) 103 coexist in machine / workload container group 109, and application service instance B and mesh proxy 105 coexist in machine / workload container group 110. Mesh proxies 103 and 105 form the data plane layer of service mesh 100. Among them, mesh proxies 103 and 105 are running in the form of containers / processes 104 and containers / processes 106 respectively. Among them, application service instance A and application service instance B are running in the form of containers / processes 107 and containers / processes 108 respectively. Bidirectional communication can be carried out between mesh proxy 103 and application service instance A, and bidirectional communication can be carried out between mesh proxy 105 and application service instance B. In addition, bidirectional communication can also be carried out between mesh proxy 103 and mesh proxy 105.
[0032] In one implementation, all traffic of application service instance A is routed to the appropriate destination through mesh proxy 103, and all network traffic of application service instance B is routed to the appropriate destination through mesh proxy 105.
[0033] In one implementation, the function of the extended data plane layer can be realized by writing a custom filter (Filter) for the proxy (Envoy) in service mesh 100. The mesh proxy configuration can be to correctly proxy service traffic in the service mesh, realize service interconnection and service governance. Mesh proxies 103 and 105 can be configured to perform at least one of the following functions: service discovery, health checking, routing, load balancing, authentication and authorization, and observability.
[0034] As Figure 1As shown, the service mesh 100 further includes a control plane layer. Among them, the control plane layer can be a set of services running in a dedicated namespace, and the managed control plane components 101 host these services in the machine / workload container group (machine / Pod) 102. As Figure 1 shown, the managed control plane components 101 communicate bidirectionally with the mesh proxy 103 and the mesh proxy 105. The managed control plane components 101 are configured to perform some control and management functions. For example, the managed control plane components 101 receive the telemetry data transmitted by the mesh proxy 103 and the mesh proxy 105, and can further aggregate this telemetry data. For these services, the managed control plane components 101 can also provide user-facing application programming interfaces (Application Programming Interface, API) to more easily manipulate network behavior and provide configuration data to the mesh proxy 103 and the mesh proxy 105.
[0035] In a service mesh, the ingress gateway (such as API Gateway) is mainly responsible for handling external traffic entry and providing functions such as API management and access control. The mesh proxy (such as Sidecar Proxy) is responsible for communication and management between application service instances. The two together constitute the infrastructure of the service mesh, realizing fine-grained traffic control, policy implementation, and security protection.
[0036] In a service mesh, an endpoint usually refers to the network address of an application service instance, that is, the specific network location of the application service instance in the service mesh, usually including information such as an IP address and a port number. When the mesh proxy receives a request from the outside, it will forward the request to the corresponding application service instance endpoint.
[0037] In a service mesh, a traffic label is a mechanism for labeling and managing traffic. Usually, when an application service instance registers with the service mesh, it carries some traffic labels, which describe the specific attributes or identities of the application service instance. Traffic labels are usually embedded in the request header or URL (Uniform Resource Locator) parameters to identify different service instances and service versions, and then distribute requests to different service instances or service versions. When the mesh proxy of the application service instance receives a request sent by the application service instance, it can determine the target application service instance corresponding to the request according to the traffic label and the predefined routing rules, and route the request to the target application service instance.
[0038] In a service mesh, a service subset refers to a group of application service instances with the same characteristics. For example, application service instances of the same version of different application services can be grouped into a service subset. The mesh proxies corresponding to the application service instances in a service subset form a proxy cluster.
[0039] In a service mesh, a VirtualService is used to define the routing rules for different service subsets of a logical service in the service mesh. Each VirtualService consists of a set of routing rules, and a set of routing rules can include at least one mapping relationship between a specific traffic matching condition and a service subset. If a given request for a logical service meets the traffic matching condition in a routing rule, the given request can be matched to the service subset corresponding to the traffic matching condition.
[0040] In a service mesh, a DestinationRule is used to define different service subsets according to labels, so that the VirtualService can route the request traffic to the service subset according to the labels of the service subset. Among them, the labels of the service subset are defined in the Deployment / Pod specification.
[0041] In some typical methods, the routing rules corresponding to different traffic labels are defined by statically defining the routing rules. However, this static definition method cannot cover all headers. When the information of a certain header is not defined in the routing rules, the traffic corresponding to the header cannot be forwarded. For example, in some scenarios, the client needs to send an HTTP (Hypertext Transfer Protocol) request to the target endpoint of the backend service through the ingress gateway. Among them, the target endpoint can be specified by the HTTP header. For example, the header of the HTTP request can include information such as tag=target-1, version=v2.1 for identifying the target endpoint. When a new workload needs to be created, the DestinationRule and the VirtualService need to be updated to add new subsets and routing rules. When an existing workload needs to be deleted, the DestinationRule and the VirtualService need to be updated to delete the old subsets and routing rules. If the above update operations are not performed, the request cannot be accurately routed to the corresponding backend endpoint. When a service has a large number of endpoints, the size of the configuration data of the Route Discovery Service (RDS), Cluster Discovery Service (CDS), and Endpoint Discovery Service (EDS) in the microservice network will increase sharply.
[0042] In view of the above technical problems, in some embodiments of the present application, a solution is provided. The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0043] Figure 2 FIG. 4 is a schematic flowchart of a traffic label processing method provided by an exemplary embodiment of the present application. The method may include the following steps: Figure 2 as shown:
[0044] Step 201: Obtain label configuration data provided by a user, lane group definition information of a target lane group, and lane configuration data of each of a plurality of traffic lanes in the target lane group through a control plane component in a service mesh; the lane group definition information includes: at least one traffic diversion rule of the target lane group; any traffic diversion rule is used to describe a traffic matching condition and a mapping relationship between a traffic lane.
[0045] Step 202: Divide a plurality of application service instances in the plurality of traffic lanes into a plurality of service subsets according to the lane group definition information and the lane configuration data of each of the plurality of traffic lanes.
[0046] Step 203: Generate a dynamic tagging rule for each of the plurality of service subsets according to the label configuration data; the dynamic tagging rule for any service subset is used to describe a manner of adding a traffic label to an egress access request for the service subset.
[0047] Step 204: Generate a dynamic routing rule based on traffic labels for each of the plurality of service subsets according to the dynamic tagging rules for each of the plurality of service subsets and the at least one traffic diversion rule.
[0048] Among them, a plurality of application service instances are running in the service mesh, and the plurality of application service instances can provide multiple logical services. A logical service is used to describe the service or function provided by an application service instance from an application level. For example, the logical service provided by a plurality of order service instances with different versions is an order service; the logical service provided by a plurality of payment service instances with different versions is a payment service; the logical service provided by a plurality of logistics service instances with different versions is a logistics service.
[0049] Among them, a swim-lane-group is a way to group logical services in a service mesh. Generally, a swim-lane-group contains a set of logical services for completing independent service functions or requirements. These logical services are interrelated and have call relationships with each other. For example, in a swim-lane-group, logical services such as order service A, payment service B, and logistics service C may be included. The swim-lane-group can provide an independent online ordering function for users based on the above services. In practical applications, the set of application service instances of logical services can be divided according to information such as the attributes of the user groups corresponding to the logical services, the regions targeted by the logical services, or the functional modules provided by the services, to obtain multiple swim-lane-groups. For example, a part of the application service instances of order service A, a part of the application service instances of payment service B, and a part of the application service instances of logistics service C can be divided into swim-lane-group G1, which is used to provide an online ordering function for users in region Y1; another part of the application service instances of order service A, another part of the application service instances of payment service B, and another part of the application service instances of logistics service C can be divided into swim-lane-group G2, which is used to provide an online ordering function for users in region Y2.
[0050] In this embodiment, the target swim-lane-group can be any swim-lane-group in the service mesh. Among them, a swim-lane-group can contain multiple swim-lanes, and the multiple swim-lanes are independent of each other and can perform independent traffic control and management operations. Any swim-lane (hereinafter referred to as a swim-lane) refers to an invocation link isolation environment composed of different logical services with the same characteristics. Among them, the same characteristics can include at least one of the following: the same version, the same environment (for example, belonging to the same development environment or production environment), and the same data center. This embodiment does not make restrictions. For example, in swim-lane-group G1, the first swim-lane may include the workloads of the V1 versions of order service A, payment service B, and logistics service C respectively, and the second swim-lane may include the workloads of the V2 versions of order service A, payment service B, and logistics service C respectively. Another example is that in swim-lane-group G2, the first swim-lane may include the workloads of order service A, payment service B, and logistics service C running in the development environment, and the second swim-lane may include the workloads of order service A, payment service B, and logistics service C running in the test environment.
[0051] In a service mesh, a lane group can be dynamically defined through lane group definition information. The lane group definition information is used to define the logical services included in the lane group. The lane group definition information can be provided by a user, who can be a developer or an operator of the logical service. Among them, the lane group definition information can at least include: the name of the lane group and the identification information of all the logical services corresponding to the lane group. Among them, the identification information of the logical service can include: the name of the logical service, the namespace of the logical service, and the cluster to which it belongs. For example, in some embodiments, the obtained lane group definition information can be as shown in Table 1 below:
[0052] Table 1
[0053]
[0054] Among them, the lane configuration data is used to configure the name of the traffic lane, the lane group where the traffic lane is located, and the logical services and their characteristic information managed by the traffic lane. Optionally, the characteristic information of any logical service can be described by characteristic tags, and the characteristic tags can include at least one of environment tags, version tags, and region tags. Among them, the environment tags can include at least one of test environment tags, production environment tags, and development environment tags.
[0055] Taking the target lane group as an example, the control plane component can divide multiple application service instances in the target lane group into multiple service subsets according to the lane group definition information of the target lane group and the lane configuration data of each of the multiple traffic lanes in the target lane group. Among them, one service subset includes one or more application service instances that belong to the same logical service and have the same characteristics.
[0056] Optionally, the control plane component can determine the multiple logical services included in the target lane group according to the lane group definition information, and obtain the logical services and characteristic tags to which the multiple application service instances in the multiple traffic lanes belong from the lane configuration data of the multiple traffic lanes. The control plane component can divide the application service instances that belong to the same logical service and have the same characteristic tags into the same service subset.
[0057] When dividing the service subsets, the control plane component can obtain the metadata information of each of the multiple application service instances, and according to the obtained metadata information, divide the application service instances that belong to the same logical service and have the same characteristic tags into the same service subset. Among them, the metadata information of any application service instance can be obtained and submitted to the control plane component by the grid proxy component bound to it. Based on the grid proxy component, the control plane component can obtain the metadata of the application service instance with little or no modification to the program of the application service instance.
[0058] Among them, the application service instances in a traffic lane can be divided into one or more service subsets. When a traffic lane contains multiple service subsets, the multiple service subsets have the same characteristics and belong to different logical services. For example, in some embodiments, the application service instances of the same logical service can be divided according to the version label of the logical service to obtain one or more service subsets. The version labels of the application service instances in each service subset are the same, and each service subset can use the version label as the label of the service subset.
[0059] For example, in a sample first lane configuration data, some definition data can be as shown in Table 2-1 below:
[0060] Table 2-1
[0061]
[0062]
[0063] In another sample second lane configuration data, some definition data can be as shown in Table 2-2 below:
[0064] Table 2-2
[0065]
[0066] In yet another sample third lane configuration data, some definition data can be as shown in Table 2-3 below:
[0067] Table 2-3
[0068]
[0069] Based on the above first lane configuration data, the control plane component can divide the application service instances with the service name of serviceA and the version label (version) of v1 into one service subset, divide the application service instances with the service name of serviceB and the version label of v1 into one service subset, and divide the application service instances with the service name of serviceC and the version label of v1 into one service subset. Based on the above second lane configuration data, the control plane component can divide the application service instances with the service name of serviceB and the version label of v2 into one service subset. Based on the above third lane configuration data, the control plane component can divide the application service instances with the service name of serviceA and the version label of v3 into one service subset, and divide the application service instances with the service name of serviceC and the version label of v3 into one service subset. Among them, each service subset can use the version label as the label of the service subset.
[0070] A sample division result of the service subset can be as shown in Table 3 below:
[0071] Table 3
[0072]
[0073]
[0074] When a new application service instance is added to a lane, the new application service instance can be automatically divided into the service subset corresponding to the feature label according to the feature label of the new application service instance and the logical service to which the new application service instance belongs.
[0075] In this embodiment, the control plane component can also obtain label configuration data for generating dynamic tagging rules for traffic labels.
[0076] The label configuration data is used to describe the rules for adding traffic labels to requests sent to logical services. Optionally, in the label configuration data, different traffic label setting rules can be defined for different logical services to customize the generation of traffic labels corresponding to different logical services respectively. Optionally, the same traffic label setting rules can also be defined for different logical services to uniformly configure the traffic labels of logical services at the global or namespace level. Among them, the label configuration data can be provided by the user. After obtaining the label data, the control plane component can generate at least one dynamic tagging rule according to the label configuration data, and any dynamic tagging rule is used to describe the method of adding traffic labels to access requests. An example of a sample label configuration data is shown in Table 4 below:
[0077] Table 4
[0078]
[0079]
[0080] Optionally, when generating at least one dynamic tagging rule according to the label configuration data, the control plane component can parse the tagging rule description information and the effective subject information in the label configuration data to obtain at least one dynamic tagging rule and its effective subject range; any dynamic tagging rule includes: rule effective conditions and label generation methods. Optionally, the rule effective conditions can include: effective callee range or effective protocol range. According to the effective subject range corresponding to each of the at least one dynamic tagging rule, the at least one dynamic tagging rule can be assigned to multiple service subsets.
[0081] An example of a dynamic tagging rule can be shown in Table 5 below:
[0082] Table 5
[0083]
[0084] The dynamic tagging rules illustrated in Table 5 above apply to global application service instances and can thus be assigned to all service subsets.
[0085] Another example of dynamic tagging rules is as shown in Table 6 below:
[0086] Table 6
[0087]
[0088]
[0089] The dynamic tagging rules illustrated in Table 6 above apply to the application service instances of logical service A and can thus be assigned to the service subsets corresponding to logical service A.
[0090] Optionally, for any one of the at least one dynamic tagging rule, according to the scope of the effective entity of the dynamic tagging rule, the dynamic tagging rule is sent to the grid proxy component corresponding to any application service instance within the scope of the effective entity of the dynamic tagging rule, so that the grid proxy component adds a traffic label to the egress access request of the application service instance according to the dynamic tagging rule.
[0091] Optionally, the control plane component can also obtain the metadata information of multiple application service instances in the multiple traffic lanes. Based on this, when sending the dynamic tagging rule, it can respectively determine whether the multiple application service instances are within the scope of the effective entity of the dynamic tagging rule according to the metadata information of the multiple application service instances; if at least one of the multiple application service instances is within the scope of the effective entity, the dynamic tagging rule is sent to the grid proxy component corresponding to each of the at least one application service instance.
[0092] When a new logical service is added to the service mesh, the label configuration data of the newly added logical service can be updated to update the dynamic tagging rules corresponding to the logical service. According to the updated dynamic tagging rules, dynamic traffic labels can be added to the traffic of the newly added logical service without intruding into the newly added logical service.
[0093] After obtaining the dynamic tagging rules of each of the foregoing service subsets, the traffic destinations of the multiple service subsets under the at least one traffic diversion rule can be determined respectively according to the dynamic tagging rules of each of the multiple service subsets and the at least one traffic diversion rule of the target lane group. According to the dynamic tagging rules of each of the multiple service subsets and the traffic destinations of the multiple service subsets under the at least one traffic diversion rule, the dynamic routing rules based on traffic tags of each of the multiple service subsets can be generated. Among them, the dynamic routing rule is used to describe the correspondence between the dynamically generated traffic tag and the routing destination. Among them, the traffic destination of any service subset is the service subset corresponding to the next logical service of the logical service to which the service subset belongs in the call link.
[0094] In some optional embodiments, the at least one traffic diversion rule of the target lane group can be provided by the user through the lane group definition information. Among them, any traffic diversion rule is used to describe the mapping relationship between the traffic matching condition and the traffic lane. If the given request received by the ingress gateway component meets the traffic matching condition in a certain traffic diversion rule, the given request can be matched to the traffic lane corresponding to the traffic matching condition and the specific service subset in the traffic lane. For example, a traffic diversion rule can be: route the traffic that meets traffic matching condition 1 to the service subset s1 in lane SL1; another traffic diversion rule can be: route the traffic that meets traffic matching condition 2 to the service subset s2 in lane SL2; and another traffic diversion rule can be: route the traffic that meets traffic matching condition 3 to the service subset s3 in lane SL3. Among them, the matching condition can include: matching by header and / or matching by URI (Uniform Resource Identifier).
[0095] In an example of the lane group definition information, the identification information of the ingress gateway component of the traffic lane and the configuration data of the traffic diversion rule of the ingress gateway component are shown in Table 7 below:
[0096] Table 7
[0097]
[0098] According to the dynamic tagging rules of each of the multiple service subsets and the at least one traffic diversion rule, the dynamic routing rules based on traffic tags of each of the multiple service subsets can be generated. Optionally, the control plane component can determine the traffic destinations of the multiple service subsets under the at least one traffic diversion rule respectively according to the traffic lanes to which the multiple service subsets belong and the at least one traffic diversion rule. According to the dynamic tagging rules of each of the multiple service subsets and the traffic destinations of the multiple service subsets under the at least one traffic diversion rule, the dynamic routing rules based on traffic tags of each of the multiple service subsets can be generated.
[0099] Taking any service subset as an example, the optional implementation manners for obtaining the dynamic routing rules of any service subset will be described exemplarily. Among them, this any service subset is described as the target service subset.
[0100] For any target service subset among multiple service subsets, the control plane component can determine the target dynamic routing rule corresponding to the target service subset according to the effective scope of the at least one dynamic tagging rule. Determine the traffic destination of the target service subset under the at least one traffic diversion rule according to the traffic lane to which the target service subset belongs and the call relationship of multiple logical services. Generate the dynamic routing rule based on traffic tags of the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule.
[0101] Correspondingly, when generating the dynamic routing rule based on traffic tags of the target service subset, for any traffic diversion rule, the control plane component can establish a mapping relationship among the target dynamic tagging rule, this traffic diversion rule, and the traffic destination of the target service subset under this traffic diversion rule, and obtain a dynamic routing rule of the target service subset under this traffic diversion rule.
[0102] Taking any traffic diversion rule as an example will be described exemplarily below.
[0103] Optionally, if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is a service subset of the next target logical service of the target logical service corresponding to the target service subset in the first traffic lane, determine that there is a service subset of the next target logical service in the first traffic lane as the next target service subset of the target service subset. Take the Figure 3-1 schematic target lane group as an example. Suppose the target service subset is service subset SA-v1, and the traffic diversion destination of traffic diversion rule r1 is traffic lane SL1. In the call link of traffic lane SL1, the next service subset of service subset SA-v1 is service subset SB-v1. Therefore, service subset SB-v1 can be used as the traffic destination of service subset SA-v1, and the mapping relationship among the dynamic tagging rule of service subset SA-v1, this traffic diversion rule r1, and service subset SB-v1 can be established as a dynamic routing rule of service subset SA-v1.
[0104] Optionally, if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is no service subset of the next target logical service of the target logical service corresponding to the target service subset in the call link of the first traffic lane, determine the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset; the reference traffic lane includes application service instances of all logical services in the target lane group. Continuing with theFigure 3-1 Take the schematic target lane group as an example. Continuing with Figure 3-1 as an example, assume that the target service subset is service subset SB-v2, and the drainage destination of drainage rule r2 is traffic lane SL2. As Figure 3-1 shown, in the call link of traffic lane SL2, there is no next service subset for service subset SB-v2. Then, the service subset SB-v1 that belongs to the same logical service as service subset SB-v2 can be determined in traffic lane SL1 (i.e., the reference traffic lane), and the next service subset of service subset SB-v1 (i.e., service subset SC-v1) can be used as the traffic destination of service subset SB-v2. Additionally, the mapping relationship between the dynamic tagging rule of service subset SB-v2, this drainage rule r2, and service subset SC-v1 can be established as a dynamic routing rule for service subset SB-v1.
[0105] Optionally, if the drainage destination of the drainage rule is a second traffic lane that does not include the target service subset, and there is a service subset for the next target logical service of the target logical service corresponding to the target service subset in the second traffic lane, then determine the service subset corresponding to the next target logical service in the second traffic lane as the next target service subset of the target service subset. Continuing with Figure 3-1 as an example, assume that the target service subset is service subset SB-v1, the drainage destination of drainage rule r3 is traffic lane SL3, and the target logical service corresponding to service subset SB-v1 is logical service B. As Figure 3-1 shown, there is a service subset for logical service B in traffic lane SL3, that is, service subset SC-v3. Then, service subset SC-v3 can be used as the traffic destination of service subset SB-v1, and the mapping relationship between the dynamic tagging rule of service subset SB-v1, this drainage rule r3, and service subset SC-v3 can be established as a dynamic routing rule for service subset SB-v1.
[0106] Optionally, if the drainage destination of the drainage rule is a second traffic lane that does not include the target service subset, and there is no service subset for the next target logical service of the target logical service corresponding to the target service subset in the second traffic lane, then determine the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset. Continuing with Figure 3-1 as an example, assume that the target service subset is service subset SB-v1, the drainage destination of drainage rule r2 is traffic lane SL2, the target logical service corresponding to service subset SB-v1 is logical service B, and the next target logical service of logical service B is logical service C. As Figure 3-1As shown, if there is no service subset of logical service C in traffic lane SL2, the service subset SC-v1 of logical service C can be determined in traffic lane SL1 (i.e., the reference traffic lane), and the service subset SC-v1 can be used as the traffic destination of service subset SB-v1. Moreover, the mapping relationship between the dynamic tagging rule of service subset SB-v1, the traffic diversion rule r2, and service subset SC-v1 can be established as a dynamic routing rule of service subset SB-v1.
[0107] After generating the dynamic routing rule based on the above implementation, the control plane component can also send the corresponding dynamic tagging rule and dynamic routing rule of each of the multiple service subsets to the mesh proxy components of the multiple service subsets, so that any mesh proxy component can tag the egress access requests of the application service instances it represents according to the received dynamic tagging rule and forward the tagged egress access requests according to the received dynamic routing rule.
[0108] Based on the above implementation, in this implementation, without modifying the static routing rule definition information (i.e., virtual service and destination rule), the dynamic tagging rule and dynamic routing rule can be obtained through various configuration data, so as to flexibly cover more traffic tags and corresponding routing rules. On the one hand, the modification frequency of the static routing rule definition information can be reduced, and the data volume of the static routing rule definition information can be reduced. On the other hand, the data plane component can add traffic tags to requests according to the dynamic tagging rule and route and forward requests based on the dynamic routing rule, reducing the dependence on the static routing rule definition information, thereby reducing the risk that requests cannot be forwarded due to undefined traffic tags or undefined routing rules, and realizing a more scalable and flexible routing ability, so as to cover more communication scenarios.
[0109] In some optional embodiments, the lane group definition information may further include: the identification information of the ingress logical service of the target lane group and the identification information of the ingress gateway component of the target lane group. Among them, the ingress gateway component is the ingress for external access to the target lane group. The identification information of the ingress gateway component is used to locate the application service instance corresponding to the ingress gateway component in the service mesh. The identification information of the ingress gateway component may include the name and namespace of the ingress gateway component. The ingress logical service of the target lane group refers to the logical service used to receive external traffic in the call chain composed of multiple logical services. Usually, this ingress logical service is the first logical service in the call chain. Among them, when the traffic diversion rule points to a certain lane, but a certain lane does not contain the service subset corresponding to the ingress logical service, the traffic can be diverted to the service subset corresponding to the ingress logical service in the reference lane.
[0110] A kind of lane group definition information can be as shown in Table 8 below:
[0111] Table 8
[0112]
[0113]
[0114] The control plane component can, according to the identification information of the ingress gateway component, send the identification information of the ingress logic service of the target lane group and the at least one traffic diversion rule to the ingress gateway component, so that when the ingress gateway component receives any access request, it can, according to the traffic matching condition satisfied by the received access request, divert the received access request to the service subset corresponding to the ingress logic service in the multiple service subsets. In the service subset corresponding to the ingress logic service, the mesh proxy component of the application service instance can route the traffic forwarded by the ingress gateway component according to the received dynamic routing rule.
[0115] Hereinafter, taking the first access request (ingress request) received by the target lane group as an example, an exemplary description will be given of the application processes of the traffic diversion rule, the dynamic tagging rule, and the dynamic routing rule. When receiving the first access request for the target lane group, the ingress gateway component corresponding to the first access request can be determined according to the identification information of the ingress gateway component of the target lane group, and the first access request can be sent to the ingress gateway component. The ingress gateway component can forward the first access request to the first mesh proxy component in the target service subset according to the traffic diversion rule obtained in the above embodiment. The first mesh proxy can add a traffic label to the request according to the obtained dynamic tagging rule, and route the access request to the first application service instance according to the traffic label and the dynamic routing rule.
[0116] In some embodiments, the first application service instance needs to call the next logical service in the call link provided by the target lane group to complete the task corresponding to the first access request. In such an embodiment, the first application service instance can send a second access request (i.e., egress access request) for the next logical service. The first mesh proxy can add a traffic label to the second egress access request according to the obtained dynamic tagging rule, and route the second access request to the mesh proxy component of the second application service instance corresponding to the next logical service according to the traffic label and the dynamic routing rule, so as to call the next logical service, which will not be elaborated here.
[0117] Optionally, if the access request does not meet any matching condition in the dynamic routing rule, corresponding operations can be performed on the access request based on a preset fallback policy. For example, the preset fallback policy can include: returning the response exception message corresponding to the access request. Another example is that the preset fallback policy can include: routing the access request to any application service instance.
[0118] Figure 3-2 A schematic flowchart of the routing rule generation method provided by an exemplary embodiment of the present application when executed in a service mesh. The following will be combined with Figure 3-2 to further exemplarily illustrate the embodiments of the present application.
[0119] As Figure 3-2 shown, in the control plane, the lane group controller 301 can obtain the metadata information of the application service instances in the service mesh and the lane group definition information provided by the user. According to the metadata information of the application service instances and the lane group definition information provided by the user, the lane group controller 301 can divide the application service instances in the service mesh into multiple logical services. The lane group controller 301 can also obtain the drainage rules of the lane group from the lane group definition information. The lane controller 302 can divide the multiple application service instances into multiple service subsets according to the multiple logical services and the lane configuration data. In addition, the lane controller 302 can also obtain the label configuration data provided by the user and generate multiple dynamic tagging rules according to the label configuration data. The routing rule set builder 303 in the control plane can generate dynamic routing rules according to the multiple service subsets, the drainage rules, and the multiple dynamic tagging rules. The service mesh controller 304 in the control plane can send the drainage rules to the ingress gateway component 305 in the data plane, and send the dynamic routing rules to the first mesh proxy component 306 and the second mesh proxy component 308 in the data plane.
[0120] Furthermore, in the data plane, when the ingress gateway component 305 receives an access request, it can forward the access request to the first mesh proxy component 306 in the target service subset according to the received drainage rules. The first mesh proxy component 306 can use the label routing rule processor 307 to add a traffic label to the request according to the obtained dynamic tagging rules, and route the access request to the first application service instance according to the traffic label and the dynamic routing rules. When the first application service instance needs to call the second application service instance, the first application service instance can initiate an egress request through the first mesh proxy component 306. The first mesh component 306 can use the label routing rule processor 307 to add a traffic label to the egress request according to the obtained dynamic tagging rules, and route the access request to the second mesh proxy 308 according to the traffic label and the dynamic routing rules, so as to realize the call of the second application service instance.
[0121] In addition to the routing rule generation method described in the foregoing embodiments, the embodiments of the present application also provide a traffic routing method.
[0122] Figure 4 A schematic flowchart of the traffic routing method provided by an exemplary embodiment of the present application. As Figure 4 shown, the method includes:
[0123] Step 401: Receive a first access request through a first mesh proxy component.
[0124] Step 402: Determine whether the first access request meets the rule activation conditions corresponding to the dynamic tagging rule; the dynamic tagging rule is issued by a control plane component.
[0125] Step 403: If it meets the conditions, generate a target traffic tag according to the tag generation method in the dynamic tagging rule.
[0126] Step 404: Add the target traffic tag to the first access request to obtain a second access request.
[0127] Step 405: Forward the second access request to a second mesh proxy component according to the target traffic tag and the dynamic routing rule; the dynamic tagging rule and the dynamic routing rule are obtained and issued by the control plane component according to the configuration data provided by the user.
[0128] Among them, the optional implementation manners for the control plane component to obtain the dynamic tagging rule and the dynamic routing rule can refer to the descriptions of the foregoing embodiments, and will not be described herein again.
[0129] After the first mesh proxy component receives the first access request, it can determine whether the first access request meets the rule activation conditions corresponding to the dynamic tagging rule. If it meets the conditions, a target traffic tag is generated according to the tag generation method in the dynamic tagging rule.
[0130] Optionally, the rule activation conditions may include: the activated callee range and / or the activated protocol range. The following will exemplarily illustrate the above judgment process using the first access request as an example. Among them, the first access request can be any egress access request sent by the application service instance proxied by the first mesh proxy component.
[0131] In some optional embodiments A1, when the first mesh proxy component determines whether the first access request meets the rule activation conditions corresponding to the dynamic tagging rule, it can determine whether the destination logic service corresponding to the first access request is within the activated callee range corresponding to the rule activation conditions. If the destination logic service corresponding to the first access request is within the activated callee range corresponding to the rule activation conditions, it can be determined that the first access request meets the rule activation conditions corresponding to the dynamic tagging rule.
[0132] In some other alternative embodiments A2, when the first grid proxy component determines whether the first access request meets the rule activation conditions corresponding to the dynamic tagging rule, it may determine whether the call protocol used by the first access request is within the scope of the activation protocols corresponding to the rule activation conditions. If the call protocol used by the first access request is within the scope of the activation protocols corresponding to the rule activation conditions, it may be determined that the first access request meets the rule activation conditions corresponding to the dynamic tagging rule.
[0133] In still some other alternative embodiments A3, when the first grid proxy component determines whether the first access request meets the rule activation conditions corresponding to the dynamic tagging rule, it may determine whether the destination logic service corresponding to the first access request is within the scope of the activated callee corresponding to the rule activation conditions, and determine whether the call protocol used by the first access request is within the scope of the activation protocols corresponding to the rule activation conditions. If the destination logic service corresponding to the first access request is within the scope of the activated callee corresponding to the rule activation conditions, and the call protocol used by the first access request is within the scope of the activation protocols corresponding to the rule activation conditions, it may be determined that the first access request meets the rule activation conditions corresponding to the dynamic tagging rule.
[0134] If the first access request meets the rule activation conditions corresponding to the dynamic tagging rule, the first grid proxy component may generate a target traffic tag according to the tag generation method in the dynamic tagging rule. The following will take some tag generation methods as examples for illustrative purposes.
[0135] In some alternative embodiments B1, the first grid proxy component may obtain the header value with a specified header name from the request header of the first access request as the tag value of the target traffic tag.
[0136] For example, when the first grid proxy component is implemented as an ingress gateway component, the ingress gateway component may obtain the header value with a specified header name from the obtained access request as the tag value corresponding to the target traffic tag. When the first grid proxy component is implemented as a grid proxy component, the grid proxy component may obtain the header value with a specified header name from the request entering the grid proxy component as the tag value corresponding to the target traffic tag. For another example, when the first grid proxy component is implemented as a grid proxy component, the grid proxy component may obtain the header value with a specified header name from the request sent from the application service instance it proxies to the grid proxy component as the tag value corresponding to the target traffic tag, and will not list them one by one.
[0137] In some alternative embodiments B2, the first grid proxy component may obtain the tag value corresponding to the specified tag name from the tags of the container group to which the container where the first grid proxy component is located belongs as the tag value of the target traffic tag.
[0138] In some optional embodiments B3, the first grid proxy component obtains a specified constant value as the label value of the target traffic label.
[0139] In some optional embodiments B4, the first grid proxy component can obtain the field value corresponding to the specified field from the request body of the first access request as the label value of the target traffic label.
[0140] In some optional embodiments B5, the first grid proxy component can obtain the parameter value corresponding to the specified query parameter from the query parameters of the first access request as the label value of the target traffic label.
[0141] It should be understood that, in addition to the above implementation manners, other label generation methods are also adopted to generate the label value of the target traffic label, which can be dynamically configured through label configuration data. In practice, multiple label generation methods can be obtained according to the label configuration data flexibly defined by users, and the label value can be obtained according to the obtained dynamic tagging rules, which will not be listed one by one.
[0142] After obtaining the target traffic label based on the above implementation manner, the first grid proxy component can add the target traffic label to the first access request to perform routing and forwarding on the first access request according to the target traffic label. Optionally, the dynamic traffic label can be added to the first access request by adding a header to the message of the first access request to obtain the second access request. Optionally, the first grid proxy component can add a new message header to the first access request. Among them, the message header field of the new message header is the label name of the target traffic label, and the message header value is the label value of the target traffic label.
[0143] After obtaining the second access request based on the above implementation manner, the second access request can be forwarded to the second grid proxy component according to the target traffic label and the dynamic routing rule.
[0144] In this implementation manner, the data plane component can add a traffic label to the request according to the dynamic tagging rule and perform routing and forwarding on the request based on the dynamic routing rule, reducing the dependence on the static routing rule definition information, thereby reducing the risk that the request cannot be forwarded due to the undefined traffic label or undefined routing rule, and realizing a more scalable and flexible routing ability, so as to cover more communication scenarios.
[0145] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can also be executed by different devices. For example, the execution subject of steps 201 to 204 can be device A; for another example, the execution subject of steps 201 and 202 can be device A, and the execution subject of step 203 can be device B; and so on.
[0146] In addition, in some of the processes described in the above embodiments and the accompanying drawings, there are multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order in which they appear herein or may be executed in parallel. The operation numbers such as 201, 202, etc. are only used to distinguish different operations, and the numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, nor do they limit that "first" and "second" are of different types.
[0147] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data that have been authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0148] Figure 5 Schematically shows the structural diagram of a server provided by an exemplary embodiment of the present application, as Figure 5 shown, the server includes: a memory 501, a processor 502, and a communication component 503.
[0149] The memory 501 is used to store computer programs and can be configured to store various other data to support operations on the server. Examples of these data include instructions for any application or method operating on the server.
[0150] In some optional embodiments, Figure 5The schematic server is used to execute a routing rule generation method. Among them, the processor 502, which is coupled to the memory 501, is used to execute the computer program in the memory 501 for: obtaining the label configuration data provided by the user, the lane group definition information of the target lane group, and the lane configuration data of each of the multiple traffic lanes in the target lane group through the control plane component in the service mesh; the lane group definition information includes: at least one drainage rule of the target lane group; any drainage rule is used to describe the mapping relationship between the traffic matching condition and the traffic lane; dividing the multiple application service instances in the multiple traffic lanes into multiple service subsets according to the lane group definition information and the lane configuration data of each of the multiple traffic lanes; generating the dynamic tagging rules of each of the multiple service subsets according to the label configuration data; any dynamic tagging rule of a service subset is used to describe the way of adding traffic labels to the egress access requests of the service subset; generating the dynamic routing rules based on traffic labels of each of the multiple service subsets according to the dynamic tagging rules of each of the multiple service subsets and the at least one drainage rule.
[0151] Optionally, the processor 502 is further used to: send the corresponding dynamic tagging rules and dynamic routing rules of each of the multiple service subsets to the mesh proxy components of the multiple service subsets respectively, so that any mesh proxy component tags the egress access requests of the application service instances it proxies according to the received dynamic tagging rules and forwards the tagged egress access requests according to the received dynamic routing rules.
[0152] Optionally, when the processor 502 divides the multiple application service instances in the multiple traffic lanes into multiple service subsets according to the lane group definition information and the lane configuration data of each of the multiple traffic lanes, it is specifically used to: determine the multiple logical services included in the target lane group according to the lane group definition information; obtain the logical services and characteristic labels to which each of the multiple application service instances in the multiple traffic lanes belongs from the lane configuration data of each of the multiple traffic lanes; divide the application service instances that belong to the same logical service and have the same characteristic label into the same service subset.
[0153] Optionally, when the processor 502 generates the dynamic tagging rules of each of the multiple service subsets according to the label configuration data, it is specifically used to: parse the tagging rule description information and the effective subject information in the label configuration data to obtain at least one dynamic tagging rule and its effective subject range; any dynamic tagging rule includes: rule effective conditions and label generation methods; allocate the at least one dynamic tagging rule to the multiple service subsets according to the effective subject range corresponding to each of the at least one dynamic tagging rule.
[0154] Optionally, when generating the dynamic routing rules based on traffic labels for each of the multiple service subsets according to the respective dynamic tagging rules of the multiple service subsets and the at least one traffic diversion rule, the processor 502 is specifically configured to: for any target service subset among the multiple service subsets, determine the target dynamic tagging rule corresponding to the target service subset; determine the traffic destination of the target service subset under the at least one traffic diversion rule according to the traffic lane to which the target service subset belongs and the call relationship of the multiple logical services; generate the dynamic routing rule based on traffic labels for the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule.
[0155] Optionally, when determining the traffic destination of the target service subset under the at least one traffic diversion rule according to the traffic lane to which the target service subset belongs and the call relationship of the multiple logical services, the processor 502 is specifically configured to: for any traffic diversion rule among the at least one traffic diversion rule, if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the first traffic lane, determine the service subset corresponding to the next target logical service in the first traffic lane as the next target service subset of the target service subset; if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the call link of the first traffic lane, determine the service subset corresponding to the next target logical service from the benchmark traffic lane as the next target service subset of the target service subset; the benchmark traffic lane includes application service instances of all logical services in the target lane group; if the traffic diversion destination of the traffic diversion rule is the second traffic lane that does not include the target service subset, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determine the service subset corresponding to the next target logical service in the second traffic lane as the next target service subset of the target service subset; if the traffic diversion destination of the traffic diversion rule is the second traffic lane that does not include the target service subset, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determine the service subset corresponding to the next target logical service from the benchmark traffic lane as the next target service subset of the target service subset.
[0156] Optionally, when generating the dynamic routing rule based on traffic labels for the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule, the processor 502 is specifically configured to: establish a mapping relationship among the target dynamic tagging rule, the traffic diversion rule, and the traffic destination of the target service subset under the traffic diversion rule, so as to obtain a dynamic routing rule for the target service subset under the traffic diversion rule.
[0157] Optionally, the processor 502 is further configured to: obtain the identification information of the ingress gateway component of the target lane group, the identification information of the ingress logic service of the target lane group, and at least one traffic diversion rule from the lane group definition information; according to the identification information of the ingress gateway component, send the identification information of the ingress logic service of the target lane group and the at least one traffic diversion rule to the ingress gateway component, so that when the ingress gateway component receives any access request, it diverts the received access request to the service subset corresponding to the ingress logic service in the multiple service subsets according to the traffic matching condition satisfied by the received access request.
[0158] In some other exemplary embodiments, Figure 5 The illustrated server is further configured to execute a traffic routing method, wherein the processor 502 is specifically configured to: receive a first access request through a first grid proxy component; determine whether the first access request meets the rule activation condition corresponding to the dynamic tagging rule; the dynamic tagging rule is sent by a control plane component; if it meets the condition, generate a target traffic label according to the label generation method in the dynamic tagging rule; add the target traffic label to the first access request to obtain a second access request; forward the second access request to a second grid proxy component according to the target traffic label and the dynamic routing rule; the dynamic tagging rule and the dynamic routing rule are generated by using the routing rule generation method provided in the embodiments of the present application.
[0159] Further, as Figure 5 shown, the server further includes: a power supply component 504 and other components. Figure 5 Only some components are schematically shown, which does not mean that the server only includes Figure 5 the components shown.
[0160] Among them, the memory 501 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disc.
[0161] Among them, the communication component 503 is configured to facilitate communication between the device where the communication component is located and other devices in a wired or wireless manner. The device where the communication component is located can access a wireless network based on a communication standard, such as Wi-Fi (wireless network communication technology), 2G (such as Global System for Mobile Communications (GSM), etc.), 3G (such as Wideband Code Division Multiple Access (WCDMA)), 4G (such as Long Term Evolution (LTE), etc.), 4G+ (such as LTE-Advanced (LTE-A), etc.) or 5G (5th Generation Mobile Communication Technology), or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies.
[0162] Among them, the power supply component 504 is used to provide power for various components of the device where the power supply component is located. The power supply component can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device where the power supply component is located.
[0163] In this embodiment, the control plane component can divide multiple application service instances in multiple traffic lanes into multiple service subsets through various configuration data provided by the user, and obtain at least one traffic diversion rule of the target lane group and the dynamic tagging rules of each of the multiple service subsets; according to the dynamic tagging rules of each of the multiple service subsets and the at least one traffic diversion rule, dynamic routing rules of each of the multiple service subsets can be generated. In this implementation manner, without the need to modify the static routing rule definition information (i.e., virtual services and target rules), dynamic tagging rules and dynamic routing rules can be obtained through various configuration data, so as to flexibly cover more traffic tags and corresponding routing rules. On the one hand, the modification frequency of the static routing rule definition information can be reduced, and the data volume of the static routing rule definition information can be reduced. On the other hand, the data plane component can add traffic tags to requests according to the dynamic tagging rules and perform routing and forwarding of requests based on the dynamic routing rules, reducing the dependence on the static routing rule definition information, thereby reducing the risk that requests cannot be forwarded due to undefined traffic tags or undefined routing rules, and realizing a more scalable and flexible routing capability, so as to cover more communication scenarios.
[0164] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed, each step that can be executed by the server in the above method embodiment can be implemented.
[0165] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM (Compact Disc Read-Only Memory), optical storage, etc.) containing computer-usable program code.
[0166] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocksFigure 1 means for the functions specified in one or more boxes.
[0167] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction means that implements the functions specified in one Figure 1 one or more processes and / or boxes Figure 1 means for the functions specified in one or more boxes.
[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus, such that a series of operational steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one Figure 1 one or more processes and / or boxes Figure 1 means for the functions specified in one or more boxes.
[0169] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), an input / output interface, a network interface, and memory.
[0170] The memory may include non-permanent memory in the computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0171] Computer-readable media includes both permanent and non-permanent, removable and non-removable media implemented by any method or technology for storing information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (Parallel Random Access Machine, PRAM), static random access memory (SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory
[0172] (EEPROM), flash memory, or other memory technologies, CD-ROM (Compact Disc Read-Only Memory), DVD (Digital Video Disc), or other optical storage, magnetic cassette tapes, disk storage, or other magnetic storage devices, or any other non-transitory medium, can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media do not include transitory media such as modulated data signals and carrier waves.
[0173] It should also be noted that the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0174] The above description is only for the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims
1. A method for generating a routing rule, characterized in that, It further includes: Obtaining, through a control plane component in a service mesh, label configuration data provided by a user, lane group definition information of a target lane group, and lane configuration data of each of a plurality of traffic lanes in the target lane group; The lane group definition information includes: at least one drainage rule of the target lane group; any drainage rule is used to describe a mapping relationship between a traffic matching condition and a traffic lane; Dividing a plurality of application service instances in the plurality of traffic lanes into a plurality of service subsets according to the lane group definition information and the lane configuration data of each of the plurality of traffic lanes; Generating a dynamic tagging rule for each of the plurality of service subsets according to the label configuration data; the dynamic tagging rule of any service subset is used to describe a manner of adding a traffic label to an egress access request for the service subset; Generating a dynamic routing rule based on traffic labels for each of the plurality of service subsets according to the dynamic tagging rules of each of the plurality of service subsets and the at least one drainage rule.
2. The method according to claim 1, wherein It further includes: Sending the dynamic tagging rule and the dynamic routing rule corresponding to each of the plurality of service subsets to the mesh proxy components of the plurality of service subsets respectively, so that any mesh proxy component tags an egress access request of an application service instance it proxies according to the received dynamic tagging rule and forwards the tagged egress access request according to the received dynamic routing rule.
3. The method according to claim 1, characterized in that Dividing a plurality of application service instances in the plurality of traffic lanes into a plurality of service subsets according to the lane group definition information and the lane configuration data of each of the plurality of traffic lanes includes: Determining a plurality of logical services included in the target lane group according to the lane group definition information; Obtaining, from the lane configuration data of each of the plurality of traffic lanes, the logical service and the feature label to which each of the plurality of application service instances in the plurality of traffic lanes belongs; Dividing application service instances that belong to the same logical service and have the same feature label into the same service subset.
4. The method according to claim 3, characterized in that, Generating a dynamic tagging rule for each of the plurality of service subsets according to the label configuration data includes: Parsing the tagging rule description information and the effective subject information in the label configuration data to obtain at least one dynamic tagging rule and its effective subject range; any dynamic tagging rule includes: a rule effective condition and a label generation method; Assigning the at least one dynamic tagging rule to the plurality of service subsets according to the effective subject range corresponding to each of the at least one dynamic tagging rule.
5. The method according to claim 3, characterized in that Generating a dynamic routing rule based on traffic labels for each of the plurality of service subsets according to the dynamic tagging rules of each of the plurality of service subsets and the at least one drainage rule includes: For any target service subset among the plurality of service subsets, determining a target dynamic tagging rule corresponding to the target service subset; Determining a traffic destination of the target service subset under the at least one drainage rule according to the traffic lane to which the target service subset belongs and the call relationship of the plurality of logical services; Generate a dynamic routing rule based on traffic labels for the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule.
6. The method according to claim 5, characterized in that, Determine the traffic destination of the target service subset under the at least one traffic diversion rule according to the traffic lane to which the target service subset belongs and the call relationship of the multiple logical services, including: For any one of the at least one traffic diversion rules, if the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the first traffic lane, determine the service subset corresponding to the next target logical service in the first traffic lane as the next target service subset of the target service subset; If the traffic diversion destination of the traffic diversion rule is the first traffic lane where the target service subset is located, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the call link of the first traffic lane, determine the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset; the reference traffic lane includes application service instances of all logical services in the target lane group; If the traffic diversion destination of the traffic diversion rule is a second traffic lane that does not include the target service subset, and there is a service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determine the service subset corresponding to the next target logical service in the second traffic lane as the next target service subset of the target service subset; If the traffic diversion destination of the traffic diversion rule is a second traffic lane that does not include the target service subset, and there is no service subset of the next target logical service corresponding to the target logical service of the target service subset in the second traffic lane, determine the service subset corresponding to the next target logical service from the reference traffic lane as the next target service subset of the target service subset.
7. The method according to claim 6, characterized in that, Generate a dynamic routing rule based on traffic labels for the target service subset according to the target dynamic tagging rule and the traffic destination of the target service subset under the at least one traffic diversion rule, including: Establish a mapping relationship among the target dynamic tagging rule, the traffic diversion rule, and the traffic destination of the target service subset under the traffic diversion rule to obtain a dynamic routing rule of the target service subset under the traffic diversion rule.
8. The method according to any one of claims 1 to 7, characterized in that, It further includes: Obtain the identification information of the entry gateway component of the target lane group, the identification information of the entry logical service of the target lane group, and at least one traffic diversion rule of the entry gateway component from the lane group definition information; According to the identification information of the ingress gateway component, the identification information of the ingress logic service of the target swimlane group and the at least one traffic diversion rule are sent to the ingress gateway component, so that when the ingress gateway component receives any access request, according to the traffic matching condition satisfied by the received access request, the received access request is diverted to the service subset corresponding to the ingress logic service in the multiple service subsets.
9. A traffic routing method, characterized in that, Comprising: Receiving a first access request through a first mesh proxy component; Judging whether the first access request meets the rule activation condition corresponding to the dynamic tagging rule; If it meets the condition, a target traffic tag is generated according to the tag generation method in the dynamic tagging rule; Adding the target traffic tag to the first access request to obtain a second access request; Forwarding the second access request to a second mesh proxy component according to the target traffic tag and the dynamic routing rule; the dynamic tagging rule and the dynamic routing rule are generated by the method described in any one of claims 1-8.
10. A server, characterized in that, Comprising: A memory and a processor; The memory is used for storing one or more computer instructions; The processor is used for executing the one or more computer instructions to: execute the steps in the method described in any one of claims 1-9.
11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it can implement the steps in the method described in any one of claims 1-9.