Gateway dynamic route setting method and system based on cloud native technology

Through the collaborative work between the gateway control plane and the data plane, routing configurations are dynamically loaded, which solves the problem that traditional proxy services cannot dynamically change configurations and manage unified management, improves the availability and operation and maintenance efficiency of online services, and reduces operation and maintenance costs. cost.

CN118573553APending Publication Date: 2024-08-30SHANGHAI BAOSIGHT SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310182917.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Traditional reverse proxy servers cannot dynamically change proxy configurations, resulting in long restart times or failures, affecting online services; they cannot uniformly manage proxy configurations, resulting in low operation and maintenance efficiency and high error rates.

Method used

Adopt a gateway dynamic routing setting method based on cloud native technology, store the changed configuration in the database through the gateway control plane, and synchronize it to the cache of the Proxy component through the Controller component to dynamically load the routing configuration and ensure the consistency and high availability of the configuration.

Benefits of technology

It solves the problem of online service jitter caused by restarting traditional proxy services, improves the efficiency of operation and maintenance management, ensures the availability and efficiency of online services, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118573553A
    Figure CN118573553A
Patent Text Reader

Abstract

The invention provides a gateway dynamic route setting method and system based on a cloud native technology. The method comprises the following steps: enabling a gateway control plane Admin component to store changed gateway configuration into a database; enabling a Controller component of the gateway data plane to monitor the change of the gateway configuration, synchronizing the changed gateway configuration to a Proxy component, and storing the gateway configuration in a cache of the gateway data plane by the Proxy component; enabling the Controller component to back up the changed gateway configuration after receiving a response that the Proxy component is successfully stored in the cache; and when the service request reaches the Proxy component, the Proxy component pulls the newest routing gateway configuration from the cache, and executes routing matching and service logic processing. According to the invention, the problem that the traditional proxy service cannot dynamically change the proxy gateway configuration and cannot be managed in a centralized manner is solved, and the normal access of the online environment is not influenced when the gateway proxy configuration is changed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of gateways, and in particular to a method and system for setting dynamic routing of gateways based on cloud native technology. Background Art

[0002] With the rapid development of Internet business, the number of visits to online services of enterprises, both internal and external, is rising rapidly. At the same time, with the gradual increase in business needs, operation and maintenance managers need to frequently change the configuration of proxy services to cope with complex and changing business scenarios. Traditional reverse proxy servers can no longer meet existing business requirements, and their disadvantages such as complex configuration and difficult operation and maintenance have gradually become apparent.

[0003] 1. Traditional reverse proxy servers cannot dynamically change proxy configurations.

[0004] When changing the configuration of the proxy server, you need to modify the configuration file of the proxy service offline. After completing the configuration change, restart the proxy service to load the new proxy configuration. However, if the configuration file of the proxy server is large or the configuration is wrong, the restart time may be too long or the restart may fail. In the event of a restart failure or during the restart interval, access to online services may be affected to a certain extent.

[0005] 2. Traditional reverse proxy servers cannot uniformly manage proxy configurations.

[0006] In order to ensure the high availability of enterprise online services, multiple reverse proxy servers are usually deployed in front of large enterprise projects to uniformly process client access requests. When the proxy configuration is changed, the operation and maintenance personnel need to manually modify the configuration files of all proxy servers one by one offline, and finally restart the proxy service to apply the latest configuration. This requires the operation and maintenance personnel to repeat the same change action many times, resulting in low operation and maintenance efficiency. At the same time, as the demand for proxy configuration increases, the configuration files of proxy services will gradually become more complex, and the error rate will gradually increase.

[0007] Patent document CN112804722A (application number: CN202011630642.1) discloses a method for implementing dynamic routing of a microservice gateway. The client sends a request to the microservice gateway, matches the request path, request header and request method information according to the routing configuration information, and forwards the request to the microservice application. The microservice gateway implements core routing forwarding according to dynamic routing rules. This invention does not solve the problem of restarting when modifying the configuration file, does not use Web graphical operations to simplify the management and maintenance process, does not implement concise, efficient, flexible, secure and unified dynamic routing management of microservice gateways, and the workload of system debugging and system operation and maintenance is large. This invention provides a method for implementing dynamic routing of a microservice gateway, but the routing strategy is too simple and cannot meet the routing matching scenarios in special scenarios, such as the need to rewrite the upstream service access address after passing through the gateway proxy, and the need for two identical microservices to use the same request context, but when accessing, it is necessary to distinguish the access based on the request header or request parameters.

