A gray release method and device, electronic equipment and storage medium
By configuring multiple groups in a distributed system and using JWT to determine the target tenant's canary release, the compatibility issues of canary release in multi-tenant scenarios are resolved, the burden of server state maintenance is reduced, and system performance is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies are not compatible with canary releases in multi-tenant scenarios, leading to difficulties in risk control and a heavy burden on server status maintenance, which affects the performance of distributed systems.
In a distributed system, multiple groups are configured, and the target tenant is determined and configured into the target group using JWT, thereby enabling the canary release of the target service. The current session-related state data is stored in the JWT, reducing server state maintenance.
It enables canary releases in multi-tenant scenarios, saving the burden of server status maintenance and improving the performance of distributed systems.
Smart Images

Figure CN116389560B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, more particularly, to a gray release method and device, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Full release of a new service is to release online to all users, which has certain risks. On the one hand, there are human bugs in the new service program, and on the other hand, due to different environmental factors, different devices load different environments, resulting in different running conditions of the same service program in different devices. Gray release is a common way to control risks. Gray release is to let part of the users use it first, verify it, gradually expand the proportion of users, and then release it in full. In the prior art, gray release is performed according to regions, devices, etc. However, for a multi-tenant scenario, the prior art solution cannot be compatible. SUMMARY
[0003] The purpose of the present application is to provide a gray release method and device, an electronic device and a computer readable storage medium, which realizes gray release in a multi-tenant scenario, saves the burden of server state maintenance, and improves the performance of a distributed system.
[0004] To achieve the above purpose, the present application provides a gray release method, comprising:
[0005] configuring a plurality of groups in a distributed system;
[0006] when a gray release command of a target service is received, determining a target group in the distributed system, and configuring the target service in the target group;
[0007] determining a target tenant, and configuring the target tenant to the target group based on a JWT mode, to realize gray release of the target service to the target tenant.
[0008] The method further comprises:
[0009] receiving a group switching command of a target tenant, and storing group information of the target tenant in a gateway cache; wherein the group information of the target tenant is the target group;
[0010] receiving an authentication request of the target tenant based on the JWT mode, and routing the authentication request to a corresponding group based on the group information of the target tenant in the gateway cache, to configure the target tenant to the target group.
[0011] The method further comprises:
[0012] receiving an authentication request of a target tenant; wherein the authentication request comprises group information of the target tenant;
[0013] authenticating the target tenant based on the authentication request.
[0014] wherein, after receiving the authentication request of the target tenant in the JWT manner, further comprising:
[0015] if the group information of the target tenant does not exist in the gateway cache, routing the authentication request to the corresponding group based on the group information in the authentication request, to configure the target tenant to the corresponding group.
[0016] wherein, after storing the group information of the target tenant into the gateway cache, further comprising:
[0017] setting a valid time length of the group information of the target tenant in the gateway cache, and deleting the group information of the target tenant in the gateway cache when the valid time length is exceeded.
[0018] wherein, the gateway cache is specifically a local cache of the gateway.
[0019] wherein, determining a target group in the distributed system and configuring the target service in the target group comprises:
[0020] determining a plurality of target groups in the distributed system;
[0021] receiving a configuration command of the target service; wherein the configuration command comprises a service name of the target service and a predefined macro variable;
[0022] replacing the macro variable in the configuration command with a namespace name of each of the target groups respectively, and configuring the target service in each of the target groups based on each of the replaced configuration commands.
[0023] To achieve the above purpose, the present application provides a gray release device, comprising:
[0024] a configuration module configured to configure a plurality of groups in a distributed system;
[0025] a determination module configured to determine a target group in the distributed system and configure a target service in the target group when a gray release command of the target service is received;
[0026] a release module configured to determine a target tenant, configure the target tenant to the target group in a JWT manner, and realize gray release of the target service to the target tenant.
[0027] To achieve the above object, the present application provides an electronic device, comprising:
[0028] a memory for storing a computer program;
[0029] a processor for executing the computer program to realize the steps of the above gray release method.
[0030] To achieve the above object, the present application provides a computer readable storage medium, the computer readable storage medium has a computer program stored thereon, the computer program is executed by a processor to realize the steps of the above gray release method.
[0031] To achieve the above object, the present application provides a computer program product, the computer program product comprises a computer program, the computer program is executed by a processor to realize the steps of the above gray release method.
[0032] Through the above scheme, the gray release method provided by the present application comprises: configuring a plurality of groups in a distributed system; when a gray release command of a target service is received, determining a target group in the distributed system, and configuring the target service in the target group; determining a target tenant, and configuring the target tenant to the target group based on a JWT mode, to realize the gray release of the target service to the target tenant.
[0033] The gray release method provided by the present application configures a plurality of groups in a distributed system, when it is needed to gray release a target service according to a tenant, determines a target group for gray releasing the target service, selects a gray release object of the target service, that is, a target tenant, and configures the target tenant to the target group based on a JWT mode, to realize the gray release of the target service to the target tenant. The state data related to the current session is saved in the JWT, and the JWT is saved in the client, so the server does not need to save the state data, thereby saving the burden of server state maintenance. It can be seen that the gray release method provided by the present application realizes the gray release in a multi-tenant scenario, saves the burden of server state maintenance, and improves the performance of the distributed system. The present application also discloses a gray release device, an electronic device and a computer readable storage medium, which can also realize the above technical effects.
[0034] It should be understood that the above general description and the following detailed description are only exemplary and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings described below only represent some of the embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings also belong to the protection scope of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence.
[0036] Figure 1 A flowchart of a gray release method according to an exemplary embodiment is shown.
[0037] Figure 2 A grouping configuration schematic diagram of k8s according to an exemplary embodiment is shown.
[0038] Figure 3 A schematic diagram of configuring services in groups according to an exemplary embodiment is shown.
[0039] Figure 4 A flowchart of user authentication and authentication according to an exemplary embodiment is shown.
[0040] Figure 5 A structure schematic diagram of a k8s cluster according to an exemplary embodiment is shown.
[0041] Figure 6 A structure diagram of a gray release device according to an exemplary embodiment is shown.
[0042] Figure 7 A structure diagram of an electronic device according to an exemplary embodiment is shown. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the protection scope of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence.
[0044] The embodiments of the present application disclose a gray release method, which realizes gray release in a multi-tenant scenario.
[0045] Referring to Figure 1, a flow chart of a gray release method according to an exemplary embodiment, as shown in Figure 1 , comprises:
[0046] S101: configuring a plurality of groups in a distributed system;
[0047] In the embodiment, the distributed system can be k8s (Kubernetes), and a plurality of groups are configured in the distributed system, each group corresponding to a namespace in the distributed system. Each group contains a plurality of PODs, and a Pod is a concept proposed by Kubernetes for deploying, managing, and orchestrating containerized applications, and is also the smallest deployment unit in Kubernetes, which means "pod" in literal translation. In the embodiment, a POD is an independent environment for running a microservice, and each group can deploy a plurality of microservices, one microservice corresponding to one POD. Different microservices in the group access each other through a service name (service-name). The distributed system further includes a gateway (named api100 for ease of description), which is an independent group and can access microservices in other groups through a namespace name (namespace-name) and a service name, {service-name}.{namespace-name}.svc. For example, as shown in Figure 2 , the k8s includes api100, G1, G2, G3, …, Gx groups, and G8 contains financial cloud microservices, inventory cloud microservices, retail cloud microservices, order cloud microservices, wholesale cloud microservices, etc. A new feature group for verifying new functions and a bugfix group for verifying whether the bug repair environment is normal can be specified in a plurality of groups.
[0048] S102: When a gray release command of a target service is received, determining a target group in the distributed system, and configuring the target service in the target group;
[0049] In this step, when the target service needs to be gray released, the target group for gray releasing the target service is determined in the distributed system, and the target service is configured in the target group. In a specific implementation, the target service can be configured by using a shunt plug-in, a macro variable (GRP) is defined for the shunt plug-in, a configuration command is generated based on the macro variable, and the shunt plug-in replaces the namespace name of the target group in the configuration command when configuring the target service, so as to configure the target service in the target group. For example, as shown in Figure 3 , the load balancing algorithm uses a weighted round robin (Round Robin), the upstream type is a node, and the hostname of the target node is configured as: webapp.GRP.svc, and the port is 8090. Webapp is the service name of the target service.
[0050] As a feasible implementation, determining a target group in the distributed system and configuring the target service in the target group comprises: determining a plurality of target groups in the distributed system; receiving a configuration command of the target service; wherein the configuration command comprises a service name of the target service and a predefined macro variable; replacing the macro variable in the configuration command with a namespace name of each target group respectively, and configuring the target service in each target group based on each replaced configuration command.
[0051] In a specific implementation, a plurality of target groups can be selected for gray release of the target service, regardless of the number of target groups, and the target service only needs to be configured once, that is, only one configuration command needs to be generated, and the macro variable in the configuration command is replaced with the namespace name of each target group by the shunting plug-in to realize configuration of the target service in the plurality of target groups, which simplifies the operation and maintenance configuration steps and takes into account flexible expansion. It can be seen that the number of routes in the related art is reduced by N (the number of groups), which improves the performance of the route.
[0052] S103: determining a target tenant, and configuring the target tenant to the target group based on a JWT mode to realize gray release of the target service to the target tenant.
[0053] In this step, the gray release object of the target service, that is, the target tenant, is determined, the user can select the target tenant in the visual configuration interface, and then the target tenant is configured to the target group based on the JWT (JSON Web Token) mode, realizing the gray release of the target service to the target tenant.
[0054] The JWT is a token carrying information in a network application, and the user authentication process comprises the following steps: receiving an authentication request of a target tenant; wherein the authentication request comprises group information of the target tenant; authenticating the target tenant based on the authentication request. For example, Figure 4As shown, the client (Client) sends an authentication request (①) to the gateway (api100), which contains the grouping information of the tenant, the gateway (api100) performs identity authentication based on the authentication request to the identity authentication server (AuthServer) (②), the identity authentication server (AuthServer) returns the authentication result to the gateway (api100) (③), and the gateway (api100) returns the authentication result to the client (Client) (④). If the authentication is successful, the target tenant is added to the distributed system, and the gateway saves the grouping information of the target tenant. If the authentication fails, the failure reason can be returned to the client in the authentication result. The state data related to the current session is saved in the JWT, and the JWT is saved in the client. The identity authentication server (AuthServer) does not need to save the state data, thereby saving the burden of server state maintenance.
[0055] Further, for user authentication, the traditional way is that the client (Client) sends an authentication request (①) to the gateway (api100), the gateway (api100) requests identity authorization based on the authentication request to the identity authorization server (Authorization) (②), the identity authorization server (Authorization) returns the authorization result to the gateway (api100) (③), the gateway (api100) performs identity authorization of the user to the Upstream (④), and returns the authorization result to the client (Client) (④). As can be seen, since the traditional way saves the state data related to the current session in the identity authorization server (Authorization), the gateway (api100) needs to request identity authorization from the identity authorization server (Authorization). The embodiment uses the JWT method for authentication. Since the state data related to the current session is saved in the JWT, and the JWT is saved in the client, the gateway (api100) does not need to request identity authorization from the identity authorization server (Authorization), thereby optimizing ② and ③, saving network IO, and improving performance.
[0056] It should be noted that within the validity period of the JWT session, the user can change the grouping of the tenant in the visual configuration interface. That is, as a possible implementation manner, the method based on the JWT configures the target tenant to the target group, comprising: receiving a grouping switching command of the target tenant, and storing the grouping information of the target tenant in the gateway cache; wherein the grouping information of the target tenant is the target group; receiving an authentication request of the target tenant based on the JWT method, and routing the authentication request to the corresponding group based on the grouping information of the target tenant in the gateway cache, so as to configure the target tenant to the target group.
[0057] Referring toFigure 5 The k8s cluster contains multiple groups: api100, G1, G2, …, and the corresponding namespace names are: namespace-api100, namespace-G1, namespace-G2, … Each group contains service-A, api100 contains multiple plugins, and api100 and service-A each contain multiple replicas. User traffic arrives at api100, api100 configures an etcd (a distributed key-value pair storage) cluster, and api100 accesses service-A in other groups through {service-name}.{namespace-name}.svc. The visual configuration interface publishes a gray release rule to the k8s cluster.
[0058] In a specific implementation, when a user changes the group information of a target tenant to a target group in the visual configuration interface, the change is written to the gateway cache. Preferably, the gateway cache is specifically a local cache of the gateway, that is, nginx.worker local cache is used instead of nginx shared cache, avoiding lock overhead and improving performance. The visual configuration interface accesses the nginx.worker local cache through the etcd cluster, and watches incremental loading in runtime, realizing real-time sensing of configuration changes. In addition, it should be noted that the JWT session has a validity period, that is, after storing the group information of the target tenant in the gateway cache, the method further includes: setting the validity period of the group information of the target tenant in the gateway cache, and deleting the group information of the target tenant in the gateway cache when the validity period is exceeded. In a specific implementation, after storing the group information of the target tenant in the gateway cache, the validity period of the group information is set, which is the validity period of the JWT session, for example, 2 hours, and the group information of the target tenant in the gateway cache is deleted when the validity period is exceeded, timely returning the memory, avoiding memory occupation, and avoiding retrieval consumption. Further, the target tenant is authenticated using the JWT method, and when an authentication request arrives at the gateway, the gateway reads the group information of the target tenant in the local cache, routes the authentication request to the corresponding group according to the group information, and configures the target tenant to the target group.
[0059] As a preferred implementation, after receiving the authentication request of the target tenant based on the JWT mode, the method further includes: determining whether the grouping information of the target tenant exists in the gateway cache; if yes, performing the step of routing the authentication request to the corresponding group based on the grouping information of the target tenant in the gateway cache; if no, routing the authentication request to the corresponding group based on the grouping information in the authentication request, so as to configure the target tenant to the corresponding group.
[0060] In a specific implementation, when the authentication request arrives at the gateway, the gateway reads the grouping information in the JWT, and determines whether the grouping information of the target tenant exists in the gateway cache; if yes, the grouping information of the target tenant in the gateway cache is taken; if no, the grouping information in the JWT, that is, the grouping information in the authentication request, is taken.
[0061] It can be seen that the grouping of the target tenant is switched through the visual configuration interface, and the configuration takes effect immediately after completion, which improves the configuration efficiency compared with the technical solution in the related art in which the configuration takes effect after restart after operation and maintenance modification.
[0062] The gray release method provided in the embodiment of the application configures multiple groups in a distributed system, determines a target group for gray release of a target service when it is necessary to perform gray release of the target service according to tenants, selects a gray release object of the target service, that is, a target tenant, configures the target tenant to the target group based on a JWT mode, and realizes gray release of the target service to the target tenant. The state data related to the current session is saved in the JWT, and the JWT is saved in the client, so that the server does not need to save the state data, thereby saving the burden of server state maintenance. It can be seen that the gray release method provided in the embodiment of the application realizes gray release in a multi-tenant scenario, saves the burden of server state maintenance, and improves the performance of the distributed system.
[0063] A gray release device provided in an embodiment of the application is introduced below, and the gray release device described below can be referred to in conjunction with the gray release method described above.
[0064] Referring to Figure 6 , a structural diagram of a gray release device according to an example embodiment is shown, as Figure 6 shown, the gray release device includes:
[0065] The configuration module 601 is configured to configure multiple groups in a distributed system.
[0066] The determination module 602 is configured to, when a gray release command of a target service is received, determine a target group in the distributed system, and configure the target service in the target group.
[0067] The publishing module 603 is configured to determine a target tenant, configure the target tenant to the target group based on a JWT manner, and implement the gray release of the target service to the target tenant.
[0068] The gray release device provided by the embodiment of the application can configure multiple groups through a distributed system. When it is necessary to perform gray release of a target service according to tenants, a target group used for gray release of the target service is determined, a gray release object of the target service, that is, a target tenant, is selected, the target tenant is configured to the target group based on a JWT manner, and the gray release of the target service to the target tenant is implemented. Current session-related state data is saved in a JWT, and the JWT is saved in a client. The server does not need to save state data, thereby saving the burden of server state maintenance. It can be seen that the gray release device provided by the embodiment of the application implements gray release in a multi-tenant scenario, saves the burden of server state maintenance, and improves the performance of the distributed system.
[0069] In the above embodiment, as a preferred implementation manner, the publishing module 603 includes:
[0070] The storage unit is configured to receive a group switching command of a target tenant, and store group information of the target tenant in a gateway cache. The group information of the target tenant is the target group.
[0071] The distribution unit is configured to receive an authentication request of a target tenant based on a JWT manner, route the authentication request to a corresponding group based on the group information of the target tenant in the gateway cache, and configure the target tenant to the target group.
[0072] In the above embodiment, as a preferred implementation manner, the gray release device further includes:
[0073] The authentication module is configured to receive an authentication request of a target tenant. The authentication request includes group information of the target tenant. The target tenant is authenticated based on the authentication request.
[0074] In the above embodiment, as a preferred implementation manner, the distribution unit is specifically configured to receive an authentication request of a target tenant based on a JWT manner, determine whether the group information of the target tenant exists in the gateway cache, if yes, route the authentication request to a corresponding group based on the group information of the target tenant in the gateway cache, and configure the target tenant to the target group, and if no, route the authentication request to a corresponding group based on the group information in the authentication request, and configure the target tenant to the corresponding group.
[0075] On the basis of the above-mentioned embodiments, as a preferred implementation, the storage unit is specifically configured to: receive a group switching command of a target tenant, store group information of the target tenant into a gateway cache, set a valid time length of the group information of the target tenant in the gateway cache, and delete the group information of the target tenant in the gateway cache when the valid time length is exceeded.
[0076] On the basis of the above-mentioned embodiments, as a preferred implementation, the gateway cache is specifically a local cache of the gateway.
[0077] On the basis of the above-mentioned embodiments, as a preferred implementation, the determination module 602 is specifically configured to: determine a plurality of target groups in the distributed system; receive a configuration command of the target service; wherein the configuration command includes a service name of the target service and a predefined macro variable; replace the macro variable in the configuration command with a namespace name of each target group respectively, and configure the target service in each target group based on each replaced configuration command.
[0078] As to the apparatus in the above-mentioned embodiments, the specific manner in which various modules perform operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
[0079] Based on the hardware implementation of the above-mentioned program modules, and in order to implement the method of the embodiments of the present application, the embodiments of the present application also provide an electronic device, Figure 7 To show the structure of an electronic device according to an exemplary embodiment, as shown in Figure 7 The electronic device includes:
[0080] The communication interface 1 can interact with other devices such as network devices and the like.
[0081] The processor 2 is connected with the communication interface 1 to realize information interaction with other devices, and is used to run a computer program to execute the gray release method provided by one or more technical solutions described above. The computer program is stored on the memory 3.
[0082] Of course, in actual application, various components in the electronic device are coupled together through a bus system 4. It can be understood that the bus system 4 is used to realize the connection and communication between the components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 4 in Figure 7 .
[0083] The memory 3 in the embodiments of the present application is used to store various types of data to support the operation of the electronic device. Examples of these data include: any computer programs for operating on the electronic device.
[0084] It can be understood that the memory 3 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM). The magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM can be used, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), sync link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 3 described in the embodiments of the present application is intended to include, but not limited to, these and any other suitable types of memory.
[0085] The method disclosed in the embodiments of the present application can be applied in the processor 2 or implemented by the processor 2. The processor 2 can be an integrated circuit chip with processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 2 or the instruction in the form of software. The processor 2 described above can be a general processor, a DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The processor 2 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiments of the present application, the execution can be directly completed by the hardware decoding processor or by the combination of hardware and software modules in the decoding processor. The software module can be located in the storage medium, which is located in the memory 3. The processor 2 reads the program in the memory 3 and combines the hardware to complete the steps of the above method.
[0086] The processor 2 implements the corresponding flow in each method of the embodiments of the present application when executing the program. For brevity, it will not be repeated here.
[0087] In the exemplary embodiments, the embodiments of the present application also provide a storage medium, i.e. a computer storage medium, specifically a computer readable storage medium, such as a memory 3 storing a computer program, which can be executed by the processor 2 to complete the steps of the above method. The computer readable storage medium can be FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, CD-ROM, etc.
[0088] In the exemplary embodiments, the embodiments of the present application also provide a computer program product, which includes a computer program executed by the processor to implement the steps in the above method embodiments.
[0089] Those skilled in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the above program can be stored in a computer readable storage medium. When the program is executed, the steps of the above method embodiments are executed; and the above storage medium includes mobile storage device, ROM, RAM, magnetic disc or optical disc, etc. various storage medium which can store program code.
[0090] Alternatively, the above-mentioned integrated units of the present application, if realized in the form of software function modules and sold or used as independent products, can also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions to make an electronic device (which can be a personal computer, a server, a network device, etc.) execute all or part of the methods described in the embodiments of the present application. The aforementioned storage medium includes: mobile storage devices, ROM, RAM, magnetic disks or optical disks, and various media that can store program codes.
[0091] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A grayscale release method, characterized in that, include: Configure multiple groups in a distributed system; When a canary release command for a target service is received, a target group is determined in the distributed system, and the target service is configured in the target group. The target tenant is identified as the canary release object of the target service. The target tenant is configured to the target group based on the JWT method to realize the canary release of the target service to the target tenant. The process of determining a target group in the distributed system and configuring the target service within that target group includes: In the distributed system, multiple target groups are identified; Receive the configuration command for the target service; wherein the configuration command includes the service name of the target service and predefined macro variables; The macro variables in the configuration command are replaced with the namespace name of each target group using the traffic splitting plugin, and the target service is configured in each target group based on each replaced configuration command. The step of configuring the target tenant to the target group based on the JWT method includes: Receive a packet switching command from a target tenant and store the target tenant's packet information in the gateway cache; wherein, the target tenant's packet information is the target packet; The authentication request of the target tenant is received based on the JWT method, and the authentication request is routed to the corresponding group based on the group information of the target tenant in the gateway cache, so as to configure the target tenant to the target group.
2. The grayscale publishing method according to claim 1, characterized in that, Before receiving the packet switching command from the target tenant, the method further includes: Receive an authentication request from a target tenant; wherein the authentication request includes the target tenant's grouping information; The target tenant is authenticated based on the authentication request.
3. The grayscale publishing method according to claim 1, characterized in that, After receiving the authentication request from the target tenant using the JWT method, the process also includes: If the target tenant's group information is not present in the gateway cache, the authentication request is routed to the corresponding group based on the group information in the authentication request, so as to configure the target tenant to the corresponding group.
4. The grayscale publishing method according to claim 1, characterized in that, After storing the target tenant's grouping information in the gateway cache, the method further includes: Set the validity period for the target tenant's group information in the gateway cache. When the validity period is exceeded, delete the target tenant's group information in the gateway cache.
5. The grayscale publishing method according to claim 1, characterized in that, The gateway cache is specifically the gateway's local cache.
6. A grayscale publishing device, characterized in that, include: The configuration module is used to configure multiple groups in a distributed system; The determination module is used to determine the target group in the distributed system when a canary release command for the target service is received, and to configure the target service in the target group; The publishing module is used to determine the target tenant as the canary publishing object of the target service, and configure the target tenant to the target group based on the JWT method to realize the canary publishing of the target service to the target tenant; Specifically, the determining module is used to: determine multiple target groups in the distributed system; receive configuration commands for the target services; wherein the configuration commands include the service name of the target service and predefined macro variables; use a traffic splitting plugin to replace the macro variables in the configuration commands with the namespace names of each target group, and configure the target service in each target group based on each replaced configuration command; Specifically, the publishing module is used to: receive a group switching command from a target tenant, and store the group information of the target tenant in the gateway cache; wherein the group information of the target tenant is the target group; receive an authentication request from the target tenant based on the JWT method, and route the authentication request to the corresponding group based on the group information of the target tenant in the gateway cache, so as to configure the target tenant to the target group.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the grayscale release method as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the grayscale release method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Multi-layer calling gray release method and device based on user-defined routing
CN112995310A
Multi-tenant application integrated framework system based on micro-service architecture
CN114928460A
Service grid hosting method and system based on cloud native platform
CN115827223A