Full-link gray release method and device, micro service, gateway and medium
By automatically acquiring the canary identification information of downstream microservice nodes, the entire chain of canary releases is realized, which solves the high cost and error problems caused by human intervention in existing technologies and ensures the stability and efficiency of canary releases.
Patent Information
- Application Number
- CN202111661910.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing canary release methods require human intervention, resulting in high costs and a high risk of errors.
When a gray-scale request is received, the gray-scale identifier information of the downstream microservice node is automatically obtained to determine whether a gray-scale node exists, and the request is forwarded to the target microservice to achieve full-link gray-scale release.
This reduces the cost of canary releases and decreases the error rate, ensuring that each request path passes through a canary node.
Smart Images

Figure CN114428927B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computers, and particularly relates to a full-link gray release method and device, a microservice, a gateway and a medium. BACKGROUND
[0002] The so-called gray release is to release a new version of a microservice on only part of nodes in a microservice cluster when the microservice is put online, so as to verify the correctness of the function and whether other characteristics meet the expectation by introducing a small amount of traffic into the new version. Once a problem occurs, all requests will not be affected, which is a test method for improving the stability of the microservice, and is also called gray verification.
[0003] At present, the method of gray release is to manually participate in the release of a new version of a microservice each time, such as group setting and version number modification. This gray release method requiring manual participation has high cost and is prone to errors. SUMMARY
[0004] The embodiments of the present application provide a full-link gray release method, device, microservice, gateway and medium, which can solve the problems of high cost and errors in gray release.
[0005] In a first aspect, the embodiments of the present application provide a full-link gray release method, comprising:
[0006] When a gray request is received, gray identification information of all downstream microservice nodes corresponding to the gray request is acquired; the gray identification information of the downstream microservice nodes is used to identify whether the downstream service node is a gray node;
[0007] According to the acquired gray identification information, it is determined whether there is a gray node in all downstream microservice nodes;
[0008] If there is a gray node in all downstream microservice nodes, any downstream microservice in the downstream microservice corresponding to all gray nodes is taken as a target microservice;
[0009] The gray request is forwarded to the target microservice.
[0010] Before the step of acquiring the gray identification information of all downstream microservice nodes corresponding to the gray request when the gray request is received, the method further comprises:
[0011] When a microservice is started, it is determined whether the microservice node is a gray node;
[0012] According to the determination result, obtain the gray identification information of the node where the microservice is located; the gray identification information is used to identify whether the node where the microservice is located is a gray node;
[0013] Register the obtained gray identification information to the registration center of the microservice cluster.
[0014] The method further comprises:
[0015] Read the environment variable of the node where the microservice is located; the environment variable is generated when the microservice cluster creates the node where the microservice is located, and the environment variable contains a field used to describe whether the node where the microservice is located is a gray node;
[0016] If the field indicates that the node where the microservice is located is a gray node, it is determined that the node where the microservice is located is a gray node.
[0017] If the field indicates that the node where the microservice is located is a non-gray node, it is determined that the node where the microservice is located is a non-gray node.
[0018] The method further comprises:
[0019] Obtain the gray identification information of the node where the microservice is located from the registration center of the microservice cluster.
[0020] The microservice cluster is a cloud-native distributed cluster, and the registration center of the cloud-native distributed cluster is an nacos registration center.
[0021] The method further comprises:
[0022] If there is no gray node in the nodes where all the downstream microservices are located, the gray request is forwarded to any downstream microservice.
[0023] In a second aspect, an embodiment of the present application provides a full-link gray release device, comprising:
[0024] An obtaining module is configured to, when a gray request is received, obtain gray identification information of nodes where all downstream microservices corresponding to the gray request are located; the gray identification information of the node where the downstream microservice is located is used to identify whether the node where the downstream service is located is a gray node.
[0025] A judging module is configured to, according to the obtained gray identification information, judge whether there is a gray node in the nodes where all the downstream microservices are located.
[0026] The execution module is configured to, if there is a gray node in the nodes where all the downstream microservices are located, take any one of the downstream microservices corresponding to all the gray nodes as a target microservice.
[0027] The sending module is configured to forward the gray request to the target microservice.
[0028] The full-link gray release device further includes:
[0029] The determination module is configured to determine whether the node where the microservice is located is a gray node when the microservice is started.
[0030] The obtaining module is configured to obtain gray identification information of the node where the microservice is located according to the determination result, where the gray identification information is used to identify whether the node where the microservice is located is a gray node.
[0031] The registration module is configured to register the obtained gray identification information to a registration center of the microservice cluster.
[0032] The determination module includes:
[0033] The reading unit is configured to read an environment variable of the node where the microservice is located, where the environment variable is generated when the node where the microservice is located is created by the microservice cluster, and the environment variable contains a field used to describe whether the node where the microservice is located is a gray node.
[0034] The first execution unit is configured to determine that the node where the microservice is located is a gray node if the field indicates that the node where the microservice is located is a gray node.
[0035] The second execution unit is configured to determine that the node where the microservice is located is a non-gray node if the field indicates that the node where the microservice is located is a non-gray node.
[0036] The obtaining module is specifically configured to obtain, from a registration center of the microservice cluster, gray identification information of the nodes where all the downstream microservices corresponding to the gray request are located.
[0037] The microservice cluster is a cloud-native distributed cluster, and the registration center of the cloud-native distributed cluster is an nacos registration center.
[0038] The full-link gray release device further includes:
[0039] The forwarding module is configured to forward the gray request to any one of the downstream microservices if there is no gray node in the nodes where all the downstream microservices are located.
[0040] In a third aspect, an embodiment of the present application provides a microservice, comprising the full-link gray release device.
[0041] In a fourth aspect, an embodiment of the present application provides a microservice gateway, comprising the full-link gray release device.
[0042] In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method described above.
[0043] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the method described in any one of the first aspect.
[0044] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0045] In the embodiment of the present application, the microservice gateway and the microservice of the microservice cluster can, when receiving a gray request, acquire the gray identifier information of all downstream microservice nodes corresponding to the gray request, and determine whether there is a gray node in all downstream microservice nodes according to the gray identifier information. If there is a gray node, any downstream microservice corresponding to all gray nodes is taken as a target microservice, and the gray request is forwarded to the target microservice, so as to ensure that all nodes passed by each gray request link are gray nodes, and gray release is realized. Since the microservice gateway and the microservice can complete gray release by automatically acquiring the gray identifier information of the downstream microservice node during gray release, human intervention is not required, thereby greatly reducing the cost of gray release, and the error rate of gray release is also reduced. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0047] Figure 1 is a flowchart of the full-link gray release method provided by an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of service request transmission provided by an embodiment of the present application;
[0049] Figure 3 is a structural schematic diagram of the full-link gray release device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and
[0051] It will be understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0052] It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0053] As used in the description of the application and the appended claims, the term "if' can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon [the described condition or event] being detected" or "in response to [the described condition or event] being detected," depending on the context.
[0054] In addition, the terms "first," "second," "third," etc. are used herein only to describe different instances of elements, and are not intended to imply or create an ordinality between elements.
[0055] The terms "one embodiment," "an embodiment," "some embodiments," "exemplary embodiment,” etc. as may be used herein in the specification and / or claims mean, and are used by the inventor or an author of this specification to refer to one or more embodiments or to one or more implementations of an embodiment, and thus do not necessarily refer to the same embodiment, although they can. The terms "the embodiment," "this embodiment" or "an embodiment" as may be used herein in the specification and / or claims means and are used by the inventor or an author of this specification to refer to a particular embodiment or implementation, but not necessarily to the same embodiment or implementation, although it may be. The terms "include," "including," "comprise," "comprising," "have," "having," and "contain," "containing," or variations thereof, as may be used herein in the specification and / or claims, mean "including, but not limited to," unless otherwise indicated.
[0056] Currently, the method for gray release is that every time a new version of microservice is released, human intervention is often required, such as group setting, version number modification, etc. The gray release method requiring human intervention makes the cost of gray release high and prone to errors.
[0057] To solve the above technical problems, embodiments of the present application provide a full-link gray release method, which comprises the following steps:
[0058] In some embodiments of the present application, the full-link gray release method can be applied to the microservice gateway or microservice of the microservice cluster. It should be noted that when the microservice gateway executes the full-link gray release method, the gray request can come from the front end; when the microservice executes the full-link gray release method, the gray request can come from the microservice gateway or other microservices of the microservice cluster.
[0059] It is worth mentioning that in some embodiments of the present application, since the microservice gateway and the microservice can complete the gray release by automatically obtaining the gray identification information of the downstream microservice node when gray release is performed, human intervention is not required, thereby greatly reducing the cost of gray release and also reducing the error rate of gray release.
[0060] The full-link gray release method provided by the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0061] Embodiment one
[0062] As shown in Figure 1 The embodiments of the present application provide a full-link gray release method, which comprises the following steps:
[0063] Step 11, when a gray request is received, obtaining the gray identification information of all downstream microservice nodes corresponding to the gray request.
[0064] In some embodiments of the present application, the gray identification information of the downstream microservice node is used to identify whether the downstream service node is a gray node.
[0065] In some embodiments of the present application, the above-mentioned gray scale identification information can be obtained from the registration center of the micro-service cluster when the gray scale request is first received, and the gray scale identification information can be stored after being obtained. When the gray scale request is received again, the gray scale identification information of the nodes where all the downstream micro-services corresponding to the gray scale request are located can be obtained from the locally stored gray scale identification information, and the above-mentioned gray scale identification information can also be obtained from the registration center.
[0066] In step 12, whether there is a gray scale node in the nodes where all the downstream micro-services are located is determined according to the obtained gray scale identification information. If there is a gray scale node in the nodes where all the downstream micro-services are located, step 13 is performed.
[0067] In some embodiments of the present application, since the gray scale identification information of the nodes where the downstream micro-services are located identifies whether the node is a gray scale node, after obtaining the gray scale identification information of the nodes where all the downstream micro-services are located, it can be accurately and quickly determined whether there is a gray scale node in the nodes where all the downstream micro-services are located.
[0068] In step 13, any one of the downstream micro-services corresponding to all the gray scale nodes is taken as a target micro-service.
[0069] In step 14, the gray scale request is forwarded to the target micro-service.
[0070] In some embodiments of the present application, when it is determined that there is a gray scale node in the nodes where all the downstream micro-services corresponding to the gray scale request are located, any one of the downstream micro-services corresponding to these gray scale nodes is taken as a target micro-service, and the gray scale request is forwarded to the target micro-service, so that the nodes through which each gray scale request link passes are all gray scale nodes, and gray scale release is realized. Since the micro-service gateway and the micro-service can complete the gray scale release by automatically obtaining the gray scale identification information of the nodes where the downstream micro-services are located when the gray scale release is performed, human intervention is not required, thereby greatly reducing the cost of gray scale release and also reducing the error rate of gray scale release.
[0071] It should be noted that in some embodiments of the present application, when it is determined in step 12 that there is no gray scale node in the nodes where all the downstream micro-services corresponding to the gray scale request are located, the gray scale request is forwarded to any one of the downstream micro-services. That is, if all the nodes where the downstream micro-services corresponding to the gray scale request are located are non-gray scale nodes, the gray scale request can be forwarded to any one of the downstream micro-services to ensure the transmission of the gray scale request.
[0072] In some embodiments of the present application, the microservice cluster described above can be a cloud-native distributed cluster, and the registration center of the cloud-native distributed cluster can be a nacos registration center. As a preferred example, the cloud-native distributed cluster described above is a K8S cluster.
[0073] The full name of the K8S cluster is a kubernetes cluster. Kubernetes is an open source and is used to manage containerized applications on multiple hosts in a cloud platform. The goal of Kubernetes is to make the deployment of containerized applications simple and efficient. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.
[0074] Nacos is an open source project that is independent based on the application configuration management (ACM, Application Configuration Management) service provided by Alibaba Cloud. It can be used as a registration center and configuration center for a microservice cluster, used for registration and discovery of microservices, and health check of microservice instances to automatically exclude failed instances from the microservice cluster and maintain the availability of the microservice cluster.
[0075] It should be noted that since the service routing in the nacos registration center is local routing, and the nacos registration center records and stores the gray identification information of each node, when the microservice gateway or microservice that executes the full-link gray publishing method receives a gray request, it can obtain the gray identification information of the nodes where all downstream microservices corresponding to the gray request are located from the nacos registration center, thereby achieving automatic gray publishing without human intervention, greatly reducing the cost of gray publishing, and also reducing the error rate of gray publishing.
[0076] In some embodiments of the present application, as shown in Figure 2 When the microservice gateway receives a service request (such as a hyper text transfer protocol (HTTP) request) from a front-end page, it can determine whether the service request is a gray request by judging whether the service request carries a gray request header. Specifically, if the service request carries a gray request header, the service request is a gray request, and if the service request does not carry a gray request header, the service request is a non-gray request. When the microservice gateway receives a gray request, it forwards the received gray request to a downstream microservice (such as microservice A in Figure 2 ) deployed on a gray node by executing the full-link gray publishing method described above. When the microservice gateway receives a non-gray request, it forwards the non-gray request to a downstream microservice (such as microservice B in Figure 2 ) deployed on a non-gray node.
[0077] In some embodiments of the present application, the microservice gateway does not need to color the service request when receiving the service request, thereby ensuring that the gray request can be directly transmitted from the front end to the back end.
[0078] As a preferred example, the above microservice gateway can adopt a spring cloud gateway. The Spring cloud gateway is a gateway developed by Spring based on Spring 5.0, Spring Boot2.0 and ProjectReactor technologies.
[0079] In some embodiments of the present application, as shown in Figure 2 When the microservice receives a service request (such as an HTTP request) sent by the microservice gateway or other microservices in the microservice cluster, it can determine whether the service request is a gray request by judging whether the service request carries a gray request header. Specifically, if the service request carries a gray request header, the service request is a gray request, and if the service request does not carry a gray request header, the service request is a non-gray request. Wherein, when the microservice (such as microservice A in Figure 2 receives a gray request, it will forward the received gray request to a downstream microservice (such as microservice C in Figure 2 deployed on a gray node by executing the above full-link gray publishing method. When the microservice (such as microservice B in Figure 2 receives a non-gray request, it will forward the non-gray request to a downstream microservice (such as microservice D in Figure 2 deployed on a non-gray node.
[0080] It should be noted that, whether it is a microservice gateway or a microservice, when receiving a gray request, if the node where the downstream microservice corresponding to the gray request is a non-gray node, the received gray request will be forwarded to a downstream microservice deployed on a non-gray node to ensure the normal transmission of the gray request.
[0081] In some embodiments of the present application, in order to ensure that the registration center (such as the nacos registration center) records the gray identification information of all nodes where the microservice is deployed, the above full-link gray publishing method further includes the following steps:
[0082] Step one, when the microservice starts, determine whether the node where the microservice is located is a gray node.
[0083] In some embodiments of the present application, whether the node where the microservice is located is a gray node can be determined by reading an environment variable of the node where the microservice is located. The environment variable is generated when the node where the microservice is located is created by the microservice cluster, and contains a field indicating whether the node where the microservice is located is a gray node. Specifically, the field can be marked in the orchestration file of the node.
[0084] Specifically, if the field in the environment variable indicates that the node where the microservice is located is a gray node, it is determined that the node where the microservice is located is a gray node; and if the field in the environment variable indicates that the node where the microservice is located is a non-gray node, it is determined that the node where the microservice is located is a non-gray node.
[0085] As an example, the field can be a version field. If the version is v3, the field indicates that the node where the microservice is located is a gray node; and if the version is v1, the field indicates that the node where the microservice is located is a non-gray node. For example, if the environment variable of the node is ms-api-gateway-v3-7b8859f7, it indicates that the node is a gray node.
[0086] Step two, according to the determination result, obtaining the gray identification information of the node where the microservice is located.
[0087] In some embodiments of the present application, the gray identification information is used to identify whether the node where the microservice is located is a gray node. As a preferred example, if the determination result is that the node where the microservice is located is a gray node, the gray identification information can be version=v3; and if the determination result is that the node where the microservice is located is a non-gray node, the gray identification information can be version=v1.
[0088] Step three, registering the obtained gray identification information to the registry center of the microservice cluster.
[0089] It is worth mentioning that in the related art, when the microservice gateway or the microservice receives the gray request, a traffic forwarding proxy component (such as the microservice management platform istio) is needed to complete the forwarding of the gray request. In some embodiments of the present application, any microservice in the microservice cluster obtains the gray identification information of the node where the microservice is located when starting, and sends the gray identification information to the registration center (such as the nacos registration center) of the microservice cluster, so that the registration center records the gray identification information of each node, so that the microservice gateway (or any microservice) in the microservice cluster does not need the participation of the traffic forwarding proxy component when receiving the gray request, and only needs to obtain the gray identification information of the node where the downstream microservice is located from the registration center, and can automatically complete the forwarding of the gray request, greatly simplifying the gray release process.
[0090] It should be noted that the registration center can store the gray identification information of the node in the metadata of the node after receiving the gray identification information of the node.
[0091] As can be seen, in some embodiments of the present application, by setting a field for describing whether the node is a gray node in the environment variable of the node when the node is created in the microservice cluster, the gray identification information of each node in the microservice cluster is obtained, so that the microservice gateway or the microservice can automatically and stably complete the transmission of the gray request when receiving the gray request, and ensure that the gray release can be stably implemented. It should be noted that when the registration center of the microservice cluster is the nacos registration center, no secondary development is needed for the nacos registration center, and only the microservice needs to register the gray identification information of the node where the microservice is located in the nacos registration center when starting, so that the microservice gateway or the microservice can simply and efficiently complete the gray release by obtaining the gray identification information of the related node from the nacos registration center when receiving the gray request.
[0092] It should be further pointed out that in some embodiments of the present application, the gray identification information of the node is irrelevant to the service version, and is only determined by the microservice cluster orchestration, so that the reliability and stability of the gray node in the microservice cluster are very strong, and the entire gray link can exist for a long time and can be tested at any time.
[0093] The full-link gray release device provided by the embodiments of the present application will be described below with reference to the accompanying drawings.
[0094] Embodiment two
[0095] Corresponding to the full-link gray release method described in the above embodiments, as shown in Figure 3 The embodiments of the present application provide a full-link gray release device 300, which comprises:
[0096] The acquisition module 301 is configured to acquire, when a gray request is received, gray identification information of nodes where all downstream microservices corresponding to the gray request are located; the gray identification information of the nodes where the downstream microservices are located is used to identify whether the nodes where the downstream services are located are gray nodes.
[0097] The judgment module 302 is configured to judge, according to the acquired gray identification information, whether there is a gray node in the nodes where all the downstream microservices are located.
[0098] The execution module 303 is configured to, if there is a gray node in the nodes where all the downstream microservices are located, take any one of the downstream microservices corresponding to all the gray nodes as a target microservice.
[0099] The sending module 304 is configured to forward the gray request to the target microservice.
[0100] The full-link gray release device 300 further includes:
[0101] The determination module is configured to determine, when a microservice is started, whether a node where the microservice is located is a gray node.
[0102] The obtaining module is configured to obtain, according to a determination result, gray identification information of the node where the microservice is located; the gray identification information is used to identify whether the node where the microservice is located is a gray node.
[0103] The registration module is configured to register the obtained gray identification information to a registration center of a microservice cluster.
[0104] The determination module includes:
[0105] The reading unit is configured to read an environment variable of the node where the microservice is located; the environment variable is generated when the microservice cluster creates the node where the microservice is located, and the environment variable contains a field used to describe whether the node where the microservice is located is a gray node.
[0106] The first execution unit is configured to, if the field indicates that the node where the microservice is located is a gray node, determine that the node where the microservice is located is a gray node.
[0107] The second execution unit is configured to, if the field indicates that the node where the microservice is located is a non-gray node, determine that the node where the microservice is located is a non-gray node.
[0108] The acquisition module 301 is specifically configured to acquire, from a registration center of a microservice cluster, gray identification information of nodes where all downstream microservices corresponding to the gray request are located.
[0109] The microservice cluster is a cloud-native distributed cluster, and a registration center of the cloud-native distributed cluster is an nacos registration center.
[0110] The full-link gray release device 300 further includes:
[0111] The forwarding module is configured to forward the gray request to any downstream microservice if there is no gray node in the nodes where all the downstream microservices are located.
[0112] It should be noted that the information interaction, execution process, and the like between the above-described devices / units are based on the same concept as the method embodiments of the present application, and specific functions and technical effects brought by the same can be referred to the method embodiments part, which will not be described here in detail.
[0113] The microservice, the microservice gateway, the computer readable storage medium, and the computer program product provided in the embodiments of the present application are described below.
[0114] Embodiment Three
[0115] The embodiments of the present application provide a microservice, which includes the full-link gray release device described above.
[0116] That is, the microservice, by acquiring the gray identifier information of the nodes where all the downstream microservices corresponding to the gray request are located when the gray request is received, and judging whether there is a gray node in the nodes where all the downstream microservices are located according to the gray identifier information, if there is a gray node in the nodes where all the downstream microservices are located, taking any downstream microservice in the downstream microservices corresponding to all the gray nodes as a target microservice, and forwarding the gray request to the target microservice, ensures that the nodes passed by each gray request link are all gray nodes, and realizes gray release.
[0117] It can be understood that the various embodiments and embodiment combinations in the full-link gray release device embodiments described above and the beneficial effects thereof are also applicable to the present embodiment, which will not be described here in detail.
[0118] Embodiment Four
[0119] The embodiments of the present application provide a microservice gateway, which includes the full-link gray release device described above.
[0120] In some embodiments, when the micro-service gateway receives the gray-scale request, the micro-service gateway obtains gray-scale identification information of all downstream micro-service nodes corresponding to the gray-scale request, and determines whether there is a gray-scale node in the all downstream micro-service nodes according to the obtained gray-scale identification information; if there is a gray-scale node in the all downstream micro-service nodes, any downstream micro-service corresponding to all the gray-scale nodes is taken as a target micro-service, and finally the gray-scale request is forwarded to the target micro-service.
[0121] The gray-scale identification information of the downstream micro-service node is used to identify whether the downstream micro-service node is a gray-scale node.
[0122] Optionally, the micro-service gateway can obtain the gray-scale identification information of all downstream micro-service nodes corresponding to the gray-scale request from a registration center of a micro-service cluster.
[0123] Optionally, the micro-service cluster is a cloud-native distributed cluster, and the registration center of the cloud-native distributed cluster is an nacos registration center.
[0124] Optionally, when the micro-service gateway determines that there is no gray-scale node in the all downstream micro-service nodes, the micro-service gateway forwards the gray-scale request to any downstream micro-service.
[0125] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in the above-mentioned various method embodiments.
[0126] The embodiments of the present application provide a computer program product. When the computer program product is run on a terminal device, the terminal device can implement the steps in the above-mentioned various method embodiments.
[0127] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application can implement all or part of the processes in the above-mentioned embodiment methods through a computer program to instruct related hardware to complete, and the computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the full link gray release device / microservice / microservice gateway, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.
[0128] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0129] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0130] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the above-described apparatus / network device embodiments are merely schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may also be distributed to multiple network units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0132] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for end-to-end canary deployment, characterized in that, include: Upon receiving a grayscale request, obtain the grayscale identification information of all downstream microservice nodes corresponding to the grayscale request; The grayscale identification information of the node where the downstream microservice is located is used to identify whether the node where the downstream microservice is located is a grayscale node. Based on the obtained grayscale identification information, determine whether there are grayscale nodes among the nodes where all downstream microservices are located; If there are grayscale nodes among the nodes where all the downstream microservices are located, then any one of the downstream microservices corresponding to all the grayscale nodes shall be taken as the target microservice. Forward the grayscale request to the target microservice; The step of obtaining the grayscale identifier information of all downstream microservice nodes corresponding to the grayscale request includes: Obtain the grayscale identification information of all downstream microservice nodes corresponding to the grayscale request from the registry center of the microservice cluster; Before obtaining the grayscale identifier information of all downstream microservice nodes corresponding to the grayscale request when the grayscale request is received, the method further includes: When a microservice starts, it is determined whether the node where the microservice resides is a canary node. Based on the determination result, the canary identification information of the node where the microservice resides is obtained. The canary identification information is used to identify whether the node where the microservice resides is a canary node. The obtained canary identification information is registered with the registry center of the microservice cluster. After receiving the canary identification information of the node, the registry center stores the canary identification information in the metadata of the node. The microservice cluster is a cloud-native distributed cluster, the registry center of the cloud-native distributed cluster is the Nacos registry center, and the cloud-native distributed cluster is a Kubernetes cluster. Determining whether the node where the microservice resides is a grayscale node includes: Read the environment variables of the node where the microservice is located; the environment variables are generated when the microservice cluster creates the node where the microservice is located, and the environment variables contain fields used to describe whether the node where the microservice is located is a grayscale node; If the field indicates that the node where the microservice is located is a grayscale node, then the node where the microservice is located is determined to be a grayscale node; If the field indicates that the node where the microservice is located is a non-grayscale node, then the node where the microservice is located is determined to be a non-grayscale node.
2. The method according to claim 1, characterized in that, After determining whether there is a grayscale node among all the nodes where the downstream microservices are located based on the obtained grayscale identification information, the method further includes: if there is no grayscale node among all the nodes where the downstream microservices are located, then forwarding the grayscale request to any downstream microservice.
3. A full-link grayscale publishing device, characterized in that, include: The acquisition module is used to acquire the grayscale identification information of all downstream microservice nodes corresponding to the grayscale request when a grayscale request is received; The grayscale identification information of the node where the downstream microservice is located is used to identify whether the node where the downstream microservice is located is a grayscale node. The judgment module is used to determine whether there are gray nodes among the nodes where all downstream microservices are located, based on the obtained grayscale identification information. The execution module is used to take any one of the downstream microservices corresponding to all the downstream microservices as the target microservice if there are gray nodes in the nodes where all the downstream microservices are located. The sending module is used to forward the grayscale request to the target microservice; The determination module is used to determine whether the node where the microservice is located is a grayscale node when the microservice starts. The acquisition module is used to obtain the grayscale identification information of the node where the microservice is located based on the determination result; The grayscale identification information is used to identify whether the node where the microservice is located is a grayscale node; The registration module is used to register the obtained grayscale identification information to the registration center of the microservice cluster. After receiving the grayscale identification information of the node, the registration center stores the grayscale identification information in the metadata of the node. The microservice cluster is a cloud-native distributed cluster, the registry center of the cloud-native distributed cluster is the Nacos registry center, and the cloud-native distributed cluster is a Kubernetes cluster. Specifically, the acquisition module is used to obtain the grayscale identification information of all downstream microservice nodes corresponding to the grayscale request from the registration center of the microservice cluster. The determining module is specifically used for: Read the environment variables of the node where the microservice is located; the environment variables are generated when the microservice cluster creates the node where the microservice is located, and the environment variables contain fields used to describe whether the node where the microservice is located is a grayscale node; If the field indicates that the node where the microservice is located is a grayscale node, then the node where the microservice is located is determined to be a grayscale node; If the field indicates that the node where the microservice is located is a non-grayscale node, then the node where the microservice is located is determined to be a non-grayscale node.
4. A microservice, characterized in that, Includes the end-to-end grayscale publishing device as described in claim 3.
5. A microservice gateway, characterized in that, Includes the end-to-end grayscale publishing device as described in claim 3.
6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Micro-service gray release method and device, computer equipment and storage medium
CN109739552A