[0008] Patent document CN202111455384 (application number: CN202111455384.2) discloses a method and system for dynamically routing backend addresses of API gateways, which belongs to the field of cloud computing technology. The query custom parameter value carried in the URL of the native API is assembled into the actual backend address using defined splicing rules to realize API dynamic routing; the implementation process of this method includes: the user creates and defines the backend address splicing rules, and caches the rules in the Redis database of the Kong gateway; creates an API, and chooses to enable the dynamic routing function when creating it; publishes the API and writes the relevant configuration to the Kong gateway, and then calls the API with the parameter value that matches the number of rule definitions. The Kong extension plug-in reads the parameter value and splices the backend address after verifying the parameter according to the rules in the Redis cache. The user only needs to create and call an API in the API gateway to call a backend interface with similar features but different addresses. This invention introduces the Redis component into the rule storage mechanism, but this will cause Redis to become one of the failure points. Once Redis is unavailable, the gateway function will be paralyzed. Moreover, using Redis to store the gateway routing configuration will also consume the TCP resources of the machine, which will have a certain impact on the processing capacity of the gateway's data plane. Summary of the invention

[0009] In view of the defects in the prior art, the purpose of the present invention is to provide a gateway dynamic routing setting method and system based on cloud native technology.

[0010] A method for setting a gateway dynamic routing based on cloud native technology provided by the present invention includes:

[0011] Step S1: Instruct the Admin component of the gateway control plane to store the changed gateway configuration in the database;

[0012] Step S2: The Controller component of the gateway data plane monitors the gateway configuration changes, synchronizes the changed gateway configuration to the Proxy component, and the Proxy component stores the gateway configuration in the cache of the gateway data plane;

[0013] Step S3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane performs a local backup of the changed gateway configuration;

[0014] Step S4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

[0015] Preferably, in step S1:

[0016] The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

[0017] Preferably, in step S2:

[0018] The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0019] Preferably, in step S4:

[0020] The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

[0021] Preferably, all running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane, L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function;

[0022] When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; if the rule set is still not hit in L3, return an empty hash table; if the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

[0023] A gateway dynamic routing setting system based on cloud native technology provided by the present invention includes:

[0024] Module M1: Instructs the Admin component of the gateway control plane to store the changed gateway configuration in the database;

[0025] Module M2: Instructs the Controller component of the gateway data plane to monitor changes in gateway configuration and synchronize the changed gateway configuration to the Proxy component. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0026] Module M3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane will back up the changed gateway configuration locally;

[0027] Module M4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

[0028] Preferably, in the module M1:

[0029] The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

[0030] Preferably, in the module M2:

[0031] The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0032] Preferably, in the module M4:

[0033] The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

[0034] Preferably, all running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane, L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function;

[0035] When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; if the rule set is still not hit in L3, return an empty hash table; if the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

[0036] Compared with the prior art, the present invention has the following beneficial effects:

[0037] 1. The design and implementation of a gateway dynamic routing based on cloud native technology provided by the present invention solves the problem that traditional proxy services cannot dynamically change proxy configuration and cannot be centrally managed, ensuring that normal access to the online environment will not be affected when changing the proxy configuration;

[0038] 2. The present invention provides a means of dynamically loading routing configuration in terms of loading mechanism, which solves the problem of online service jitter caused by the restart of the proxy service triggered by the configuration change of the traditional Web proxy component, thereby ensuring the availability of online services.

[0039] 3. In terms of management efficiency, the present invention provides a gateway control plane interface for unified management of gateway configuration resources. With the help of the gateway control plane interface, the gateway data plane can be centrally managed, thereby improving the operation and maintenance efficiency of operation and maintenance managers when changing gateway configurations. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0041] Figure 1 This is a schematic diagram of the processing sequence of the gateway control chain and data chain;

[0042] Figure 2 This is a schematic diagram of business logic processing. DETAILED DESCRIPTION

[0043] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0044] Embodiment 1;

