Event processing system and event processing method, device and storage medium
By adding dynamic management components and an event handling system for monitored objects, the lack of flexibility in the controller-runtime framework was resolved, enabling flexible subscription and processing of resource events, and improving event response speed and system stability.
Patent Information
- Application Number
- CN202210615541.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-05-31
AI Technical Summary
The controller-runtime framework has poor flexibility, supports a limited number of resource events, cannot effectively handle loosely coupled cluster-level and namespace-level associated events, and cannot support cascading subscriptions of resource events for non-structured objects and non-ownerReference resource objects.
An event processing system is provided, which adds a dynamic management component and a monitoring object for resource objects. The dynamic management component can obtain resource events of the computing cluster and determine the target monitoring object based on the events. The target monitoring object provides the events to the executor for processing and supports flexible subscription and publication of resource events.
The versatility of the resource event engine has been improved, supporting events for non-structured objects and resource objects without ownerReference, reducing resource consumption, and improving event response speed and system stability.
Smart Images

Figure CN115033344B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud services, and in particular to an event processing system and method, device and storage medium. BACKGROUND
[0002] A PaaS platform is a cloud platform constructed based on a container cluster management system. A controller-runtime framework is used to create a resource controller of the container cluster management system. Through the controller-runtime, a resource change can be listened to, a resource event can be captured, and a corresponding processing procedure can be triggered. However, the controller-runtime framework has poor flexibility, and supports limited resource events. SUMMARY
[0003] Aspects of the present application provide an event processing system and method, device and storage medium, to provide a new event processing system and improve the versatility of an event engine.
[0004] An event processing system is provided by an embodiment of the present application, comprising: a controller; the controller comprising: a dynamic management component, an executor, and a monitoring object corresponding to a resource object of a computing cluster;
[0005] The dynamic management component is configured to acquire an event of a first resource object of the computing cluster, determine a target monitoring object that subscribes to the event of the first resource object according to the event of the first resource object, and provide the event of the first resource object to the target monitoring object; the target monitoring object provides the event of the first resource object to an executor corresponding to the target monitoring object.
[0006] The executor corresponding to the target monitoring object is configured to process the first resource object and / or a second resource object corresponding to the target monitoring object according to the event of the first resource object.
[0007] An event processing method is also provided by an embodiment of the present application, comprising:
[0008] Acquiring an event of a first resource object of a computing cluster by calling a dynamic management component;
[0009] Determining a target monitoring object that subscribes to the event of the first resource object according to the event of the first resource object;
[0010] Providing the event of the first resource object to the target monitoring object, so that the target monitoring object provides the event of the first resource object to an executor corresponding to the target monitoring object;
[0011] Call the corresponding executor of the target monitoring object to process the first resource object and / or a second resource object corresponding to the target monitoring object according to the event of the first resource object.
[0012] The embodiments of the present application also provide a computing device, comprising a memory and a processor; wherein the memory is configured to store a computer program;
[0013] The processor is coupled to the memory and is configured to execute the computer program to perform the steps in the event processing method.
[0014] The embodiments of the present application also provide a computer readable storage medium storing computer instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps in the event processing method.
[0015] The embodiments of the present application provide a general resource event engine, which mainly adds a dynamic management component and a monitoring object of a resource object. The dynamic management component can obtain a resource event of a computing cluster; and determine a target monitoring object subscribing to the resource event according to the resource event. The target monitoring object can provide the resource event to a corresponding executor, and the executor processes a related resource object according to the resource event. The resource event processing has no requirement on the type of the resource event, which helps to improve the generalizability of the resource event engine. BRIEF DESCRIPTION OF DRAWINGS
[0016] The accompanying drawings, which are included to provide a further understanding of the present application, constitute a part of the present application and illustrate embodiments of the present application and the description thereof, and do not constitute improper limitations to the present application. In the drawings:
[0017] Figure 1 And Figure 2 A structure schematic diagram of an event processing system provided by the embodiments of the present application;
[0018] Figure 3 A schematic diagram of application state management performed by the controller-runtime framework;
[0019] Figure 4 A schematic diagram of application state management performed by the event processing system provided by the embodiments of the present application;
[0020] Figure 5 Test results of CPU usage of application state management performed by the controller-runtime framework and application state management performed by the event processing system provided by the embodiments of the present application;
[0021] Figure 6A flowchart of an event processing method provided by an embodiment of the present application is shown in FIG. 1.
[0022] Figure 7 A structural diagram of a computing device provided by an embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION
[0023] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in detail with reference to the embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0024] In a container cluster management platform, the controller-runtime framework is used to create resource controllers of the container cluster management system. Through the controller-runtime, changes in resources can be listened to, resource events can be captured, and corresponding processing procedures can be triggered. However, the inventors found through research on the controller-runtime architecture that the controller-runtime framework has poor flexibility and supports limited resource events. For example, the controller-runtime framework only supports resource events subscribed by resource objects with ownerReference, cannot support association events between loosely coupled cluster level and namespace level, and cannot support resource events of non-structured type objects and cascading subscription of resource object events without ownerReference.
[0025] To solve the above technical problems, an embodiment of the present application provides a general resource event engine, which mainly adds a dynamic management component and a monitoring object of a resource object. The dynamic management component can obtain resource events of a computing cluster; and determine a target monitoring object subscribing to the resource events according to the resource events. The target monitoring object can provide the resource events to a corresponding executor, and the executor processes relevant resource objects according to the resource events. The resource event processing has no requirement on the type of the resource events, which helps to improve the universality of the resource event engine.
[0026] The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0027] It should be noted that the same reference numerals in the following drawings and embodiments represent the same objects, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in subsequent drawings and embodiments.
[0028] Figure 1 and Figure 2 The structural schematic diagram of an event processing system provided in the embodiments of the present application. The event processing system can be implemented as an event engine of a controller in a container cluster management system, and is used for processing events of resource objects of a container cluster management platform. In the embodiments of the present application, the events of resource objects, which can also be referred to as resource events, mainly refer to events triggered when the resources themselves change. The events of resource objects can include a create event, an update event, a delete event and the like. Of course, the events of resource objects can also include external events of a computing cluster, i.e., non-cluster resource events.
[0029] As shown in Figure 1 and Figure 2 , the event processing system can include a controller 10. In the container cluster management system, the controller 10 monitors the public state of the computing cluster and strives to change the current state to the desired state. One controller 10 tracks at least one type of resource. These resource objects have a spec field representing the desired state. The controller of the resource object is responsible for ensuring that the current state reaches the desired state.
[0030] In the embodiments of the present application, the controller 10 can implement resource event processing such as event subscription, event notification and event execution. The way in which the controller 10 processes resource events is exemplarily described below.
[0031] As shown in Figure 1 and Figure 2 , for resource objects of a computing cluster, the controller 10 can dynamically create and remove a monitoring object 11 (Watcher) corresponding to the resource object (corresponding to step 1) in Figure 1 and Figure 2 . The monitoring object 11 is a logical embodiment of the resource object in the controller 10. In the embodiments of the present application, the resource object can be any resource in the corresponding cluster of the container cluster management system, including but not limited to structure type objects and unstructure type objects and the like. The structure type object refers to a resource object with a defined data structure in the controller 1 code, which can include resource objects natively supported by the container cluster management system and custom resources (CR); the unstructure type object refers to a resource object without a defined data structure in the controller code, which can include custom resources and the like.
[0032] Specifically, the controller 10 can create the watcher 11 (corresponding to Figure 1 and Figure 2 “create” in step 1 in the above). In the embodiments of the present application, the specific implementation form of the watcher creation event is not limited. In some embodiments, the watcher creation event can be implemented as a controller 10 startup event. Accordingly, the controller 10 can automatically create the watcher 11 corresponding to the resource object of the computing cluster during the startup process.
[0033] For the resource object, the controller 10 can write the identifier of the resource object subscribed by the watcher 11 into the managed resources queue of the watcher 11. Specifically, the controller 10 can obtain the watcher creation instance during the startup process, and obtain the identifier of the resource object subscribed by the watcher 11 from the watcher creation instance. Further, the controller 10 can write the identifier of the resource object subscribed by the watcher 11 into the managed resources queue of the watcher 11. The identifier of the resource object refers to information uniquely identifying a resource object, which can be represented by the group, version number, and resource type (Group, Version and Kind, GVK). The managed resources queue is used to maintain the event objects subscribed by the reconciler 12.
[0034] The reconciler 12 is a component in the controller 10 for responding to resource events and executing corresponding processing logic. In the embodiments of the present application, the controller 10 can bind the watcher 11 and the reconciler 12. One watcher 11 can be uniquely bound to one reconciler 12. The reconciler 12 can respond to the events of the resource object subscribed by the watcher 11 and execute corresponding processing logic.
[0035] In the embodiments of the present application, the controller 10 can further include a dynamic management component 13. The dynamic management component 13 and the watcher 11 can be connected through the event channel (Generic Event) maintained by the watcher 11. The dynamic management component 13 refers to a logic component in the controller 10 for receiving events of resource objects.
[0036] In the embodiments of the present application, the controller 10 can register the watcher 11 with the dynamic management component 13 and establish the event channel between the watcher 11 and the dynamic management component 13. The controller 10 can also write the corresponding relationship between the identifier of the watcher and the identifier (such as GVK) of the resource object subscribed by the watcher into the subscriber queue (Subscribers) of the dynamic management component 13 (corresponding to Figure 1 and Figure 2(In step 2, "subscription"). The subscription queue can be implemented as a list of monitoring objects indexed by GVK, essentially an inverted index of the monitoring objects and their subscribed resource objects. When an event of a resource object occurs, the dynamic management component 13 can determine the target monitoring object subscribing to the resource object's event by using the correspondence between the identifier of the monitoring object stored in the subscription object and the identifier of the resource object subscribed to by the monitoring object (such as GVK); and provide the resource object's event to the target monitoring object. Specifically, the dynamic management component 13 can provide the resource object event to the target monitoring object through the event channel maintained by the monitoring object 11.
[0037] In this embodiment, the dynamic management component 13 may further include an event bus. The event bus is used to receive events from resource objects (corresponding to...) Figure 1 Step 3 and Figure 1 (Step 7). In this embodiment, the events received by the dynamic management component 13 can be external events or internal resource events of the computing cluster. The process of resource event processing by the event processing system provided in this embodiment is described below by way of example.
[0038] like Figure 2 As shown, the dynamic management component 13 can obtain events (referred to as resource events) of resource objects in the computing cluster (corresponding to...). Figure 1 Step 3 and Figure 2 (Step 7). Specifically, the event bus in the dynamic management component 13 can receive events from resource objects of the computing cluster. The event bus can be implemented through subscription or publication. The events of resource objects can be external events or internal resource events of the computing cluster. The events of resource objects may include: an identifier of the resource object, used to indicate the resource object from which the event occurred.
[0039] For external events to the computing cluster, the dynamic management component 13 can add an external event interface, allowing users to send external events to the computing cluster by calling the external event interface. Correspondingly, the dynamic management component 13 can receive external events to the computing cluster, retrieve the resource pairs corresponding to the external events, and determine whether the external event is an event of a resource object (corresponding to...). Figure 2 Step 3 and Figure 1 (Step 7, "External Event" transmission).
[0040] For internal resource events of the computing cluster, such as Figure 2As shown, the API server component 20 can be monitored by the dynamic informer component 14. The API server component 20 is a service end for adding, deleting, querying, modifying, and monitoring a resource object in a container cluster management system. The API server component 20 can also store events of the resource object, such as resource events of deletion, update, or addition of the resource object. The data is stored in an etcd database, and the API server component 20 can perform a series of functions such as authentication and authorization of the data stored in the etcd database, caching, API version adaptation conversion, and the like. The etcd database is a distributed, highly available, and consistent Key-Value storage database, and is mainly used for shared configuration and service discovery.
[0041] Specifically, the dynamic informer component 14 can maintain an informer of the monitoring object 11. The informer is a core toolkit in client-go. The informer is actually a client that can register an event handler (EventHandler) with a local cache and an index mechanism. Using the informer can reduce the pressure of data interaction of the API server component 20, and the reading and monitoring operations of the client on the data of the API server component 20 can be performed through the local informer.
[0042] In the embodiments of the present application, the informer of the monitoring object is dynamically created or deleted. For the above Figure 2 The newly created monitoring object 11 in step 1 can also be judged whether the informer corresponding to the monitoring object exists. In the embodiments of the present application, the dynamic management component 13 can record the correspondence between the identifier of the monitoring object and the informer. The identifier of the monitoring object can be represented by the identifier of the resource object corresponding to the monitoring object 11. Accordingly, for the newly created monitoring object 11, the identifier of the monitoring object can be used to query the correspondence between the identifier of the monitoring object and the informer recorded in the dynamic management component 13. If the informer corresponding to the identifier of the monitoring object is found, the controller 10 can reuse the informer. Accordingly, if the informer corresponding to the identifier of the monitoring object is not found, it is determined that the informer of the monitoring object does not exist in the controller 10, and the informer of the monitoring object can be created (corresponding to the newly created informer in step 3 in the middle). Figure 1 In step 3 in the middle, the newly created informer). Then, a long connection between the informer of the monitoring object and the API server component 20 can be established. Specifically, a long connection between the reflector of the informer and the API server component 20 is established, and the reflector monitors the resource object corresponding to the monitoring object in the API server component 20.
[0043] Of course, the controller 10 can also determine the to-be-deleted monitoring object associated with the monitoring object deletion event in response to the monitoring object deletion event; in the case where there is no monitoring object subscribing to the event of the resource object corresponding to the to-be-deleted monitoring object, delete the notification instance of the to-be-deleted monitoring object (corresponding to Figure 2 “Destroy Informer” in step 3 in the method), to achieve dynamic deletion of the notification instance.
[0044] Of course, when the monitoring object is deleted, the controller 10 can also delete the identifier of the resource object subscribing to the event of the resource object corresponding to the to-be-deleted monitoring object in the management and control resource queue of the to-be-deleted monitoring object; and delete the corresponding relationship between the identifier of the to-be-deleted monitoring object and the identifier of the resource object subscribed by the monitoring object from the subscription queue of the dynamic management component 13, to achieve dynamic subscription (corresponding to Figure 2 and Figure 2 “Unsubscribe” in step 2.
[0045] The dynamic notification component 14 based on the controller-runtime framework of the container cluster management platform realizes dynamic creation and deletion of the notification instance (Informer). In this way, when a new CRD type is added in a cloud product, it is not necessary to intrude into the underlying code of the controller, and it is only necessary to dynamically create monitoring objects and dynamic instances for the resource object corresponding to the new CRD type, so as to realize listening, responding and processing of the resource event of the resource object corresponding to the new CRD type.
[0046] Based on the above notification instance, the notification instance of the monitoring object can monitor the resource object event in the API service component 20; and in the case where it is monitored that there is a resource object event, the occurred resource object event is obtained as the event of the resource object; further, the event of the resource object can be provided to the dynamic management component 13.
[0047] As shown in Figure 2 , the notification instance can include a reflector (Reflector), a delta event queue (Delta FIFO) and an index cache of the resource object (Cache). The reflector can monitor the resource object event in the API service component 20; and in the case where it is monitored that there is a resource object event, the occurred resource object event is obtained as the event of the resource object; the event of the resource object is stored to the delta event queue (corresponding to Figure 2 step 5 in the method); the dynamic notification component 14 is used to operate the index cache corresponding to the resource object according to the event of the resource object (corresponding to Figure 2 step 6 in the method).
[0048] Specifically, the reflector in Informer can establish a connection with API service component 20. The reflector uses the List And Watch method to call both Kubernetes List and Watch APIs. The reflector first calls the Kubernetes List API to obtain the resource object of a certain resource, and then calls the Watch API to monitor the resource object. If an instance of the resource object is created, deleted, or updated, the reflector will receive an event notification, that is, it has detected an event that occurred on the resource object (corresponding to...). Figure 1 (See step 4, "list and watch"). This resource event can be stored in the incremental event queue. The Informer continuously reads resource events from the incremental event queue. For each resource event read, the Informer determines the type of the resource event and then creates or updates the local index cache corresponding to that resource type.
[0049] If the event type is "Added," Informer will save the API object from this resource event to the local cache using the Indexer library and create an index for it; if it's a deletion operation, the object will be deleted from the local cache. For the incremental cache queue, the resource object's event can also be provided to the dynamic management component 13 (corresponding to...). Figure 2 (Step 7, "Internal Resource Event" transmission).
[0050] Furthermore, the dynamic management component 13 can determine the target monitoring object subscribing to the events of the resource object based on the resource object's events. Optionally, the dynamic management component 13 can obtain the resource object's identifier from the resource object's events; and use the resource object's identifier to query the subscription queue to determine the target monitoring object corresponding to the resource object's identifier. Specifically, the event bus in the dynamic management component 13, for the received resource object's events, can obtain the resource object's identifier from the resource object's events; and use the resource object's identifier to query the subscription queue to determine the target monitoring object corresponding to the resource object's identifier.
[0051] Furthermore, the dynamic management component 13 can provide events from resource objects to the target monitoring object (corresponding to...). Figure 1 Step 4 and Figure 2 (Step 8). Specifically, the dynamic management component 13 can provide the resource object's events to the target monitoring object through the event channel maintained by the monitoring object 11.
[0052] In some embodiments, the user-defined logic code corresponding to the event of the resource object is implemented in the organization format supported by controller-runtime. In the transmission of the event of the resource object by the controller 10 provided in the embodiments of the present application, the intermediate process does not need to perceive the specific event type. Therefore, in order to improve the universality of the controller 10, the dynamic management component 13 can perform standardization processing on the event of the resource object before providing the event of the resource object to the target monitoring object, so as to obtain an event of the resource object with a standardized format; further, the event of the resource object with the standardized format can be provided to the target monitoring object (corresponding to step 4 in the Figure 1 middle process and step 8 in the Figure 2 middle process). Specifically, the above-mentioned standardization processing of the event of the resource object can be performed by the event bus of the dynamic management component 13. After obtaining the event of the resource object with the standardized format, the dynamic management component 13 can transmit the event of the resource object with the standardized format in the event bus to the target monitoring object through the event channel maintained by the target monitoring object.
[0053] For the target monitoring object, the event of the resource object can be provided to the executor 12 corresponding to the target monitoring object (corresponding to step 5 in the Figure 2 middle process). In some embodiments of the present application, since the executor 12 is the processing logic defined by the user side based on the organization format supported by controller-runtime architecture, the executor 12 needs to perceive the type of the resource event as the processing unit of the resource event, and the above-mentioned standardized format of the resource event encapsulates the resource event, so, as shown in Figure 2 , an event analysis component 15 can also be arranged between the monitoring object 11 and the executor 12. The event analysis component 15 is used to analyze the event of the resource object with the standardized format into the event of the resource object with the original type which can be recognized by the executor 12. Based on the event analysis component 15, the target monitoring object can send the event of the resource object with the standardized format to the event analysis component 15. The event analysis component 15 can analyze the event of the resource object with the standardized format into the event of the resource object with the original type, and provide the event of the resource object with the original type to the executor 12 corresponding to the target monitoring object.
[0054] Since the resource object processing capability of the executor 12 is limited, in the embodiments of the present application, a work queue 16 can also be arranged in the controller 10. In the embodiments of the present application, the work queue 16 can be arranged between the monitoring object 11 and the executor 12. In some embodiments, the work queue 16 can be arranged between the monitoring object 11 and the event analysis component 15, and the event analysis component 15 is connected with the executor 12. In another embodiment, the event analysis component 15 can be connected with the monitoring object 11, and the work queue 16 is connected between the event analysis component 15 and the executor 12, etc.
[0055] The work queue 16 is used to store the events of the resource objects outputted by the target monitoring object. The controller 10 can control the flow of the work queue 16 according to the data processing capability of the executor 12, so that the output speed of the resource events of the work queue 16 is adapted to the processing speed of the executor 12. For example, the controller 10 can delay or limit the output of the resource events of the work queue 16, etc.
[0056] In some other embodiments, not all the resource events of the resource objects need to be processed by the executor 12. Accordingly, the user of the resource objects can design the event filter 17 according to the application logic and requirements of the user.
[0057] The event filter 17 can be disposed between the monitoring object 11 and the executor 12. For the events of the resource objects outputted by the target monitoring object, the event filter 17 can filter the events of the resource objects according to the set event filtering condition. If the events of the resource objects do not satisfy the event filtering condition, the events of the resource objects are provided to the executor 12 corresponding to the target monitoring object. Accordingly, if the events of the resource objects satisfy the event filtering condition, the events of the resource objects are discarded.
[0058] For the above-mentioned embodiments in which the events of the resource objects outputted by the target monitoring object are in the standardized format, since the event filter 17 is designed by the user side, and considering the data processing capability of the event parsing component 15, the event filter 17 and the executor 12, for the controller 10 having the work queue 16, the event parsing component 15, the event filter 17 and the executor 12, the events of the resource objects outputted by the target monitoring object can be stored in the work queue 16 (corresponding to step 9 in Figure 2 The events of the resource objects outputted by the work queue 16 in the standardized format can be parsed by the event parsing component 15 into the user side format (corresponding to step 10 in Figure 2 The events of the resource objects in the user side format can be outputted to the event filter 17 (corresponding to step 11 in Figure 2 The event filter 17 can filter the events of the resource objects according to the set event filtering condition (corresponding to step 12 in Figure 3 If the events of the resource objects do not satisfy the event filtering condition, the events of the resource objects are provided to the executor 12 corresponding to the target monitoring object.
[0059] Accordingly, the executor 12 corresponding to the target monitoring object can process the resource object and / or the resource object corresponding to the target monitoring object according to the event of the resource object (corresponding Figure 4 In the embodiments of the present application, in order to facilitate description and distinction, the resource object that occurs the resource event is defined as the first resource object, and the resource object corresponding to the target monitoring object that subscribes the first resource object is defined as the second resource object.
[0060] In the embodiments of the present application, the specific implementation of the executor 12 corresponding to the target monitoring object processing the first resource object and / or the second resource object according to the event of the first resource object is not limited. Specifically, the executor 12 can call the callback function to process the first resource object and / or the second object according to the event of the first resource object. Wherein, the processing logic executed by the executor 12 can be determined by the callback function.
[0061] In some embodiments, the executor 12 can perform state management on the first resource object and / or the second resource object according to the event of the first resource object, so as to make the first resource object and / or the second resource object reach the corresponding expected state. Specifically, the executor 12 corresponding to the target monitoring object that subscribes the event of the first resource object can obtain the current state and the corresponding expected state of the first resource object and / or the second resource object; and control the API service component 20 to adjust the state of the first resource object and / or the second resource object to the corresponding expected state.
[0062] For example, in some embodiments, the event of the first resource object is implemented as a deletion event of the first resource object. The executor 12 corresponding to the target monitoring object that subscribes the event of the first resource object can perform state management on the second resource object according to the deletion event of the first resource object. For example, the expected state of the second resource object is corresponding to 5 first resource objects; the first resource object is deleted, resulting in that the current state of the second resource object that subscribes the first resource object is corresponding to 4 first resource objects, then the executor 12 can dynamically create a new first resource object for the second resource object, and so on.
[0063] In some embodiments, the event of the first resource object is implemented as a failure event of the first resource object, and the executor 12 corresponding to the target monitoring object that subscribes to the event of the first resource object can adjust the state of the first resource object according to the failure event of the first resource object, so that the state of the first resource object reaches a normal state, etc. For example, the executor 12 corresponding to the target monitoring object that subscribes to the event of the first resource object can recreate the first resource object, etc. Of course, the executor 12 corresponding to the target monitoring object that subscribes to the event of the first resource object can adjust the state of the second resource object to an unready state, etc. according to the failure event of the first resource object. Alternatively, the executor 12 corresponding to the target monitoring object that subscribes to the event of the first resource object can recreate the first resource object according to the failure event of the first resource object; and adjust the state of the second resource object to a ready state when the first resource object is created and reaches a ready state, etc. The above implementation of processing the resource object is only illustrative and does not constitute a limitation. The execution logic of how the executor 12 processes the resource object is determined by the set callback function.
[0064] The event processing system provided by the embodiments of the present application provides a general resource event engine. A dynamic management component and a monitoring object of a resource object are mainly added. The dynamic management component can obtain a resource event of a computing cluster; and determine a target monitoring object that subscribes to the resource event according to the resource event; the target monitoring object can provide the resource event to a corresponding executor, and the executor processes a related resource object according to the resource event. The resource event processing has no requirement on the type of the resource event, which helps to improve the universality of the resource event engine. The event processing system provided by the embodiments of the present application can also support flexible subscription and publication of resource events, and can support resource events of non-structured type objects and resource events of resource objects without ownerReference, etc.
[0065] The event processing system provided by the embodiments of the present application can be applied to various resource event processing. For example, it can be applied to application state management. The application state management is one of the core functions of a PaaS platform, and the state management efficiency and resource consumption directly affect the stability and product competitiveness of the PaaS platform. In some schemes, the application state management is implemented based on the open source controller-runtime engine. This application state management method is mainly implemented based on the "concurrency + polling" mode, and has weak customization ability and scalability. At the same time, due to the timing and concurrent execution mechanism, the runtime resource consumption fluctuates very much, which causes stability problems to the system.
[0066] For the application service deployed by the PaaS platform, it can be decomposed into multiple layers of resources. Each layer of resources corresponds to a resource type, each resource type has multiple resource objects, and the resource objects of the next level are the child resources of the last level; the resource objects of the last level are the parent resources of the last level. The parent resources can subscribe to the events of the child resources. For example, Figure 3 and Figure 4 As shown, the application service can include five layers of nested resource objects: product layer resources (Product Deploy), cluster layer instance resources (Cluster Instance), application sets (APP Set), application instances (APP Instance), and workloads (Workload). The workload is a child resource of the application instance, and the application instance is a child resource of the application set. Accordingly, the application instance can subscribe to the resource events of the workload, and the application set can subscribe to the resource events of the application instance. The child resource object of the workload is a container group (such as a Pod).
[0067] In the above application state management scheme based on the "concurrency + polling" mode of the open source controller-runtime engine, "polling" means that the controller corresponding to each layer of resources periodically queries the API service component according to the set query period to listen for whether there is a resource event of the resource object of the layer; if the resource event of the resource object of the layer is queried, the controller triggers the processing of the resource event. "Concurrency" means that multiple processes are started to query the API service component concurrently for multiple resource objects of each layer of resources. As shown in Figure 1 For this "concurrency + polling" mode, when the query time of multiple resource objects of each layer of resources arrives, the controller of the layer of resources will pull all child resources of the resource object of the layer of resources from the API service component, and after traversing the states of all child resources, the controller will aggregate the state results of the child resources to the parent resource. Therefore, the "concurrency + polling" mode based on the open source controller-runtime engine is essentially a top-down checking mechanism. If the bottommost resource object changes, the topmost resource object takes a long time to perceive that the bottommost resource object changes, and the concurrent query consumes a high CPU resource.
[0068] The event processing system provided by the embodiments of the present application reconfigures the execution logic of the application state checking module. As shown in Figure 2 For multiple layers of nested resource objects, when the bottommost resource object changes, the resource event of the bottommost resource object will be transmitted to the parent resource through the above Figure 5 and Figure 5The event processing system provided in the application can improve the sensing speed of the parent resource to the resource event of the child resource, and further improve the response speed to the resource event with low resource consumption.
[0069] The application inventors tested the application state management scheme based on the "concurrency + polling" mode of the open-source controller-runtime engine and the application state management scheme using the event processing system provided in the embodiments of the application. The test results are as shown in Figure 5 and Table 1 below.
[0070] Table 1 Performance test comparison
[0071]
[0072] Among them, Figure 6 The CPU usage obtained by testing the application state management scheme based on the "concurrency + polling" mode of the open-source controller-runtime engine and the application state management using the event processing system provided in the embodiments of the application. According to the CPU usage as shown in Figure 6 It can be seen from the CPU usage that the CPU usage of the application state management scheme based on the "concurrency + polling" mode of the open-source controller-runtime engine is relatively large when the polling period is reached, and the CPU usage is relatively low in other cases, which leads to large fluctuations in the CPU usage of the PaaS platform and affects the stability of the PaaS platform. When the event processing system provided in the embodiments of the application is used for application state management, the CPU usage is relatively stable, and the overall CPU consumption is relatively small.
[0073] Table 1 above is a comparison of the average CPU usage, memory usage, request amount to the API service component, average state change response time, and overall R&D cost investment of the newly added CRD when testing the application state management scheme based on the "concurrency + polling" mode of the open-source controller-runtime engine and the application state management using the event processing system provided in the embodiments of the application. It can be seen that the CPU consumption of the event processing system provided in the embodiments of the application is relatively low, the request amount to the API service component is also relatively low, and the average response time of the state change is relatively short. Since the resource object information is cached in the Informer in the controller of the event processing system provided in the embodiments of the application, the memory overhead of the event processing system provided in the embodiments of the application will be relatively large.
[0074] In addition to the event processing system provided in the above embodiments, the embodiments of the present application further provide an event processing method. The event processing method provided in the embodiments of the present application is exemplarily described below.
[0075] Figure 6 A flowchart of the event processing method provided in the embodiments of the present application is shown in FIG. 6. As shown in FIG. 6, the event processing method mainly includes the following steps: Figure 7
[0076] 601. Invoking a dynamic management component to obtain an event of a first resource object of a computing cluster.
[0077] 602. According to the event of the first resource object, determining a target monitoring object that subscribes to the event of the first resource object.
[0078] 603. Providing the event of the first resource object to the target monitoring object, so that the target monitoring object provides the event of the first resource object to an executor corresponding to the target monitoring object.
[0079] 604. Invoking the executor corresponding to the target monitoring object to process a second resource object corresponding to the target monitoring object and / or the first resource object according to the event of the first resource object.
[0080] The event processing method provided in the embodiments of the present application can be executed by a controller of a resource object. The descriptions of the resource object, the event of the resource object, the controller of the resource object, the dynamic management component, and the monitoring object corresponding to the resource object can be referred to the related content of the system embodiments, which will not be repeated here.
[0081] In the embodiments of the present application, the controller can implement resource event processing such as event subscription, event notification, and event execution. The way of the controller for resource event processing is exemplarily described below.
[0082] For the resource object of the computing cluster, a monitoring object (Watcher) corresponding to the resource object can be dynamically created and removed. The monitoring object is a logical embodiment of the resource object in the controller.
[0083] Specifically, the monitoring object (Watcher) can be created in response to a monitoring object creation event. In the embodiments of the present application, the specific implementation form of the monitoring object creation event is not limited. In some embodiments, the monitoring object creation event can be implemented as a controller startup event. Accordingly, the controller can automatically create the monitoring object corresponding to the resource object of the computing cluster in the startup process.
[0084] For a resource object, the identity of the resource object subscribed by the monitoring object can be written into the managed resources queue of the monitoring object. The managed resources queue is used to maintain event objects subscribed by a reconciler. Specifically, in a startup process, a monitoring object creation instance can be obtained, and the identity of the resource object subscribed by the monitoring object can be obtained from the monitoring object creation instance. Further, the identity of the resource object subscribed by the monitoring object can be written into the managed resources queue of the monitoring object. The identity of the resource object refers to information uniquely identifying a resource object, which can be represented by a group, a version number, and a resource type (Group, Version and Kind, GVK).
[0085] The reconciler is a component in the controller for responding to resource events and executing corresponding processing logic. In this embodiment, the controller can bind the monitoring object and the reconciler. One monitoring object can be uniquely bound to one reconciler. The reconciler can respond to events of the resource object subscribed by the monitoring object and execute corresponding processing logic.
[0086] In this embodiment, the controller can further include a dynamic management component. The dynamic management component and the monitoring object can be connected through an event channel (Generic Event) maintained by the monitoring object. The dynamic management component refers to a logic component in the controller for receiving events of a resource object.
[0087] In this embodiment, the controller can register the monitoring object to the dynamic management component and establish an event channel between the monitoring object and the dynamic management component. The controller can also write the correspondence between the identity of the monitoring object and the identity of the resource object subscribed by the monitoring object (such as GVK) into a subscriber queue (Subscribers) of the dynamic management component. The subscriber queue can be implemented as a monitoring object list indexed by GVK, which is essentially an inverted index of monitoring objects and their subscribed resource objects. When an event of a resource object occurs, the dynamic management component can determine the target monitoring object that subscribes to the event of the resource object through the correspondence between the identity of the monitoring object stored by the subscriber object and the identity of the resource object subscribed by the monitoring object (such as GVK), and provide the event of the resource object to the target monitoring object. Specifically, the dynamic management component can provide the event of the resource object to the target monitoring object through the event channel maintained by the monitoring object.
[0088] In the embodiment of the present application, the dynamic management component can further include an event bus. The event bus is configured to receive events of resource objects. In the embodiment of the present application, the events of resource objects received by the dynamic management component can be external events or internal resource events of the computing cluster. The process of the event processing system provided in the embodiment of the present application for resource event processing is exemplarily described below.
[0089] As Figure 7 As shown in step 601, the dynamic management component can be invoked to obtain events (referred to as resource events) of resource objects of the computing cluster. Specifically, the event bus in the dynamic management component can be invoked to receive events of resource objects of the computing cluster. The event bus can be implemented in the form of subscription or publication. The events of resource objects can be external events or internal resource events of the computing cluster. The events of resource objects can include an identifier of a resource object, which is used to indicate the resource object that has the event.
[0090] For the external events of the computing cluster, the dynamic management component can be additionally provided with an external event interface, and a user can send the external events of the computing cluster by invoking the external event interface. For the internal resource events of the computing cluster, the dynamic informer component of the controller can monitor the API service (API Server) component.
[0091] Specifically, the dynamic informer component can maintain an informer of a monitoring object. In the embodiment of the present application, the informer of the monitoring object is dynamically created or deleted. For a newly created monitoring object, it can be further determined whether the informer corresponding to the monitoring object exists. In the embodiment of the present application, the dynamic management component can be invoked to record the correspondence between the identifier of the monitoring object and the informer. The identifier of the monitoring object can be represented by the identifier of the resource object corresponding to the monitoring object. Accordingly, for a newly created monitoring object, the identifier of the monitoring object can be used to query the correspondence between the identifier of the monitoring object and the informer recorded in the dynamic management component. If the informer corresponding to the identifier of the monitoring object is found, the informer can be reused. Accordingly, if the informer corresponding to the identifier of the monitoring object is not found, it is determined that the informer of the monitoring object does not exist in the controller, and the informer of the monitoring object can be created. Then, a long connection between the informer of the monitoring object and the API service component can be established. Specifically, a long connection between a reflector of the informer and the API service component is established, and the reflector in the informer monitors the resource object corresponding to the monitoring object in the API service component.
[0092] Of course, in response to the monitoring object deletion event, the to-be-deleted monitoring object associated with the monitoring object deletion event can be determined; in the absence of a monitoring object subscribing to an event of a resource object corresponding to the to-be-deleted monitoring object, a notification instance of the to-be-deleted monitoring object is deleted, thereby achieving dynamic deletion of the notification instance.
[0093] Of course, when the monitoring object is deleted, the identifier of the resource object subscribing to the event of the resource object corresponding to the to-be-deleted monitoring object in the management and control resource queue of the to-be-deleted monitoring object can also be deleted; and the corresponding relationship between the identifier of the to-be-deleted monitoring object and the identifier of the resource object subscribed by the monitoring object is deleted from the subscription queue of the dynamic management component, thereby achieving dynamic subscription.
[0094] The above dynamic notification component realizes dynamic creation and deletion of a notification instance (Informer) based on the controller-runtime framework of the container cluster management platform. In this way, when a CRD type is added in a cloud product, it is not necessary to intrude into the controller bottom layer code, and it is only necessary to dynamically create a monitoring object and a dynamic instance for a resource object corresponding to the added CRD type, so that the listening, responding and processing of a resource event of the resource object corresponding to the added CRD type can be realized.
[0095] Based on the above notification instance, the resource object event in the monitoring object notification instance monitoring API service component can be called; and in the case that a resource object event is monitored, the resource object event occurring is obtained; further, the resource object event can be provided to the dynamic management component. Correspondingly, the dynamic management component can be called to obtain the resource object event.
[0096] Further, in step 602, the target monitoring object subscribing to the event of the resource object can be determined according to the resource object event. Alternatively, the identifier of the resource object can be obtained from the resource object event; and the identifier of the resource object is used to query the subscription queue to determine the target monitoring object corresponding to the identifier of the resource object.
[0097] Further, in step 603, the dynamic management component can provide the resource object event to the target monitoring object. Specifically, the resource object event can be provided to the target monitoring object through an event channel maintained by the monitoring object.
[0098] In some embodiments, in order to improve the generality of the processing of various resource events between controllers, before the resource object event is provided to the target monitoring object, the dynamic management component can be called to standardize the resource object event to obtain a resource object event with a standardized format; further, the resource object event with the standardized format can be provided to the target monitoring object.
[0099] For the target monitoring object, the event of the resource object can be provided to the executor corresponding to the target monitoring object. In some embodiments of the present application, since the executor is a specific processing unit of the resource event, the specific type of the resource event needs to be perceived. Therefore, an event analysis component can also be arranged between the monitoring object and the executor. Accordingly, the event analysis component can be invoked to analyze the resource event with the standardized format into the resource event of the original type supported by the executor. Based on the event analysis component, the target monitoring object can send the event of the resource object with the standardized format to the event analysis component; and the event analysis component can be invoked to analyze the event of the resource object with the standardized format into the original type; further, the event of the resource object of the original type is provided to the executor corresponding to the target monitoring object.
[0100] Since the resource object processing capability of the executor is limited, in the embodiments of the present application, a work queue can also be arranged in the controller. The work queue is used to store the event of the resource object output by the target monitoring object. The controller can control the flow of the work queue according to the data processing capability of the executor, so as to adapt the output speed of the resource event of the work queue to the processing speed of the executor.
[0101] In some other embodiments, not all resource events need to be processed by the executor for the user of the resource object. Accordingly, the user can design an event filter according to the application logic and needs of the user. The event filter is used to maintain the resource event filtering condition and filter the resource event meeting the resource event filtering condition. The resource event filtering condition can be flexibly set by the user of the resource object according to the application needs of the user. Based on this, before the target monitoring object provides the event of the resource object to the executor, the event filter can be invoked to filter the event of the resource object according to the set event filtering condition. If the event of the resource object does not meet the event filtering condition, the event of the resource object is provided to the executor corresponding to the target monitoring object. Accordingly, if the event of the resource object meets the event filtering condition, the event of the resource object is discarded.
[0102] Further, in step 604, the executor corresponding to the target monitoring object can be invoked to process the first resource object and / or the second resource object according to the event of the resource object. In the embodiments of the present application, in order to facilitate description and distinction, the resource object where the resource event occurs is defined as the first resource object; and the resource object corresponding to the target monitoring object which subscribes to the first resource object is defined as the second resource object.
[0103] In the embodiments of the present application, the specific implementation of the executor corresponding to the target monitoring object processing the first resource object and / or the second resource object according to the event of the first resource object is not limited. Specifically, the invocable executor can invoke the callback function to process the first resource object and / or the second object according to the event of the first resource object. The processing logic performed by the executor can be determined by the callback function. For the specific implementation of the executor processing the resource object and / or the resource object corresponding to the target monitoring object according to the event of the resource object, please refer to the related content of the system embodiments described above, which will not be repeated here.
[0104] In the embodiments, the dynamic management component and the monitoring object of the resource object are added in the controller. When processing the event, the dynamic management component can be invoked to obtain the resource event of the computing cluster; and the target monitoring object subscribed to the resource event can be determined according to the resource event. The target monitoring object can provide the resource event to the corresponding executor. Further, the executor can be invoked to process the related resource object according to the resource event. The resource event processing has no requirement on the type of the resource event, which helps to improve the universality of the resource event engine.
[0105] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can also be executed by different devices as the execution subject. For example, the execution subject of steps 601 and 602 can be device A; for another example, the execution subject of step 601 can be device A, and the execution subject of step 602 can be device B; and so on.
[0106] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations appearing in a specific order are included, but it should be clear that these operations can be executed or in parallel without the order in which they appear in this text. The serial numbers of the operations, such as 601, 602, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel.
[0107] Correspondingly, the embodiments of the present application also provide a computer readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the steps in the above event processing method.
[0108] The embodiment of the present application further provides a computer program product, comprising: a computer program. The computer program is executed by one or more processors, so as to cause the one or more processors to execute the steps in the event processing method. In the embodiment of the present application, the specific implementation form of the computer program product is not limited. In some embodiments, the computer program product can be implemented as a controller of a resource object in a container cluster management platform or an event engine of the controller.
[0109] Figure 7 A structural schematic diagram of a computing device provided by the embodiment of the present application is shown in the figure. As shown in the figure, the computing device comprises a memory 70a and a processor 70b. The memory 70a is configured to store a computer program. Figure 7
[0110] The processor is coupled to the memory and is configured to execute the computer program to: invoke a dynamic management component to obtain an event of a first resource object of a computing cluster; determine a target monitoring object subscribing to the event of the first resource object according to the event of the first resource object; provide the event of the first resource object to the target monitoring object, so that the target monitoring object provides the event of the first resource object to an executor corresponding to the target monitoring object; and invoke the executor corresponding to the target monitoring object to process a second resource object corresponding to the target monitoring object and / or the first resource object according to the event of the first resource object.
[0111] Optionally, when determining the target monitoring object subscribing to the event of the first resource object, the processor 70b is specifically configured to: obtain an identifier of the first resource object from the event of the first resource object; and query a subscription queue of the dynamic management component to determine a corresponding relationship between an identifier of a resource object and a monitoring object subscribing to the resource object, so as to determine the target monitoring object corresponding to the identifier of the first resource object.
[0112] Optionally, the processor 70b is further configured to: create a first monitoring object in response to a monitoring object creation event; write an identifier of a resource object subscribed by the first monitoring object into a management resource queue of the first monitoring object; establish an event channel between the first monitoring object and the dynamic management component; and write a corresponding relationship between the identifier of the resource object subscribed by the first monitoring object and the first monitoring object into the subscription queue.
[0113] In some embodiments, the processor 70b, when invoking the dynamic management component to obtain the event of the first resource object of the computing cluster, is specifically configured to: invoke the notification instance of the first resource object maintained by the dynamic notification component to monitor the resource object event in the API service component; when the occurrence of the resource object is monitored, obtain the occurred resource object event as the event of the first resource object; invoke the notification instance corresponding to the first resource object to provide the event of the first resource object to the dynamic management component; and invoke the dynamic management component to receive the event of the first resource object.
[0114] In some embodiments, the processor 70b, when invoking the dynamic management component to obtain the event of the first resource object of the computing cluster, is specifically configured to: invoke the dynamic management component to receive the external event of the computing cluster; obtain the resource object corresponding to the external event from the external event as the first resource object; and determine that the external event is the event of the first resource object.
[0115] In some embodiments, the processor 70b is further configured to: in the case that the controller does not exist the notification instance of the first monitoring object, create the notification instance of the first monitoring object; establish a long connection between the notification instance of the first monitoring object and the API service component; and establish the reflector in the notification instance of the first monitoring object to monitor the resource object corresponding to the first monitoring object in the API service component.
[0116] Optionally, the processor 70b is further configured to: query in the corresponding relationship between the identifiers of the monitoring objects and the notification instances recorded in the dynamic management component by using the identifier of the first monitoring object; if the notification instance corresponding to the identifier of the first monitoring object is not queried, determine that the controller does not exist the identifier of the resource object corresponding to the first monitoring object.
[0117] In the embodiments of the present application, the processor 70b is further configured to: in response to the monitoring object deletion event, determine the second monitoring object to be deleted corresponding to the monitoring object deletion event; delete the identifier of the resource object subscribed by the second monitoring object in the management and control resource queue of the second monitoring object; and delete the corresponding relationship between the identifier of the resource object subscribed by the second monitoring object and the second monitoring object from the subscription queue.
[0118] Optionally, the processor 70b is further configured to: delete the notification instance of the second monitoring object from the dynamic notification component; and stop the monitoring of the notification instance of the second monitoring object to the resource object corresponding to the second monitoring object.
[0119] Optionally, the processor 70b is further configured to: before the target monitoring object provides the event of the first resource object to the corresponding executor of the target monitoring object, invoke the event filter to filter the event of the first resource object according to a set event filtering condition; and if the event of the first resource object does not satisfy the event filtering condition, provide the event of the first resource object to the corresponding executor of the target monitoring object.
[0120] Optionally, the processor 70b is further configured to: before providing the event of the first resource object to the target monitoring object, invoke the dynamic management component to perform standardization processing on the event of the first resource object to obtain a standardized format of the event of the first resource object; and provide the event of the first resource object in the standardized format to the target monitoring object.
[0121] Optionally, the processor 70b is further configured to: before the target monitoring object provides the event of the first resource object to the corresponding executor of the target monitoring object, invoke the target monitoring object to store the event of the first resource object in the standardized description format to a work queue; invoke the event analysis component to obtain the event of the first resource object in the standardized format from the work queue; and analyze the event of the first resource object in the standardized format into an original type event; and provide the original type event of the first resource object to the executor of the target monitoring object. Accordingly, when processing the first resource object and / or a second resource object corresponding to the target monitoring object, the processor 70b is specifically configured to: invoke the executor of the target monitoring object to process the first resource object and / or the second resource object according to the original type event of the first resource object.
[0122] In some optional embodiments, as shown in Figure 7 The computing device can further include optional components such as a communication component 70c and a power component 70d. Figure 7 Some components are only schematically shown in the foregoing description, which does not mean that the computing device must include all the components shown in Figure 1 , nor does it mean that the computing device can only include the components shown in Figure 1 .
[0123] The computing device provided by the embodiment can deploy a controller of a resource object, and add a dynamic management component and a monitoring object of the resource object in the controller. When processing an event, the dynamic management component can be invoked to obtain a resource event of a computing cluster; and a target monitoring object subscribed to the resource event can be determined according to the resource event. The target monitoring object can provide the resource event to a corresponding executor. Further, the executor can be invoked to process a related resource object according to the resource event. The resource event processing has no requirement on the type of the resource event, which helps to improve the universality of the resource event engine.
[0124] In embodiments of the present application, the memory is configured to store a computer program and can be configured to store other various data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to realize the corresponding control logic. The memory can be realized by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0125] In embodiments of the present application, the processor can be any hardware processing device that can execute the above-mentioned method logic. Alternatively, the processor can be a central processing unit (CPU), a graphics processing unit (GPU), or a microcontroller unit (MCU); it can also be a programmable device such as a field-programmable gate array (FPGA), a programmable array logic (PAL), a general array logic (GAL), a complex programmable logic device (CPLD), etc.; or an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (SOC), etc., but not limited to this.
[0126] In embodiments of the present application, the communication component is configured to facilitate wired or wireless communication between the device where it is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G, 5G or their combination. In an exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology or other technologies.
[0127] In embodiments of the application, the power supply component is configured to provide power to various components of the device in which it is located. The power supply component can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.
[0128] It should be noted that the terms "first", "second", and so on in the present text are used to distinguish different messages, devices, modules, and the like, and do not represent a sequence, nor do they limit the "first" and "second" to be different types.
[0129] Those skilled in the art should understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0130] The present application is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more functions specified in the flowchart or flows and / or blocks. Figure 1 an apparatus that implements one or more functions specified in the flowchart or flows and / or blocks.
[0131] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including instruction apparatus that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more functions specified in the flowchart or flows and / or blocks. Figure 1 an apparatus that implements one or more functions specified in the flowchart or flows and / or blocks.
[0132] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable data processing apparatus to produce a computer-implemented process, so that the instructions executed on the computer or other programmable data processing apparatus provide a process for implementing the functions specified in the flowcharts and / or block diagrams. one or more functions specified in the flowchart or flows and / or blocks. steps of a function specified in one or more blocks.
[0133] In one typical arrangement, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0134] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the computer stores the information. The memory is an example of computer readable media.
[0135] The computer's storage media can be implemented using any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disks (DVDs) or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information for access by a computing device. In accordance with the teachings herein, computer readable media does not include transitory computer readable media, such as modulated data signals and carrier waves.
[0136] It is also noted that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0137] The embodiments of methods, hardware systems, software systems, or computing devices described herein can be modified or combined in various ways. Each implementation includes one, some, or all of the described steps or elements. The implementations can be implemented using computer- readable media for example, as computer- readable instructions to be executed on a processor-based computing device. The order of execution can be changed, and various elements combined into a single function or split into separate functions. Various implementations can omit one or more of the described functions. In some implementations, the order of execution can be changed, and various elements combined into a single function or split into separate functions. In some implementations, one or more of the described functions can be omitted. In some implementations, additional functions not mentioned can be added.
Claims
1. An event processing system, characterized by The event processing system is implemented as an event engine of a controller in a container cluster management system; The event processing system comprises a controller, and the controller comprises a dynamic management component, an executor, a monitoring object corresponding to a resource object of a computing cluster, and an event analysis component; the monitoring object is a logical embodiment of the resource object in the controller; The dynamic management component is configured to obtain an event of a first resource object of a computing cluster, the first resource object comprising a non-structured type object and / or a resource object without an owner reference; determine a target monitoring object that subscribes to the event of the first resource object according to the event of the first resource object; perform standardization processing on the event of the first resource object to obtain an event of the first resource object in a standardized format; and provide the event in the standardized format to the target monitoring object; the target monitoring object provides the event in the standardized format to the event analysis component; The event analysis component is configured to analyze the event in the standardized format into the event of the first resource object; and provide the event of the first resource object to an executor corresponding to the target monitoring object; The executor corresponding to the target monitoring object is configured to process the first resource object and / or a second resource object corresponding to the target monitoring object according to the event of the first resource object; and the target monitoring object is a logical embodiment of the second resource object in the controller.
2. The system of claim 1, wherein, The controller further comprises a dynamic notification component; the dynamic notification component is configured to maintain a notification instance of the target monitoring object; the notification instance of the first resource object is configured to monitor a resource object event in an API service component; and in a case where it is monitored that a resource object event occurs, obtain the occurred resource object event as the event of the first resource object, and provide the event of the first resource object to the dynamic management component; and / or The dynamic management component is further configured to: receive an external event of the computing cluster; obtain a resource object corresponding to the external event as the first resource object from the external event; and determine the external event as the event of the first resource object. The controller is further configured to:
3. The system of claim 1, wherein, create a first monitoring object in response to a monitoring object creation event; write an identifier of a resource object subscribed by the first monitoring object into a management resource queue of the first monitoring object; establish an event channel between the first monitoring object and the dynamic management component; write a corresponding relationship between an identifier of the first monitoring object and an identifier of the resource object subscribed by the first monitoring object into a subscription queue of the dynamic management component. The controller is further configured to:
4. The system of claim 3, wherein, create a notification instance of the first monitoring object in a case where the notification instance of the first monitoring object does not exist in the controller; establish a long connection between the notification instance of the first monitoring object and an API service component; establish monitoring of a resource object corresponding to the first monitoring object in the API service component by a reflector in the notification instance of the first monitoring object. 5. An event processing method, the method is applicable to a controller in a container cluster management system; characterized in that, The controller comprises a dynamic management component, an executor, a monitoring object corresponding to a resource object of a computing cluster, and an event analysis component; the monitoring object is a logical embodiment of the resource object in the controller; the method comprises: calling a dynamic management component to obtain an event of a first resource object of a computing cluster; the first resource object comprises a non-structured type object and / or a resource object without an ownerReference; determining a target monitoring object that subscribes to the event of the first resource object according to the event of the first resource object; standardizing the event of the first resource object to obtain an event of the first resource object in a standardized format; providing the event in the standardized format to the target monitoring object, so that the target monitoring object provides the event in the standardized format to the event analysis component; calling the event analysis component to analyze the event in the standardized format into the event of the first resource object; and providing the event of the first resource object to an executor corresponding to the target monitoring object; calling the executor corresponding to the target monitoring object to process the first resource object and / or a second resource object corresponding to the target monitoring object according to the event of the first resource object; the target monitoring object is a logical embodiment of the second resource object in the controller.
6. The method of claim 5, wherein, The method comprises: obtaining an identifier of the first resource object from the event of the first resource object; querying a subscription queue of the dynamic management component to determine a corresponding relationship between an identifier of a resource object and a monitoring object that subscribes to the resource object, so as to determine a target monitoring object corresponding to the identifier of the first resource object.
7. The method of claim 6, wherein, Further comprising: creating a first monitoring object in response to a monitoring object creation event; writing an identifier of a resource object subscribed by the first monitoring object into a management resource queue of the first monitoring object; establishing an event channel between the first monitoring object and the dynamic management component; writing a corresponding relationship between the identifier of the resource object subscribed by the first monitoring object and the first monitoring object into the subscription queue.
8. The method of claim 5, wherein, The method comprises: calling a notification instance of the first resource object to monitor a resource object event in an API service component of the dynamic management component; obtaining the resource object event of the first resource object when a resource object event occurs is monitored; calling the notification instance corresponding to the first resource object to provide the event of the first resource object to the dynamic management component; calling the dynamic management component to receive the event of the first resource object.
9. The method of claim 5, wherein, The method comprises: calling the dynamic management component to receive an external event of the computing cluster; obtaining a resource object corresponding to the external event from the external event as the first resource object; determining that the external event is an event of the first resource object.
10. The method of claim 7, wherein, Further comprising: creating a notification instance of the first monitoring object in the case that the controller does not exist the notification instance of the first monitoring object; establishing a long connection between the notification instance of the first monitoring object and the API service component; establishing a reflector in the notification instance of the first monitoring object to monitor the resource object corresponding to the first monitoring object in the API service component.
11. The method of claim 10, wherein, Further comprising: querying in a corresponding relationship between the identification of the monitoring object and the notification instance recorded by the dynamic management component by using the identification of the first monitoring object; if the notification instance corresponding to the identification of the first monitoring object is not queried, determining that the controller does not exist the identification of the resource object corresponding to the first monitoring object.
12. The method of claim 6, wherein, Further comprising: in response to a monitoring object deletion event, determining a second monitoring object to be deleted corresponding to the monitoring object deletion event; deleting the identification of the resource object subscribed by the second monitoring object in the management and control resource queue of the second monitoring object; deleting the corresponding relationship between the identification of the resource object subscribed by the second monitoring object and the second monitoring object from the subscription queue; deleting the notification instance of the second monitoring object from the dynamic notification component; stopping the monitoring of the resource object corresponding to the second monitoring object by the notification instance of the second monitoring object.
13. A computing device, comprising: comprising: a memory and a processor; wherein the memory is configured to store a computer program; the processor is coupled to the memory and is configured to execute the computer program to perform the steps in the method of any one of claims 5-12.
14. A computer readable storage medium having stored thereon computer instructions, wherein, when the computer instructions are executed by one or more processors, the one or more processors are caused to perform the steps in the method of any one of claims 5-12.
Citation Information
Patent Citations
Container management method and device, equipment and storage medium
CN113407310A