Resource verification method and device, equipment, medium and container editing system
By configuring the resource quota information of each Namespace in Kubernetes, making it reference the total number of resources of all Namespaces in the global namespace resource quota information, and including the total number of resource usage of all Namespaces, the problem of low resource verification pass rate during the creation of a Pod is solved, the resource verification pass rate and pod creation success rate is improved, and the resource imbalance problem is solved.
Patent Information
- Application Number
- CN202411792097.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-25
AI Technical Summary
In Kubernetes, the existing technology leads to a low pass rate of resource verification during the creation of a Pod, which leads to a high failure rate for Pod creation.
By configuring the resource quota information of each Namespace in the container orchestration system, it references the total number of resources of all Namespaces in the global namespace resource quota information and includes the total number of resource usages of all Namespaces, so that the event-driven real-time communication module can perform real-time resource verification.
The resource verification pass rate and pod creation success rate are improved, the problem of resource verification failure is avoided, and the problem of resource imbalance between different Namespaces is solved through dynamic resource allocation, while maintaining the stability of the container orchestration system.
Smart Images

Figure CN119883603A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to information processing technology, and specifically to a resource verification method, device, equipment, medium and container editing system. Background Art
[0002] Kubernetes is a portable, extensible, open source container orchestration system for automating the deployment, scaling, and management of containerized applications.
[0003] In Kubernetes, there are usually multiple namespaces, each of which corresponds to a unique name. Namespace is a virtual isolation layer within the Kubernetes cluster, which is used to divide the resources within the system into different project groups or user groups. It provides a logical isolation method for resources so that resources in different namespaces do not interfere with each other. In a namespace, multiple Pods can be run, where Pod is the smallest unit that can be created and deployed in Kubernetes, usually containing one or more containers. The containers in a Pod share network namespaces, storage volumes and other resources.
[0004] When creating a Pod, resource verification is required to determine whether the Pod can be created successfully. The resource verification method provided by the prior art includes: ApiServer receives a Pod creation request, obtains the target Namespace to which the Pod to be created belongs and the resources that the Pod to be created needs to occupy; ApiServer queries the resource situation of the target Namespace, including: the total number of allocated resources in the target Namespace, and the number of resources used in the target Namespace; ApiServer obtains the resource verification result based on the resource situation of the target Namespace and the resources that the Pod to be created needs to occupy. Specifically, when the resources that the Pod needs to occupy > (the total number of allocated resources in the target Namespace - the number of resources used in the target Namespace), the resource verification result is verification failure, and the Pod cannot be created. Otherwise, the resource verification result is verification passed, and the Pod can be created in the target Namespace.
[0005] Currently, the total number of allocated resources for each Namespace is set according to a certain ratio based on the total number of resources allocated by Kubernetes to all Namespaces. For example, there are two Namespaces in Kubernetes, namely Namespace1 and Namespace2. The total number of resources allocated to the two Namespaces is 3G, and when the allocation ratio is 1:2, the total number of allocated resources for Namespace1 is 1G, and the total number of allocated resources for Namespace2 is 2G. At this time, the total number of allocated resources for each Namespace is fixed. However, the number of Pods created in each Namespace is not fixed, and the resources required by each Pod are also not fixed. Allocating resources to each Namespace according to the resource allocation method provided by the prior art may result in a low resource verification pass rate during Pod creation, resulting in a high Pod creation failure rate. Summary of the invention
[0006] The embodiments of the present application propose a resource verification method, apparatus, device, medium and container editing system to solve the problem that the resource verification pass rate is low during the Pod creation process, resulting in a high Pod creation failure rate.
[0007] In a first aspect, an embodiment of the present application provides a resource verification method, which is applied to a container orchestration system, wherein the container orchestration system includes multiple namespaces, and the resource allocation number in the resource quota information of each namespace is configured as the total number of resources of all the namespaces in the global namespace resource quota information, and the global namespace resource configuration information also includes: the total number of resource usage of all the namespaces, and the method includes:
[0008] A Pod creation request is received through an event-driven real-time communication module, wherein the Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy;
[0009] Obtaining the global namespace resource quota information through the event-driven real-time communication module;
[0010] Through the event-driven real-time communication module, a first resource verification result is obtained according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0011] In a second aspect, an embodiment of the present application provides a resource verification device, which is applied to a container orchestration system, wherein the container orchestration system includes multiple namespaces, and the resource allocation number in the resource quota information of each Namespace is configured as the total number of resources of all the Namespaces in the global namespace resource quota information, and the global namespace resource configuration information also includes: the total number of resource usage of all the Namespaces, and the device includes:
[0012] A receiving module, configured to receive a Pod creation request through an event-driven real-time communication module, wherein the Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy;
[0013] A query module, used for obtaining the global namespace resource quota information through the event-driven real-time communication module;
[0014] The verification module is used to obtain a first resource verification result through the event-driven real-time communication module according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0015] In a third aspect, an embodiment of the present application provides a container orchestration system, the system comprising: an event-driven real-time communication module and multiple namespaces; the resource allocation number in the resource quota information of each namespace is configured as the total number of resources of all the namespaces in the global namespace resource quota information, and the global namespace resource configuration information also includes: the total number of resource usage of all the namespaces;
[0016] The event-driven real-time communication module is used to receive a Pod creation request, the Pod creation request carries a target Namespace to which the Pod to be created belongs, and a target number of resources that the Pod to be created needs to occupy, obtains the global namespace resource quota information, and obtains a first resource verification result according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0017] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the first aspect.
[0018] In a fifth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the first aspect.
[0019] The resource verification method, apparatus, device, medium and container editing system provided in the embodiments of the present application, the resource allocation number in the resource quota information of each Namespace is configured as the total resource number of all Namespaces in the global namespace resource quota information, and the global namespace resource configuration information includes: the total resource number of all Namespaces and the total resource usage of all Namespaces, so that in the process of resource verification of the Pod to be created, the event-driven real-time communication module can determine whether the number of available resources in the target Namespace meets the target number of resources required to be occupied by the Pod to be created based on the total number of resources of all Namespaces and the total resource usage of all Namespaces, and obtain the first resource verification result. Since the number of resource allocations for each Namespace is the total number of resources for all Namespaces, the problem of resource verification failure caused by a small number of resources allocated to the target Namespace is avoided during the process of creating a Pod, thereby improving the resource verification pass rate and the success rate of creating a Pod in the target Namespace. Furthermore, since each Namespace shares the total number of resources for all Namespaces and the total number of resources used by all Namespaces, the number of resources actually occupied by each Namespace is dynamically allocated, and the resource allocation is highly automated, thus avoiding the problem of resource imbalance between different namespaces. Furthermore, the method of performing resource verification through an event-driven real-time communication module does not change the operation of the original resource verification component of the container orchestration system, making the technical solution provided in this embodiment more flexible and extensible, and able to ensure the stability of the original container orchestration system. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0021] Figure 1 It is one of the flow charts of an embodiment of the resource verification method of the present application;
[0022] Figure 2 This is the second flowchart of an embodiment of the resource verification method of the present application;
[0023] Figure 3 This is the third flowchart of an embodiment of the resource verification method of the present application;
[0024] Figure 4 yes Figure 3 The flowchart of step 106 in the resource verification method of the present application is shown;
[0025] Figure 5 This is a fourth flowchart of an embodiment of the resource verification method of the present application;
[0026] Figure 6 It is a structural diagram of an embodiment of a resource verification device of the present application;
[0027] Figure 7 It is a structural diagram of an embodiment of the container orchestration system of the present application;
[0028] Figure 8 It is a schematic diagram of the structure of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION
[0029] All actions to obtain signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.
[0030] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0032] The resource verification method, apparatus, device, medium, and container editing system proposed in the embodiments of the present application can be applied in a container orchestration system. In the following embodiments, the container orchestration system is Kubernetes as an example for explanation.
[0033] In this embodiment, Kubernetes may include the following functional modules:
[0034] 1. Application Programming Interface Server (ApiServer)
[0035] ApiServer is one of the core components of the Kubernetes control plane. It provides a unified front-end entry for the entire cluster and is responsible for processing all requests to the Kubernetes API. These requests include but are not limited to: create, read, update, and delete operations, as well as executing other types of queries and commands. In addition, ApiServer can also provide functions such as resource quota checking and verification.
[0036] 2. Event-driven real-time communication (webhook) module
[0037] Webhook is an HTTP callback mechanism for real-time data transmission. When an Http request is sent to ApiServer, ApiServer will first forward the request to the service corresponding to WebHook for preprocessing.
[0038] 3. Custom Resource Definitions (CRD) module
[0039] CRD is an extension of the Kubernetes API. When the default API object provided by Kubernetes cannot meet the user's needs, the user can use CRD to create a custom API object. At the same time, the user needs to write a controller component to process the corresponding CRD.
[0040] 4. Custom Resource Definition Controller (CRD controller) module
[0041] CRD controller is a controller used to manage CRD. Its main functions include monitoring CRD resource change events and executing corresponding business logic based on these events. For example, when a user creates, updates, or deletes a CRD instance, CRD Controller will receive the corresponding event notification and process these events according to preset rules, such as automatically creating related Deployment, Service and other resources.
[0042] It should be noted that the modules included in the Kubernetes described above are only functional modules related to the resource verification method, device, equipment, medium and container editing system provided in the embodiments of the present application. In actual use, Kubernetes also includes other functional modules, which are not described one by one here.
[0043] In this embodiment, Kubernetes may include multiple Namespaces, and the resource allocation number in the resource quota information of each Namespace is configured as the total number of resources of all Namespaces in the global namespace resource quota information. The global namespace resource configuration information also includes: the total number of resource usage of all Namespaces.
[0044] It should be noted that the resource verification method, device, equipment, medium and container editing system provided in the embodiments of the present application do not limit the types of resources. By way of example, the resources may include but are not limited to: memory resources, CPU computing resources, and hard disk storage resources, etc., which are not described one by one here.
[0045] Based on the Kubernetes provided in this embodiment described above, please refer to Figure 1 , which shows a process 100 according to an embodiment of a resource verification method of the present application. The resource verification method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the resource verification method may be a processor in the above electronic device.
[0046] like Figure 1 As shown, the resource verification method includes the following steps:
[0047] Step 101: Receive a Pod creation request through an event-driven real-time communication module. The Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy.
[0048] Step 102: Obtain global namespace resource quota information through an event-driven real-time communication module;
[0049] Step 103: Obtain a first resource verification result through an event-driven real-time communication module according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0050] In the resource verification method provided in the embodiment of the present application, the resource allocation number in the resource quota information of each Namespace is configured as the total resource number of all Namespaces in the global namespace resource quota information, and the global namespace resource configuration information includes: the total resource number of all Namespaces and the total resource usage of all Namespaces, so that in the process of resource verification of the Pod to be created, the event-driven real-time communication module can determine whether the number of available resources in the target Namespace meets the target number of resources required to be occupied by the Pod to be created based on the total number of resources of all Namespaces and the total resource usage of all Namespaces, and obtain the first resource verification result. Since the number of resource allocations for each Namespace is the total number of resources for all Namespaces, the problem of resource verification failure caused by a small number of resources allocated to the target Namespace is avoided during the process of creating a Pod, thereby improving the resource verification pass rate and the success rate of creating a Pod in the target Namespace. Furthermore, since each Namespace shares the total number of resources for all Namespaces and the total number of resources used by all Namespaces, the number of resources actually occupied by each Namespace is dynamically allocated, and the resource allocation is highly automated, thus avoiding the problem of resource imbalance between different namespaces. Furthermore, the method of performing resource verification through an event-driven real-time communication module does not change the operation of the original resource verification component of the container orchestration system, making the technical solution provided in this embodiment more flexible and extensible, and able to ensure the stability of the original container orchestration system.
[0051] Please refer to Figure 2 , which shows a process 100 according to an embodiment of a resource verification method of the present application. The resource verification method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the resource verification method may be a processor in the above electronic device.
[0052] like Figure 2 As shown, the resource verification method is the same as Figure 1 The method is basically the same as shown, except that before step 101, the following may also be included:
[0053] Step 104: Real-time monitoring is performed through the CRD controller module to obtain the global namespace resource quota information, and the resource quota information of each Namespace is configured according to the global namespace resource quota information.
[0054] In this embodiment, step 104 specifically configures the resource allocation number in the resource quota information of each Namespace according to the total number of resources of all Namespaces in the global namespace resource quota information.
[0055] In this embodiment, the total resource usage of all Namespaces in the global namespace resource configuration information is not required to configure the resource usage number in the resource quota information of each Namespace. The resource usage number in the resource quota information of each Namespace is set according to the actual usage of the Namespace resources.
[0056] Optionally, in this embodiment, if Figure 2 As shown, before step 104, the following may also be included:
[0057] Step 105: Customize the global namespace resource quota information through the CRD module.
[0058] Of course, the above step 105 is only a specific example for defining the global namespace resource quota information. In actual use, the global namespace resource quota information may also be defined through other functional modules, which will not be described one by one here.
[0059] In this embodiment, the CRD module customizes the global namespace resource quota information, and its format can be expressed as follows:
[0060]
[0061] Among them, multinamespace_resourcequota is the name of the global namespace resource quota information; total_limit is the total number of resources of all namespaces, including the total number of CPU resources and the total number of memory resources; total_used is the total number of resources used by all namespaces, including the total number of CPU resources used and the total number of memory resources used, which is 0 in the initial state; namespacelist is the namespace added to the global namespace resource quota information, among which ns1, ns2, etc. are the names of the namespaces.
[0062] In step 104, when the CRD controller monitors the global namespace resource quota information, it obtains the Namespace added to the global namespace resource quota information from the global namespace resource quota information, and performs resource quota on the Namespace, and configures the resource quota information of the Namespace as the global namespace resource quota information.
[0063] In this embodiment, the specific format of the resource quota information of the Namespace can be expressed as follows:
[0064] Resourcequota:
[0065] limit:
[0066] CPU: xxx
[0067] Memory: xxx
[0068] used:
[0069] CPU: xxx
[0070] Memory: xxx
[0071] Among them, limit is the number of resource allocations, and used is the number of resource usages.
[0072] It should be noted that in this embodiment and the following embodiments, all Namespaces are taken as an example to add global namespace resource quota information. In actual use, the Namespaces to add global namespace resource quota information can be set as needed, which is not repeated here.
[0073] The resource verification method provided in the embodiment of the present application achieves Figure 1 Based on the beneficial effects brought by the technical solution shown, the global namespace resource quota information can be customized through the CRD module of the container orchestration system, and the resource quota information of the Namespace can be configured through the CRD controller module newly added in the embodiment of the present application, so as to achieve the purpose of configuring the global namespace resource quota information for the resource quota information of the Namespace in the container orchestration system. The newly added CRD controller module has a relatively small change to the process of the entire container orchestration system, which ensures the stability of the container orchestration system.
[0074] Please refer to Figure 3 , which shows a process 100 according to an embodiment of a resource verification method of the present application. The resource verification method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the resource verification method may be a processor in the above electronic device.
[0075] like Figure 3 As shown, the resource verification method is the same as Figure 1 The method is basically the same as shown, except that before step 101, the following may also be included:
[0076] Step 106: Receive a Pod creation request through ApiServer, and send the Pod creation request to the event-driven real-time communication module.
[0077] In this embodiment, if Figure 4 As shown, step 106 may include:
[0078] Step 401: When the ApiServer receives a Pod creation request, obtain global namespace resource configuration information.
[0079] In this embodiment, the global namespace resource configuration information may be automatically submitted to the ApiServer after the CRD customization is completed.
[0080] Step 402: Obtain a second resource verification result according to the Pod creation request and the global namespace resource configuration information.
[0081] Step 403: When the second resource verification result is verified to be passed, a Pod creation request is sent to an event-driven real-time communication module.
[0082] The resource verification method provided in the embodiment of the present application achieves Figure 1 On the basis of the beneficial effects brought by the technical solution shown, the original resource verification process of ApiServer is not changed, so that the technical solution provided by the embodiment of the present application is more compatible with the container orchestration system.
[0083] Please refer to Figure 5 , which shows a process 100 according to an embodiment of a resource verification method of the present application. The resource verification method can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the resource verification method may be a processor in the above electronic device.
[0084] like Figure 5 As shown, the resource verification method is the same as Figure 1 The method is basically the same as shown, except that after step 103, the following steps may also be included:
[0085] Step 107: When the first resource verification result is verified to be passed, the global namespace resource quota information is updated according to the target number of resources that the Pod to be created needs to occupy through the CRD controller module.
[0086] In this embodiment, the CRD controller module can update the total resource usage of all Namespaces in the global namespace resource quota information according to the target number of resources that the Pod to be created needs to occupy, that is, add the target number of resources to the total resource usage of all Namespaces.
[0087] It should be noted that the CRD controller module can update the global namespace resource quota information not only during the process of creating a Pod, but also during the process of deleting and modifying a Pod.
[0088] Based on the Kubernetes provided in this embodiment described above, please refer to Figure 6 , which shows a schematic diagram 600 of a structure of an embodiment of a resource verification device according to the present application. The resource verification device can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the resource verification device may be a processor in the above electronic device.
[0089] like Figure 6 As shown, the resource verification device 600 of this embodiment may include:
[0090] The receiving module 601 is used to receive a Pod creation request through an event-driven real-time communication module, wherein the Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy;
[0091] A query module 602, configured to obtain the global namespace resource quota information through the event-driven real-time communication module;
[0092] The verification module 603 is used to obtain a first resource verification result through the event-driven real-time communication module according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0093] Optionally, the receiving module 601 is further used to control the CRD controller module to perform real-time monitoring through custom resource definitions, obtain the global namespace resource quota information, and configure the resource quota information of each Namespace according to the global namespace resource quota information.
[0094] Optionally, the resource verification device 600 of this embodiment may further include:
[0095] The custom module is used to customize the global namespace resource quota information through a custom resource definition CRD module.
[0096] Optionally, the receiving module 601 is further used to receive the Pod creation request through the application programming interface server ApiServer, and send the Pod creation request to the event-driven real-time communication module.
[0097] Optionally, the receiving module 601 is also used to obtain the global namespace resource configuration information when the ApiServer receives the Pod creation request; obtain a second resource verification result based on the Pod creation request and the global namespace resource configuration information; and when the second resource verification result is verification passed, send the Pod creation request to the event-driven real-time communication module.
[0098] Optionally, the resource verification device 600 of this embodiment may further include:
[0099] The update module is used to update the global namespace resource quota information according to the target number of resources that the Pod to be created needs to occupy through the CRDcontroller module when the first resource verification result is verified passed.
[0100] The specific implementation method of the resource verification device provided in the embodiment of the present application can be found in the above Figure 1-5 The resource verification method provided in the embodiment of the present application is described and will not be elaborated here.
[0101] In the resource verification device provided by the embodiment of the present application, the resource allocation number in the resource quota information of each Namespace is configured as the total resource number of all Namespaces in the global namespace resource quota information, and the global namespace resource configuration information includes: the total resource number of all Namespaces and the total resource usage of all Namespaces, so that in the process of resource verification of the Pod to be created, the event-driven real-time communication module can determine whether the number of available resources in the target Namespace meets the target number of resources that the Pod to be created needs to occupy based on the total number of resources of all Namespaces and the total resource usage of all Namespaces, and obtain the first resource verification result. Since the number of resource allocations for each Namespace is the total number of resources for all Namespaces, the problem of resource verification failure caused by a small number of resources allocated to the target Namespace is avoided during the process of creating a Pod, thereby improving the resource verification pass rate and the success rate of creating a Pod in the target Namespace. Furthermore, since each Namespace shares the total number of resources for all Namespaces and the total number of resources used by all Namespaces, the number of resources actually occupied by each Namespace is dynamically allocated, and the resource allocation is highly automated, thus avoiding the problem of resource imbalance between different namespaces. Furthermore, the method of performing resource verification through an event-driven real-time communication module does not change the operation of the original resource verification component of the container orchestration system, making the technical solution provided in this embodiment more flexible and extensible, and able to ensure the stability of the original container orchestration system.
[0102] Please refer to Figure 7 , which shows a structural schematic diagram 700 of an embodiment of a container orchestration system according to the present application. The container orchestration system can be applied to various electronic devices with data processing functions. For example, the above electronic devices may include but are not limited to cloud servers, physical servers, etc. The execution subject of the container orchestration system may be a processor in the above electronic devices.
[0103] like Figure 7 As shown, the container orchestration system 700 of this embodiment includes: an event-driven real-time communication module 701 and multiple Namespaces 702; the resource allocation number in the resource quota information of each Namespace 702 is configured as the total number of resources of all the Namespaces in the global namespace resource quota information, and the global namespace resource configuration information also includes: the total number of resource usage of all the Namespaces 702;
[0104] The event-driven real-time communication module 701 is used to receive a Pod creation request, which carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy, obtains the global namespace resource quota information, and obtains a first resource verification result based on the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0105] Optionally, the container orchestration system 700 of this embodiment may further include:
[0106] The CRD controller module is used to perform real-time monitoring, obtain the global namespace resource quota information, and configure the resource quota information of each Namespace according to the global namespace resource quota information.
[0107] Optionally, the container orchestration system 700 of this embodiment may further include:
[0108] The CRD module is used to customize the global namespace resource quota information.
[0109] Optionally, the container orchestration system 700 of this embodiment may further include:
[0110] ApiServer is used to receive the Pod creation request and send the Pod creation request to the event-driven real-time communication module.
[0111] Optionally, ApiServer is specifically used to obtain the global namespace resource configuration information when receiving the Pod creation request; obtain a second resource verification result based on the Pod creation request and the global namespace resource configuration information; and when the second resource verification result is verification passed, send the Pod creation request to the event-driven real-time communication module 701.
[0112] Optionally, the CRD controller module is further used to update the global namespace resource quota information according to the target number of resources that the Pod to be created needs to occupy when the first resource verification result is verified passed.
[0113] The specific implementation method of the container orchestration system provided in the embodiment of the present application can be found in the above Figure 1-5 The resource verification method provided in the embodiment of the present application is described and will not be elaborated here.
[0114] In the container orchestration system provided by the embodiment of the present application, the resource allocation number in the resource quota information of each Namespace is configured as the total resource number of all Namespaces in the global namespace resource quota information, and the global namespace resource configuration information includes: the total resource number of all Namespaces and the total resource usage of all Namespaces, so that in the process of resource verification of the Pod to be created, the event-driven real-time communication module can determine whether the available resource number of the target Namespace meets the target resource number required to be occupied by the Pod to be created based on the total resource number of all Namespaces and the total resource usage of all Namespaces, and obtain the first resource verification result. Since the number of resource allocations for each Namespace is the total number of resources for all Namespaces, the problem of resource verification failure caused by a small number of resources allocated to the target Namespace is avoided during the process of creating a Pod, thereby improving the resource verification pass rate and the success rate of creating a Pod in the target Namespace. Furthermore, since each Namespace shares the total number of resources for all Namespaces and the total number of resources used by all Namespaces, the number of resources actually occupied by each Namespace is dynamically allocated, and the resource allocation is highly automated, thus avoiding the problem of resource imbalance between different namespaces. Furthermore, the method of performing resource verification through an event-driven real-time communication module does not change the operation of the original resource verification component of the container orchestration system, making the technical solution provided in this embodiment more flexible and extensible, and able to ensure the stability of the original container orchestration system.
[0115] Reference below Figure 8 , which shows a schematic structural diagram of an electronic device for implementing some embodiments of the present application. Figure 8 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0116] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0117] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a disk, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0118] In particular, according to some embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of some embodiments of the present application are executed.
[0119] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0120] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0121] The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist independently without being assembled into the electronic device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives a Pod creation request through an event-driven real-time communication module, and the Pod creation request carries the target Namespace to which the Pod to be created belongs, and the target number of resources that the Pod to be created needs to occupy; obtains the global namespace resource quota information through the event-driven real-time communication module; obtains the first resource verification result through the event-driven real-time communication module according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
[0122] Computer program code for performing the operations of some embodiments of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++; and also conventional procedural programming languages such as "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, or may be connected to an external computer (e.g., through the Internet using an Internet service provider), including a local area network (LAN) or a wide area network (WAN).
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The units described in some embodiments of the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a first determination unit, a second determination unit, a selection unit, and a third determination unit. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0125] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0126] The above description is only some preferred embodiments of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with (but not limited to) the technical features with similar functions disclosed in the embodiments of the present application to form a technical solution.
Claims
1. A resource verification method, characterized in that: Applied to a container orchestration system, the container orchestration system includes a plurality of namespaces, the resource allocation number in the resource quota information of each namespace is configured as the total resource number of all the namespaces in the global namespace resource quota information, the global namespace resource configuration information also includes: the total resource usage of all the namespaces, the method includes: A Pod creation request is received through an event-driven real-time communication module, wherein the Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy; Obtaining the global namespace resource quota information through the event-driven real-time communication module; Through the event-driven real-time communication module, a first resource verification result is obtained according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
2. The method according to claim 1, characterized in that Before receiving the Pod creation request through the event-driven real-time communication module, the method further includes: The CRD controller module is controlled by custom resource definition to perform real-time monitoring, obtain the global namespace resource quota information, and configure the resource quota information of each Namespace according to the global namespace resource quota information.
3. The method according to claim 2, characterized in that Before the CRDcontroller module is controlled by custom resource definition to perform real-time monitoring, the following steps are also included: The global namespace resource quota information is customized through a custom resource definition CRD module.
4. The method according to claim 1, characterized in that: Before receiving the Pod creation request through the event-driven real-time communication module, the method further includes: The Pod creation request is received through an application programming interface server ApiServer, and the Pod creation request is sent to the event-driven real-time communication module.
5. The method according to claim 4, characterized in that The receiving the Pod creation request through the application programming interface server ApiServer and sending the Pod creation request to the event-driven real-time communication module includes: When the ApiServer receives the Pod creation request, obtain the global namespace resource configuration information; Obtain a second resource verification result according to the Pod creation request and the global namespace resource configuration information; When the second resource verification result is verification passed, the Pod creation request is sent to the event-driven real-time communication module.
6. The method according to claim 1, characterized in that The method further comprises: When the first resource verification result is that the verification is passed, the global namespace resource quota information is updated through the CRD controller module according to the target number of resources that the Pod to be created needs to occupy.
7. A resource verification device, characterized in that: Applied to a container orchestration system, the container orchestration system includes a plurality of namespaces, the resource allocation number in the resource quota information of each namespace is configured as the total resource number of all the namespaces in the global namespace resource quota information, the global namespace resource configuration information further includes: the total resource usage of all the namespaces, the device includes: A receiving module, configured to receive a Pod creation request through an event-driven real-time communication module, wherein the Pod creation request carries a target Namespace to which the Pod to be created belongs and a target number of resources that the Pod to be created needs to occupy; A query module, used for obtaining the global namespace resource quota information through the event-driven real-time communication module; The verification module is used to obtain a first resource verification result through the event-driven real-time communication module according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
8. A container orchestration system, characterized in that: The system includes: an event-driven real-time communication module and multiple Namespaces; the resource allocation number in the resource quota information of each Namespace is configured as the total resource number of all the Namespaces in the global namespace resource quota information, and the global namespace resource configuration information also includes: the total resource usage of all the Namespaces; The event-driven real-time communication module is used to receive a Pod creation request, the Pod creation request carries a target Namespace to which the Pod to be created belongs, and a target number of resources that the Pod to be created needs to occupy, obtains the global namespace resource quota information, and obtains a first resource verification result according to the global namespace resource quota information and the target number of resources that the Pod to be created needs to occupy.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.