[0045] The present invention provides a design and implementation of gateway dynamic routing based on cloud native technology to solve the problem that traditional proxy services cannot dynamically change proxy configurations and cannot be centrally managed, ensuring that normal access to the online environment will not be affected when the proxy configuration is changed. At the same time, the usability, efficiency and versatility of routing capabilities are guaranteed, helping enterprises to improve the availability of online services, improve operation and maintenance efficiency and reduce operation and maintenance costs.

[0046] The design and implementation of a gateway dynamic routing based on cloud native technology provided by the present invention solves the problems of poor loading mechanism and low management efficiency of current traditional Web proxy components.

[0047] 1. In terms of loading mechanism, the above solution provides a means of dynamically loading routing configurations, solving the problem of online service jitter caused by proxy service restart triggered by configuration changes in traditional Web proxy components, thereby ensuring the availability of online services.

[0048] 2. In terms of management efficiency, the above solution provides a gateway control plane interface for unified management of gateway configuration resources. With the help of the gateway control plane interface, the gateway data plane can be centrally managed, thereby improving the operation and maintenance efficiency of operation and maintenance managers when changing gateway configurations.

[0049] According to a method for setting dynamic routing of a gateway based on cloud native technology provided by the present invention, Figure 1-Figure 2 As shown, including:

[0050] Step S1: Instruct the Admin component of the gateway control plane to store the changed gateway configuration in the database;

[0051] Specifically, in step S1:

[0052] The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

[0053] Step S2: The Controller component of the gateway data plane monitors the gateway configuration changes, synchronizes the changed gateway configuration to the Proxy component, and the Proxy component stores the gateway configuration in the cache of the gateway data plane;

[0054] Specifically, in step S2:

[0055] The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0056] Step S3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane performs a local backup of the changed gateway configuration;

[0057] Step S4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

[0058] Specifically, in step S4:

[0059] The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

[0060] Specifically, all running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane, L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function;

[0061] When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; if the rule set is still not hit in L3, return an empty hash table; if the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

[0062] Embodiment 2:

[0063] Embodiment 2 is a preferred example of Embodiment 1, and is used to illustrate the present invention in more detail.

[0064] The present invention also provides a gateway dynamic routing setting system based on cloud native technology. The gateway dynamic routing setting system based on cloud native technology can be implemented by executing the process steps of the gateway dynamic routing setting method based on cloud native technology, that is, technical personnel in this field can understand the gateway dynamic routing setting method based on cloud native technology as a preferred implementation mode of the gateway dynamic routing setting system based on cloud native technology.

[0065] A gateway dynamic routing setting system based on cloud native technology provided by the present invention includes:

[0066] Module M1: Instructs the Admin component of the gateway control plane to store the changed gateway configuration in the database;

[0067] Specifically, in the module M1:

[0068] The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

[0069] Module M2: Instructs the Controller component of the gateway data plane to monitor changes in gateway configuration and synchronize the changed gateway configuration to the Proxy component. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0070] Specifically, in the module M2:

[0071] The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

[0072] Module M3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane will back up the changed gateway configuration locally;

[0073] Module M4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

[0074] Specifically, in the module M4:

[0075] The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

[0076] Specifically, all running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane, L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function;

[0077] When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; if the rule set is still not hit in L3, return an empty hash table; if the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

[0078] Embodiment 3:

[0079] Embodiment 3 is a preferred example of Embodiment 1, and is used to illustrate the present invention in more detail.

[0080] In response to the above existing needs, this patent provides a design and implementation of gateway dynamic routing based on cloud native technology. The operation process of this method includes: the processing sequence of the gateway control chain ( Figure 1 ), gateway data link processing sequence ( Figure 1 ) and the access timing of multi-level cache.

[0081] 1. Gateway control chain processing sequence

[0082] The role of the gateway control plane is to centrally manage the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane will start a database transaction and store the changed data in the database first. However, the transaction will not be submitted directly at this time. Instead, the changed gateway configuration will be dumped to ETCD through the APIServer of Kubernetes. After the configuration is successfully stored in ETCD in Kubernetes, the Admin component will submit the transaction to ensure the consistency of the configuration in the database and ETCD. The Controller component of the gateway data plane will also monitor the configuration changes and synchronize the changed configuration to the Proxy component through http requests. The Proxy component stores the configuration in the cache of the gateway data plane; finally, after the Controller component receives the response of the Proxy component successfully storing it in the cache, it also needs to update the changed configuration to the local file for backup to prevent the Kubernetes Apiserver component from abnormally pulling the configuration through the Controller component when the Proxy component restarts.

[0083] 2. Gateway data link processing timing

[0084] The role of the gateway data plane is to process daily access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component will pull the latest routing configuration from the cache, perform routing matching and subsequent other business logic processing based on the characteristics of the business request ( Figure 2 ).

[0085] 3. Access timing of multi-level cache

[0086] All running configurations in the gateway are stored in the three-level cache of the gateway data plane. L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function; when taking values ​​from the multi-level cache, the configuration will be obtained from L1 first. If it is not found, it will enter L2 for configuration search. If it is not found, the callback processing mechanism of L3 will be triggered. The callback function can query the database or call the API interface; if the rule set is still not hit in L3, an empty hash table will be returned; if the desired configuration is obtained in L3, L3 will synchronize the final data to L2 and L1 to speed up the efficiency of the next configuration query.

[0087] Embodiment 4:

[0088] Embodiment 4 is a preferred example of Embodiment 1, and is used to illustrate the present invention in more detail.

[0089] A design and implementation of gateway dynamic routing based on cloud native technology, which is based on k8sController+OpenResty and mainly includes the following steps:

[0090] 1. Implement k8s CRD Controller

[0091] Implement the k8s Controller for managing gateway-related resources. When the CRD resources of the gateway change, the changed data can be pushed to the proxy component in a timely manner to apply the changed data. At the same time, the APIServer component of k8s is relied on to provide a Restful API for unified external management of gateway resources, and the development work is completed based on the Kubebuilder scaffolding.

[0092] (1) Initialize the project using Kuberbuilder.

[0093] (2) Use Kuberbuilder to create gateway-related CRD resources.

[0094] (3) In the project's " / api / <version>"Under the directory, improve the declaration file corresponding to the CRD resource.

[0095] (4) Under the " / controllers" directory of the project, improve the control logic corresponding to the CRD resource.

[0096] (5) At the root directory of the project, execute "make install" to install the CRD, and then execute "make run" to run the Controller. You can debug the Controller in this way.

[0097] (6) After completing the debugging, execute "make docker-build <image address>" at the root directory of the project to package the image.

[0098] (7) Organize the CRD declaration files under " / config" in the project root directory, and define the kustomization declaration file to manage the image address.

[0099] (8) Deploy the Controller. After modifying the image address to the correct address in the kustomization declaration file, execute the "kustomize build.|kubectl apply -f -" command on the k8s Master node to install the CRD and Controller in the production environment.

[0100] 2. Implement the Proxy component

[0101] The proxy component is a program that actually processes the business traffic of the gateway data plane. The proxy component is developed based on OpenResty. The developed Admin API provides a means for the k8s Controller to change data. All configuration data of the gateway is stored in a multi-level cache. The Admin API realizes the dynamic loading of gateway-level routing by dynamically modifying the data in the cache.

[0102] (1) Define the code directory of the proxy component:

[0103] ① admin: Store various gateway resources and provide corresponding management interfaces.

[0104] ② dao: Store the data operation methods of various gateway resources at the multi-level cache level.

[0105] ③ core: Store the routing processing module and complete the routing matching module.

[0106] 1) In the routing processing module, custom request headers, custom request parameters, custom response headers and other configurations will be added, and the timeout period and one-click start and stop routing advanced functions will be implemented; at the same time, corresponding tracking actions will be completed according to specific business scenarios, and the corresponding routing matching logic will be completed with the help of the routing matching module.

[0107] 2) Complete a series of route matching modes such as exact matching, prefix matching, regular matching, request header restriction, request parameter restriction, request method restriction, etc. in the route matching module, provide a route matching entry for the route processing module, and complete the route matching action.

[0108] ④utils: Stores some tool libraries that the agent component needs to use to complete the agent work.

[0109] ⑤common: stores global constant declarations and global configuration declarations.

[0110] ⑥core.lua: stores the global processing flow of the gateway proxy component, and completes the definition of the request processing flow in combination with the processing cycle of OpenResty. At the same time, all modules in the gateway will be aggregated here.

[0111] (2) After the development environment is built, the program is published to the development environment. The code directory in the container is associated with the local directory through NFS. The local computer is remotely connected to the target host through IDEA and the code directory structure is combined to complete the required development work.

[0112] (3) Organize all declarative files on the gateway data plane and use kustomization to aggregate declarative files.

[0113] (4) Run "kustomize build.|kubectl apply -f-" to complete the deployment of the gateway data plane in the online environment.

[0114] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.

[0115] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.< / version>

Claims

1. A gateway dynamic routing setting method based on cloud native technology, characterized in that: include: Step S1: Instruct the Admin component of the gateway control plane to store the changed gateway configuration in the database; Step S2: The Controller component of the gateway data plane monitors the gateway configuration changes, synchronizes the changed gateway configuration to the Proxy component, and the Proxy component stores the gateway configuration in the cache of the gateway data plane; Step S3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane will back up the changed gateway configuration locally; Step S4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

2. According to the method for setting dynamic gateway routing based on cloud native technology in claim 1, it is characterized in that: In step S1: The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

3. According to the method for setting dynamic gateway routing based on cloud native technology in claim 1, it is characterized in that: In step S2: The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

4. According to the method for setting dynamic gateway routing based on cloud native technology according to claim 1, it is characterized in that: In step S4: The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

5. According to the method for setting dynamic gateway routing based on cloud native technology according to claim 1, it is characterized in that: All running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane. L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function. When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; If there is still no match for the rule set in L3, an empty hash table is returned; If the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

6. A gateway dynamic routing setting system based on cloud native technology, characterized in that: include: Module M1: Instructs the Admin component of the gateway control plane to store the changed gateway configuration in the database; Module M2: Instructs the Controller component of the gateway data plane to monitor changes in gateway configuration and synchronize the changed gateway configuration to the Proxy component. The Proxy component stores the gateway configuration in the cache of the gateway data plane. Module M3: After receiving the response from the Proxy component that the gateway configuration is successfully stored in the cache, the Controller component of the gateway data plane will back up the changed gateway configuration locally; Module M4: The business request reaches the Proxy component, which pulls the latest routing gateway configuration from the cache and performs routing matching and business logic processing.

7. The gateway dynamic routing setting system based on cloud native technology according to claim 6, characterized in that: In the module M1: The gateway control plane centrally manages the configuration in the gateway. When the gateway configuration is changed, the Admin component of the gateway control plane starts a database transaction to store the changed gateway configuration in the database, and dumps the changed gateway configuration to ETCD through the Kubernetes API Server. After the gateway configuration is successfully stored in ETCD in Kubernetes, the Admin component commits the transaction to ensure the consistency of the gateway configuration in the database and ETCD.

8. The gateway dynamic routing setting system based on cloud native technology according to claim 6, characterized in that: In the module M2: The Controller component of the gateway data plane monitors changes in gateway configuration and synchronizes the changed gateway configuration to the Proxy component through http requests. The Proxy component stores the gateway configuration in the cache of the gateway data plane.

9. The gateway dynamic routing setting system based on cloud native technology according to claim 6, characterized in that: In the module M4: The gateway data plane processes access requests based on the gateway configuration in the gateway data plane cache. When a business request reaches the Proxy component of the gateway data plane, the Proxy component pulls the latest routing gateway configuration from the cache and performs routing matching and subsequent business logic processing based on the characteristics of the business request.

10. The gateway dynamic routing setting system based on cloud native technology according to claim 6, characterized in that: All running gateway configurations in the gateway are stored in the three-level cache of the gateway data plane. L1 is the in-process cache, L2 is the inter-process cache, and L3 is the callback processing function. When retrieving values ​​from the multi-level cache, first obtain the gateway configuration from L1. If L1 does not find the gateway configuration, enter L2 to search for the gateway configuration. If L2 does not find the gateway configuration, trigger the callback processing mechanism of L3, and query the database or call the API interface in the callback function; If there is still no match for the rule set in L3, an empty hash table is returned; If the gateway configuration is obtained in L3, L3 will synchronize the obtained data to L2 and L1.

Citation Information

Patent Citations

  • Method for realizing dynamic routing of micro-service gateway

    CN112804722A

  • Method and system for dynamically routing back-end address by API (Application Program Interface) gateway

    CN114143261A