Resource Quota Management Method and System, Intelligent Terminal, Storage Medium
By implementing the resource quota management method of multiple namespaces in the k8s system, the problem that k8s cannot manage multiple namespaces is solved, and effective management of resource quotas for multiple namespaces is achieved.
Patent Information
- Application Number
- CN202210226807.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-09
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-03-09
AI Technical Summary
The system native to k8s cannot use multiple namespaces, resulting in the current business requirements that correspond to multiple namespaces.
Provide a quota management method for multiple namespaces. Resource quota management for multiple namespaces is achieved by obtaining projects, establishing the association between projects and namespaces, loading projects to processing queues, and starting threads to calculate resource quota information.
It can effectively manage resource quotas in multiple namespaces and realize the current business needs of multiple namespaces.
Smart Images

Figure CN114756362B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technologies, and in particular, to a resource quota management method and system, intelligent terminal, and storage medium. Background Art
[0002] Currently, k8s (Kubernetes, an open-source container orchestration and management tool for container services) is used to manage containerized applications on multiple hosts in a cloud platform. Its goal is to make the deployment of containerized applications simple and efficient. For this purpose, k8s provides functions such as automatic application deployment, automatic restart, automatic replication, load balancing, automatic scaling, maintenance, and extension mechanisms.
[0003] However, in the native k8s system, resource isolation and permission control are usually implemented based on Namespace (namespace), and resourcequota is used to manage a single namespace and manage the resource quota of the limit (limit field) and request (requirement) fields of pod (a set of containers), with two functions of statistics and admission verification. However, the native k8s technology usually can only be used for one namespace and cannot manage the resource quotas in multiple namespaces, so that the business requirements corresponding to multiple current namespaces cannot be met. Summary of the Invention
[0004] The main technical problem to be solved by this application is to provide a resource quota management method and system, intelligent terminal, and storage medium to solve the problem that the native k8s system in the prior art cannot use multiple namespaces, so that the business requirements corresponding to multiple current namespaces cannot be met.
[0005] To solve the above problems, a first aspect of this application provides a quota management method for multiple namespaces. The quota management method for multiple namespaces includes: obtaining at least one project; associating at least one project with at least one namespace; loading the projects associated with at least one namespace into a first processing queue; starting at least one first thread to load at least one project in the first processing queue into at least one first thread; and calculating the resource quota information of at least one project in the first processing queue through at least one first thread.
[0006] After the step of obtaining at least one project and before associating at least one project with at least one namespace, it further includes: counting the first quota of the sum of container sets in at least one namespace corresponding to at least one project.
[0007] After the step of associating at least one item with at least one namespace and before the step of loading the item associated with at least one namespace into the first processing queue, the following steps are further included: obtaining a second quota for the container set sum in each namespace; and loading the second quota into the item associated with the corresponding namespace.
[0008] After the step of calculating, by at least one first thread, the resource quota information of at least one item in the first processing queue, the following steps are further included: detecting whether there is currently an item that has changed; in response to the existence of a first item that has changed, loading the first item into the first processing queue, and restarting at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0009] After the step of calculating, by at least one first thread, the resource quota information of at least one item in the first processing queue, the following steps are further included: detecting whether there is currently a container set sum and / or has changed; in response to the existence of a container set sum and / or having changed, detecting whether the changed container set sum and / or the corresponding namespace is associated with an item; in response to the changed container set sum and / or the corresponding namespace being associated with a second item, performing a quota change on the second item; and loading the second item with the changed quota into the first processing queue to restart at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0010] After the step of calculating, by at least one first thread, the resource quota information of at least one item in the first processing queue, the following steps are further included: receiving a quota modification instruction input by a user to correspondingly modify the quota upper limit of at least one item; loading the third item with the modified quota upper limit into the second processing queue; starting at least one second thread to load at least one third item in the second processing queue into at least one second thread; and calculating, by at least one second thread, the resource quota information of at least one third item in the second processing queue.
[0011] Before the step of obtaining at least one item, the following steps are further included: receiving a registration request of a quota evaluation program to load the quota evaluation program into a loop computer; the step of starting at least one first thread to load at least one item in the first processing queue into at least one first thread includes: the loop computer starting at least one first thread to load at least one item in the first processing queue into at least one first thread; the step of calculating, by at least one first thread, the resource quota information of at least one item in the first processing queue includes: the loop computer calculating, based on the quota evaluation program, the resource quota information of at least one item in the first processing queue.
[0012] After the step of calculating the resource quota information of at least one item in the first processing queue through at least one first thread, the method further includes: reloading all currently acquired items into the first processing queue at a set time interval, and restarting at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0013] After the step of associating at least one item with at least one namespace and before the step of loading the item associated with at least one namespace into the first processing queue, the method further includes: creating a container set; detecting whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace; in response to the currently created container set and the user storage request not exceeding the quota upper limit of the item associated with the corresponding namespace, updating the quota usage information of the item associated with the corresponding namespace, and performing the step of loading the item associated with at least one namespace into the first processing queue.
[0014] The resource quota management method includes: in response to the currently created container set and the user storage request exceeding the quota upper limit of the item associated with the corresponding namespace, the current resource creation fails, and an error message indicating the creation failure is returned.
[0015] Before the step of creating a container set, the method further includes: obtaining the container set; determining whether there is an associated item in the namespace corresponding to the container set; in response to there being an associated item in the namespace corresponding to the container set, performing the step of creating the container set.
[0016] After the step of creating a container set and before the step of detecting whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace, the method further includes: loading the item associated with the namespace corresponding to the currently created container set and the user storage request into a third processing queue; starting at least one third thread to load the items in the third processing queue into at least one third thread; calculating the resource quota information of the items in the third processing queue through at least one third thread.
[0017] Before the step of loading the item associated with the namespace corresponding to the currently created container set and the user storage request into the third processing queue, the method further includes: determining whether the item associated with the namespace corresponding to the currently created container set and the user storage request is being processed; in response to the item associated with the namespace corresponding to the currently created container set and the user storage request being being processed, loading the item associated with the namespace corresponding to the currently created container set and the user storage request into the first data queue, and after its processing is completed, transferring it to the second data queue.
[0018] Among them, the resource quota management method includes: in response to the item associated with the namespace corresponding to the currently created container set and the user storage request not being processed, loading the item associated with the namespace corresponding to the currently created container set and the user storage request into the second data queue; the step of loading the item associated with the namespace corresponding to the currently created container set and the user storage request into the third processing queue includes: sequentially obtaining the item associated with the namespace corresponding to the currently created container set and the user storage request from the second data queue, and loading it into the third processing queue.
[0019] To solve the above problems, a second aspect of the present application provides a resource quota management system, where the resource quota management system includes: a custom controller for obtaining at least one item to establish an association between the at least one item and at least one namespace; a first processing queue for storing the item associated with at least one namespace loaded by the custom controller; a loop computer for starting at least one first thread to load at least one item in the first processing queue into at least one first thread, and calculating the resource quota information of at least one item in the first processing queue through the at least one first thread.
[0020] Among them, the resource quota management method further includes a resource creation controller, and the resource creation controller is used to create a container set and detect whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with its corresponding namespace, so as to update the quota usage information of the item associated with its corresponding namespace when the currently created container set and the user storage request do not exceed the quota upper limit of the item associated with its corresponding namespace.
[0021] To solve the above problems, a third aspect of the present application provides an intelligent terminal, where the intelligent terminal includes a memory and a processor coupled to each other, and the processor is used to execute the program instructions stored in the memory to implement the resource quota management method in the first aspect above.
[0022] To solve the above problems, the fourth aspect of the present application provides a computer-readable storage medium, on which program instructions are stored. When the program instructions are executed by a processor, the resource quota management method of the first aspect is implemented.
[0023] The beneficial effect of the present invention is that, different from the prior art, when the resource quota management method of the present application obtains at least one project, it can associate at least one project with at least one namespace, load the projects associated with at least one namespace into the first processing queue, and start at least one first thread, and then load at least one project in the first processing queue into at least one first thread, so as to calculate the resource quota information of at least one project in the first processing queue through at least one first thread, and thus can manage the resource quotas in multiple namespaces, and can thus meet the business requirements corresponding to multiple namespaces currently. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flowchart of the first embodiment of the resource quota management method of the present application;
[0025] Figure 2 is a flowchart of the second embodiment of the resource quota management method of the present application;
[0026] Figure 3 is a flowchart of the third embodiment of the resource quota management method of the present application;
[0027] Figure 4 is a flowchart of the fourth embodiment of the resource quota management method of the present application;
[0028] Figure 5 is a flowchart of the fifth embodiment of the resource quota management method of the present application;
[0029] Figure 6 is a flowchart of the sixth embodiment of the resource quota management method of the present application;
[0030] Figure 7 is a flowchart of the seventh embodiment of the resource quota management method of the present application;
[0031] Figure 8 is a flowchart of the eighth embodiment of the resource quota management method of the present application;
[0032] Figure 9 is a flowchart of the ninth embodiment of the resource quota management method of the present application;
[0033] Figure 10 is a flowchart of the tenth embodiment of the resource quota management method of the present application;
[0034] Figure 11It is a schematic framework diagram of the first embodiment of the resource quota management system of the present application;
[0035] Figure 12 It is a schematic framework diagram of the second embodiment of the resource quota management system of the present application;
[0036] Figure 13 It is a schematic framework diagram of the third embodiment of the resource quota management system of the present application;
[0037] Figure 14 is Figure 13 a schematic framework diagram of some functional units in the resource quota management system in
[0038] Figure 15 It is a schematic framework diagram of an embodiment of the intelligent terminal of the present application;
[0039] Figure 16 It is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application. Detailed implementation manners
[0040] To make the technical problems solved by the present application, the technical solutions adopted, and the achieved technical effects clearer, the technical solutions of the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0041] Referring to "embodiment" herein means that the specific features, structures, or characteristics described in connection with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein may be combined with other embodiments.
[0042] Please refer to Figure 1 , Figure 1 is a flowchart of the first embodiment of the resource quota management method of the present application. Specifically, it may include the following steps:
[0043] S11: Obtain at least one project.
[0044] With the rapid development of container technology, network services based on k8s have gradually replaced virtual machines, promoting the popularization and implementation of popular technologies such as microservices architecture. Among them, for Internet companies, as applications become more and more complex, the number of containers is also increasing, which has given rise to major problems in managing and operating containers. Moreover, with the development of cloud computing, the biggest challenge in the cloud is to cope with container drift. Driven by this business need, k8s emerged, presenting a brand-new leading distributed architecture solution based on container technology, which is a major breakthrough and innovation in the development of the entire container technology field. However, k8s native systems usually cannot use multiple namespaces, so how to meet the current business requirements corresponding to multiple namespaces has become a key factor affecting users' enjoyment of network services.
[0045] It can be understood that the resource quota management method in this embodiment is a method for managing resource quotas based on k8s, so that when obtaining corresponding network services running in the Internet or established by users, that is, projects, a suitable running resource can be allocated to the project and quota management can be performed on the resource.
[0046] Specifically, obtain at least one project to be managed for resource quotas.
[0047] S12: Establish associations between at least one project and at least one namespace.
[0048] Furthermore, establish associations between at least one project and at least one namespace respectively. For example, the namespace uses specific tags or identifiers to establish associations with corresponding projects, so that in subsequent processing, projects associated with a certain namespace can be identified through the tags or identifiers.
[0049] It can be understood that one project can be associated with one or more namespaces, and one namespace can also be associated with one or more projects. This application does not make any restrictions on this.
[0050] It should be noted that this namespace, that is, namespace, also known as "name space", specifically refers to a form of code organization used by various languages in a software development platform to distinguish different code functions, and is also a part of the fully qualified name of all classes in the software development platform.
[0051] Namespaces are used to organize and reuse code. Just as the name implies, this concept was introduced because the number of words available to humans is limited, and it is inevitable that different people writing programs may have variable names that conflict. This problem is particularly severe for libraries. If two people write library files with the same variable or function names (which is inevitable), it will cause problems when using them. To solve this problem, the concept of namespaces was introduced. By using "namespace xxx", the library functions or variables you use are defined within that namespace, thus avoiding unnecessary conflicts.
[0052] Generally speaking, a namespace is a uniquely identified set of names, so there will be no ambiguity when objects come from different places but have the same name. When using Extensible Markup Language (XML), the namespace of XML (a subset of the Standard Generalized Markup Language) is the collection of all element categories and attributes. The names of element categories and attributes can be made unique through a unique XML namespace.
[0053] In XML, any element category or attribute is thus divided into two parts of a name, one part being the name within the namespace and the other being its local name. In XML, a namespace is usually the name of a Uniform Resource Identifier (URI). The URI is only used as a name. The main purpose is to avoid name conflicts.
[0054] After at least one project is associated with at least one namespace, each resource in the namespace, such as the quota information of pods (container sets) and pvcs (user storage requests), can be aggregated into the project associated with it, so that the corresponding quota information can be calculated based on this project subsequently.
[0055] It should be noted that a Pod is composed of one or more containers (such as Docker containers), and has the ability to share storage / network / UTS / PID, as well as the specification for running containers. And in Kubernetes, a Pod is the smallest schedulable atomic unit.
[0056] Generally speaking, a Pod is a collection of containers. The containers within a Pod share the network / storage (Kubernetes achieves this by sharing a set of Namespaces instead of each container having its own NS). Therefore, they can communicate internally through Localhost. Although the network and storage are shared, the CPU and Memory are not. Multiple containers can have their own Cgroups, which means we can individually limit the resource (MEM / CPU) usage of the containers within a Pod.
[0057] A PersistentVolumeClaim (PVC, user storage request) specifically refers to an application for a PV (Persistent Volume). PVCs are usually created and maintained by ordinary users. When storage resources need to be allocated to a Pod, a user can create a PVC, specifying information such as the capacity size and access mode (such as read-only) of the storage resources, and Kubernetes will search for and provide a PV that meets the conditions.
[0058] Among them, resource quotas limit the total amount of resources that pods and PVC storage in a namespace can use at most. At the same time, it can also limit the number of pods, PVCs, and other API (Application Programming Interface) objects that users are allowed to create in this namespace, because the resources we have dealt with the most so far are CPU (central processing unit) and memory.
[0059] S13: Load the items associated with at least one namespace into the first processing queue.
[0060] It is understandable that when multiple namespaces share the same cluster, it is possible that the resource quota used by a certain namespace exceeds its fair quota, resulting in the occupation of resources of other namespaces. Therefore, it is also necessary to calculate the resource quota corresponding to each item.
[0061] In order to calculate the resource quota for each item in an orderly manner, it is also necessary to load the items associated with at least one namespace into the first processing queue in sequence, so that the resource quota for each item can be calculated subsequently according to the loading order of the items in the first processing queue.
[0062] S14: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0063] Specifically, start at least one first thread and sequentially load at least one item in the first processing queue into at least one first thread.
[0064] It should be noted that a thread is the smallest unit that the operating system can perform operation scheduling. It is contained in a process and is the actual operating unit in the process. A thread refers to a single sequential control flow in a process. Multiple threads can be concurrent in a process, and each thread executes different tasks in parallel.
[0065] Multiple threads in the same process will share all system resources in the process, such as virtual address space, file descriptors, and signal handling, etc. However, multiple threads in the same process have their own call stacks, register contexts, and thread-local storage. A process can have many threads, and each thread executes different tasks in parallel.
[0066] Optionally, the first thread corresponding to the first processing queue may specifically include any reasonable number such as 3, 5, or 6, etc., and the present application does not limit this.
[0067] S15: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0068] Further, calculate the resource quota information of at least one item in the first processing queue sequentially through at least one first thread to track the resource usage of each item therein to ensure that it does not exceed the preset limit value of the resource quota.
[0069] In the above solution, by associating at least one item with at least one namespace, loading the item associated with at least one namespace into the first processing queue, and starting at least one first thread, and then loading at least one item in the first processing queue into at least one first thread, the resource quota information of at least one item in the first processing queue can be calculated through at least one first thread, so as to manage the resource quotas in multiple namespaces, and thus the business requirements corresponding to multiple namespaces currently can be realized.
[0070] Further, in an embodiment, after S11 and before S12 above, it may specifically further include: counting the first quota of the container sets sum in at least one namespace corresponding to at least one item.
[0071] It can be understood that before associating at least one item with at least one namespace, it is also necessary to first determine the total quota situation under all namespaces corresponding to all current items, so as to count the first quota of the container sets and user storage requests in at least one namespace corresponding to at least one item, to facilitate the association between the namespace and the corresponding item, and to obtain the quota information of each container set or user storage request in terms of the namespace.
[0072] Further, in one embodiment, after the above S15, it may specifically further include: reloading all currently obtained items into the first processing queue at every set time, and restarting at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0073] It can be understood that to prevent the situation where when there are changes in items, such as addition, deletion, or modification of items, or when there are changes in resource quotas in the items being processed and not being calculated in a timely manner by the corresponding at least one process, it is also possible to reload all currently obtained items into the first processing queue at every set time, overwrite the items currently stored in the first processing queue, and then restart at least one first thread, that is, perform a refresh calculation, so as to avoid the situation where corresponding changes are not detected or processed in a timely manner, resulting in the invalidation of the quota information of each item calculated currently.
[0074] Optionally, the set time may specifically be any reasonable duration such as 5 minutes, 6 minutes, or 10 minutes, and the present application does not limit this.
[0075] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of the second embodiment of the resource quota management method of the present application. The resource quota management method of this embodiment is Figure 1 a schematic flowchart of a refined embodiment of the resource quota management method in
[0076] S21: Obtain at least one item.
[0077] Among them, S21 is the same as Figure 1 S11 in
[0078] For details, please refer to S11 and its related textual descriptions, and will not be elaborated here.
[0079] It can be understood that after obtaining at least one item, in order to facilitate subsequent balanced resource allocation and resource quota calculation for each item, it is also necessary to first determine the total quota situation under all namespaces corresponding to all current items, so as to count the first quota of the container sets in at least one namespace corresponding to at least one item.
[0080] S23: Establish an association between at least one item and at least one namespace.
[0081] Among them, S23 is the same as Figure 1 S12 in
[0082] S24: Obtain the second quota of the container set sum in each namespace.
[0083] Specifically, after associating at least one item with at least one namespace, then obtain the second quota of the container set sum in each namespace through a data collector with the namespace as the dimension.
[0084] S25: Load the second quota into the item associated with the corresponding namespace.
[0085] Furthermore, load the obtained second quota into the item associated with the corresponding namespace, so that in the subsequent process, the second quota of the container set sum in the namespace corresponding to each item can be calculated through at least one first thread loaded correspondingly, that is, the quota information of each item is calculated.
[0086] S26: Load the item associated with at least one namespace into the first processing queue.
[0087] S27: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0088] S28: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0089] Among them, S26, S27, and S28 are the same as Figure 1 S13, S14, and S15 therein. For specific details, please refer to S13, S14, and S15 and their related textual descriptions, which will not be elaborated here.
[0090] Please refer to Figure 3 , Figure 3 is the flowchart of the third embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 1 the flowchart of a refined embodiment of the resource quota management method therein, including the following steps:
[0091] S31: Obtain at least one item.
[0092] S32: Associate at least one item with at least one namespace.
[0093] S33: Load the item associated with at least one namespace into the first processing queue.
[0094] S34: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0095] S35: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0096] Among them, S31, S32, S33, S34, and S35 are the same as Figure 1 S11, S12, S13, S14, and S15 in, for specific details, please refer to S11, S12, S13, S14, and S15 and their related text descriptions, which will not be elaborated here.
[0097] S36: Detect whether there is any item change currently.
[0098] It can be understood that when at least one item obtained currently changes, for example, when a new item is added, at least some items are deleted or modified, correspondingly, the resource quotas previously allocated to each item will also change, so it is necessary to recalculate.
[0099] Specifically, after calculating the resource quota information of at least one item in the first processing queue in sequence through at least one first thread, monitor in real time whether there is any item change currently.
[0100] Among them, if there is no item change, then execute S37; if there is a first item change, then execute S38.
[0101] S37: Keep monitoring the items.
[0102] It can be understood that when it is determined that there is no item change currently, it indicates that the resource quotas previously allocated to each item have not changed, and there is no need to recalculate the resource quota information of the items obtained currently. Just keep monitoring the items.
[0103] S38: Load the first item into the first processing queue.
[0104] It can be understood that when it is determined that there is a first item change currently, it is necessary to recalculate the resource quota information of the first item again, that is, load the first item into the first processing queue, so as to be able to execute S34 - S38 again and in sequence to respond to each item change and calculate the resource quota information of the changed first item.
[0105] Among them, the first item specifically refers to the part of the items that have changed based on the currently acquired items. It can be seen that when new items are specifically added, the newly added items are the first items; when items are modified, the modified items are the first items; but when items are deleted currently, the part of the items that are not deleted needs to be determined as the first items, so that the first items can be correspondingly loaded into the first processing queue and the resource quota information of the first items can be recalculated.
[0106] Please refer to Figure 4 , Figure 4 which is a schematic flowchart of the fourth embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 1 a schematic flowchart of a refined embodiment of the resource quota management method in
[0107] S41: Obtain at least one item.
[0108] S42: Establish an association between at least one item and at least one namespace.
[0109] S43: Load the items associated with at least one namespace into the first processing queue.
[0110] S44: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0111] S45: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0112] Among them, S41, S42, S43, S44, and S45 are the same as Figure 1 S11, S12, S13, S14, and S15 in
[0113] S46: Detect whether there is a container set and / or a change currently.
[0114] It can be understood that when the resource quotas have been correspondingly allocated for at least one item, for example, when there is a container set and / or a change, it indicates that the resource quotas of at least some items have changed. Therefore, find out the items whose resource quotas have changed and recalculate their resource quota information.
[0115] Specifically, after calculating the resource quota information of at least one item in the first processing queue through at least one first thread in sequence, monitor in real time whether there is a container set and / or a change currently.
[0116] Among them, if there is no container set and / or a change occurs, then S47 is executed; if there is a container set and / or a change occurs, then S48 is executed.
[0117] S47: Keep monitoring.
[0118] It can be understood that when it is determined that there is no container set and / or a change occurs currently, it indicates that the resource quotas previously allocated to each item have not changed, and there is no need to recalculate the resource quota information for the currently obtained item. Only the monitoring of the container set and / or needs to be kept.
[0119] S48: Detect whether the container set with changes and / or the corresponding namespace is associated with an item.
[0120] It can be understood that when it is determined that there is a container set and / or a change occurs, it indicates that the resource quotas of some items have changed currently, but it is also necessary to distinguish whether the item with changes currently is an item that has been associated with at least one namespace before.
[0121] Specifically, when it is determined that there is a container set and / or a change occurs, detect whether the container set with changes and / or the corresponding namespace is associated with at least one item obtained before.
[0122] Among them, if there is no item associated with the container set with changes and / or the corresponding namespace, then S49 is executed; if there is a second item associated with the container set with changes and / or the corresponding namespace, then S410 is executed.
[0123] S49: Do nothing.
[0124] Specifically, when it is determined that the container set with changes and / or the corresponding namespace is not associated with any item obtained before, no recalculation of the resource quota information is performed.
[0125] S410: Change the quota for the second item.
[0126] Specifically, when it is determined that there is a second item associated with the container set with changes and / or the corresponding namespace, change the quota for the second item, that is, load the changed resource quota, that is, summarize it into the second item object to facilitate subsequent calculation of the resource quota information for the second item.
[0127] S411: Load the second item with the quota changed into the first processing queue.
[0128] Further, load the second item after quota change into the first processing queue, so as to be able to re-execute S44 - S411 in sequence and loop, in response to each change of the container set and / or, calculate the resource quota information of the corresponding second item after quota change.
[0129] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of the fifth embodiment of the resource quota management method of the present application. The resource quota management method of this embodiment is Figure 1 a schematic flowchart of a refined embodiment of the resource quota management method in
[0130] S51: Obtain at least one item.
[0131] S52: Establish an association between at least one item and at least one namespace.
[0132] S53: Load the item associated with at least one namespace into the first processing queue.
[0133] S54: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0134] S55: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0135] Among them, S51, S52, S53, S54, and S55 are the same as Figure 1 S11, S12, S13, S14, and S15 in
[0136] S56: Receive a quota modification instruction input by the user to correspondingly modify the quota ceiling of at least one item.
[0137] It can be understood that when obtaining at least one item, each item therein is default set with a resource quota ceiling, that is, the resources allocated to each item will not exceed this resource quota ceiling. However, in actual network services, when there is an item that needs to exceed this resource quota ceiling to operate effectively, the user needs to perform corresponding specific adaptation modification operations.
[0138] Specifically, receive the quota modification instruction input by the user to correspondingly modify the quota ceiling of at least one item, so that each item can occupy more resource quotas.
[0139] S57: Load the third item with the modified quota limit into the second processing queue.
[0140] It can be understood that when determining the item with the modified quota limit as the third item, it can be known that the resource quota occupied by this third item, such as its limits in dynamic and static aspects, will also be inconsistent with the previous ones. Therefore, it is necessary to re - calculate the quota.
[0141] Specifically, load the third item with the modified quota limit into the second processing queue.
[0142] S58: Start at least one second - thread to load at least one third item in the second processing queue into at least one second - thread.
[0143] Furthermore, start at least one second - thread and sequentially load at least one third item in the second processing queue into at least one second - thread.
[0144] Optionally, the second - thread corresponding to the second processing queue can specifically include any reasonable number such as 3, 5, or 6, etc. This application does not make a limitation on this.
[0145] Optionally, the second processing queue can be the same as the first processing queue or another independent processing queue different from the first processing queue. This application does not make a limitation on this.
[0146] S59: Calculate the resource quota information of at least one third item in the second processing queue through at least one second - thread.
[0147] Even further, calculate the resource quota information of at least one third item in the second processing queue sequentially through at least one second - thread to track the resource usage of each of the third items.
[0148] Please refer to Figure 6 , Figure 6 is the flowchart of the sixth embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 1 the flowchart of a refined embodiment of the resource quota management method in
[0149] S61: Receive the registration request of the quota evaluation program to load the quota evaluation program into the loop computer.
[0150] It can be understood that in order to calculate the resource quota information of each obtained item in the subsequent process, it is also necessary to first load or establish a set of quota evaluation programs, such as, container set evaluation programs and / or evaluation programs.
[0151] Specifically, a registration request for a quota evaluation program corresponding to a user input is received, and then the quota evaluation program is loaded into the loop computer.
[0152] S62: Obtain at least one item.
[0153] S63: Associate at least one item with at least one namespace.
[0154] S64: Load the items associated with at least one namespace into a first processing queue.
[0155] Among them, S62, S63, and S64 are the same as S11, S12, and S13 in Figure 1 For details, please refer to S11, S12, and S13 and their related textual descriptions, which will not be elaborated here.
[0156] S65: The loop computer starts at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0157] Specifically, after loading the items associated with at least one namespace into the first processing queue, at least one first thread is then started in the loop computer to sequentially load at least one item in the first processing queue into at least one first thread.
[0158] S66: The loop computer calculates the resource quota information of at least one item in the first processing queue through at least one first thread based on the quota evaluation program.
[0159] Furthermore, after the loop computer is loaded with the quota evaluation program, it can calculate the resource quota information of at least one item in the first processing queue through at least one first thread based on the quota evaluation program to track the resource usage of each item therein to ensure that it does not exceed the preset limit value of the resource quota.
[0160] Please refer to Figure 7 , Figure 7 is a schematic flowchart of the seventh embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 1 a schematic flowchart of a refined embodiment of the resource quota management method in
[0161] S71: Obtain at least one item.
[0162] S72: Associate at least one item with at least one namespace.
[0163] Among them, S71 and S72 are the same as Figure 1S11 and S12 in it are the same. For details, please refer to S11 and S12 and their related text descriptions, which will not be elaborated here.
[0164] S73: Create a container set and a user storage request.
[0165] It is understandable that after associating at least one item with at least one namespace, in order to ensure the effective operation of each item, it is also necessary to allocate operating resources for each item correspondingly.
[0166] Specifically, create a container set with an appropriate amount of resources and a user storage request.
[0167] S74: Detect whether the currently created container set and user storage request exceed the quota limit of the project associated with the corresponding namespace.
[0168] It is understandable that after each container set is created, it corresponds to a namespace, and this namespace is correspondingly associated with a currently obtained project. The resources allocated to this project need to be restricted within its quota limit, that is, after the currently created container set and the resources already occupied by its corresponding project are combined, they cannot exceed the quota limit of its corresponding project.
[0169] Specifically, after creating the container set, detect whether the currently created container set and user storage request exceed the quota limit of the project associated with the corresponding namespace.
[0170] Among them, if the currently created container set and user storage request exceed the quota limit of the project associated with the corresponding namespace, then execute S75; if the currently created container set and user storage request do not exceed the quota limit of the project associated with the corresponding namespace, then execute S76.
[0171] S75: The current resource creation fails, and an error message indicating the creation failure is returned.
[0172] It is understandable that when the currently created container set and exceed the quota limit of the corresponding project, they cannot be allocated to this project correspondingly. Therefore, the current resource creation will also fail, and an error message indicating the creation failure needs to be returned correspondingly to inform the user.
[0173] S76: Update the quota usage information of the project associated with the corresponding namespace.
[0174] Specifically, when it is determined that the currently created container set and do not exceed the quota limit of the corresponding project, it is necessary to update the quota usage information of the project associated with the corresponding namespace, so as to be able to recalculate the resource quota information of this project.
[0175] S77: Load the items associated with at least one namespace into the first processing queue.
[0176] S78: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0177] S79: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0178] Among them, S77, S78, and S79 are the same as Figure 1 S13, S14, and S15 in
[0179] Please refer to Figure 8 , Figure 8 is the flowchart of the eighth embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 7 the flowchart of a refined embodiment of the resource quota management method in
[0180] S81: Obtain at least one item.
[0181] S82: Associate at least one item with at least one namespace.
[0182] Among them, S81 and S82 are the same as Figure 7 S71 and S72 in
[0183] S83: Obtain the container set and the user storage request.
[0184] Specifically, after associating at least one item with at least one namespace, obtain the container set and, to wait for the corresponding items respectively.
[0185] S84: Determine whether there are associated items in the container set and the corresponding namespace.
[0186] It can be understood that when there are associated items in the currently obtained container set and the corresponding namespace, they can be correspondingly allocated to the item, that is, effective allocation can be performed and creation can be obtained, otherwise it is regarded as invalid resources and creation is abandoned.
[0187] Specifically, after obtaining the container set and, further determine whether there are associated items in the container set and the corresponding namespace.
[0188] Among them, if there is no item associated with the currently obtained container set and the corresponding namespace, then S85 is executed; if there is an item associated with the currently obtained container set and the corresponding namespace, then S86 is executed.
[0189] S85: Do not perform resource creation.
[0190] It can be understood that when it is determined that there is no item associated with the currently created container set and the corresponding namespace, it indicates that the currently obtained container set cannot be effectively allocated, so resource creation needs not to be performed.
[0191] S86: Create a container set and a user storage request.
[0192] S87: Detect whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace.
[0193] S88: The current resource creation fails, and an error message indicating the creation failure is returned.
[0194] S89: Update the quota usage information of the item associated with the corresponding namespace.
[0195] S810: Load the item associated with at least one namespace into the first processing queue.
[0196] S811: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0197] S812: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0198] Among them, S86, S87, S88, S89, S810, S811, and S812 are the same as Figure 7 S73, S74, S75, S76, S77, S78, and S79 in. For details, please refer to S73, S74, S75, S76, S77, S78, and S79 and their related textual descriptions, which will not be elaborated here.
[0199] Please refer to Figure 9 , Figure 9 is the flowchart of the ninth embodiment of the resource quota management method of the present application. The resource quota management method of this embodiment is Figure 7 a flowchart of a refined embodiment of the resource quota management method in, including the following steps:
[0200] S91: Obtain at least one item.
[0201] S92: Associate at least one item with at least one namespace.
[0202] S93: Create a collection of containers and a user storage request.
[0203] Among them, S91, S92, and S93 are the same as Figure 7 S71, S72, and S73 in, for specific details, please refer to S71, S72, and S73 and their related textual descriptions, which will not be elaborated here.
[0204] S94: Load the items associated with the namespace corresponding to the currently created collection of containers and the user storage request into a third processing queue.
[0205] It can be understood that after associating at least one item with at least one namespace and correspondingly creating a collection of containers and a user storage request, it is also necessary to calculate the resource quota information of the items corresponding to this collection of containers and the user storage request.
[0206] Specifically, load the items associated with the namespace corresponding to the currently created collection of containers and the user storage request into a third processing queue.
[0207] S95: Start at least one third thread to load the items in the third processing queue into at least one third thread.
[0208] Furthermore, start at least one third thread and sequentially load the items in the third processing queue into at least one third thread.
[0209] Optionally, the third thread corresponding to the third processing queue may specifically include any reasonable number such as 3, 5, or 6, and this application does not limit this.
[0210] S96: Calculate the resource quota information of the items in the third processing queue through at least one third thread.
[0211] Even further, calculate the resource quota information of the items in the third processing queue sequentially through at least one third thread to track the resource usage of each of them to ensure that it does not exceed the preset limit value of the resource quota.
[0212] S97: Detect whether the currently created collection of containers and the user storage request exceed the quota upper limit of the items associated with their corresponding namespace.
[0213] S98: The current resource creation fails and returns an error message indicating the creation failure.
[0214] S99: Update the quota usage information of the items associated with its corresponding namespace.
[0215] S910: Load the items associated with at least one namespace into the first processing queue.
[0216] S911: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0217] S912: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0218] Among them, S96, S97, S98, S99, S910, S911, and S912 are the same as Figure 7 S73, S74, S75, S76, S77, S78, and S79 in
[0219] Please refer to Figure 10 , Figure 10 is the schematic flowchart of the tenth embodiment of the resource quota management method of this application. The resource quota management method of this embodiment is Figure 9 the schematic flowchart of a refined embodiment of the resource quota management method in
[0220] S101: Obtain at least one item.
[0221] S102: Associate at least one item with at least one namespace.
[0222] S103: Create a container set and a user storage request.
[0223] Among them, S101, S102, and S103 are the same as Figure 9 S91, S92, and S93 in
[0224] S104: Determine whether the items associated with the namespace corresponding to the currently created container set and user storage are being processed.
[0225] It can be understood that to ensure the orderly and effective calculation of resource quota information for multiple items, it is also necessary to determine whether the items currently requiring resource quota information calculation are being processed.
[0226] Specifically, after creating the container set and the user storage request, further determine whether the items associated with the namespace corresponding to the currently created container set and user storage are being processed.
[0227] Among them, if the project associated with the namespace corresponding to the currently created container set and the user storage is being processed, then S105 is executed; if the project associated with the namespace corresponding to the currently created container set and the user storage is not being processed, then S106 is executed.
[0228] S105: Load the project associated with the namespace corresponding to the currently created container set and the user storage into the first data queue, and after its processing is completed, transfer it to the second data queue.
[0229] Specifically, when it is determined that the project associated with the namespace corresponding to the currently created container set and the user storage is being processed, it can be first loaded into the first data queue, and after its processing is completed, transferred to the second data queue.
[0230] S106: Load the project associated with the namespace corresponding to the currently created container set and the user storage request into the second data queue.
[0231] Specifically, when it is determined that the project associated with the namespace corresponding to the currently created container set and the user storage is not being processed, the project associated with the namespace corresponding to the currently created container set and the user storage request can be successively loaded into the second data queue.
[0232] S107: Successively obtain the projects associated with the namespace corresponding to the currently created container set and the user storage request from the second data queue, and load them into the third processing queue.
[0233] Furthermore, successively obtain the projects associated with the namespace corresponding to the currently created container set and the user storage request from the second data queue, and load them into the third processing queue to wait for subsequent calculation of resource quota information for the projects in the third processing queue in sequence.
[0234] S108: Start at least one third thread to load the projects in the third processing queue into at least one third thread.
[0235] S109: Calculate the resource quota information of the projects in the third processing queue through at least one third thread.
[0236] S1010: Detect whether the currently created container set and the user storage request exceed the quota upper limit of the project associated with its corresponding namespace.
[0237] S1011: The current resource creation fails, and an error message indicating the creation failure is returned.
[0238] S1012: Update the quota usage information of the project associated with its corresponding namespace.
[0239] S1013: Load the items associated with at least one namespace into the first processing queue.
[0240] S1014: Start at least one first thread to load at least one item in the first processing queue into at least one first thread.
[0241] S1015: Calculate the resource quota information of at least one item in the first processing queue through at least one first thread.
[0242] Among them, S108, S109, S1010, S1011, S1012, S1013, S1014, and S1015 are the same as Figure 9 S95, S96, S97, S98, S99, S910, S911, and S912 in. For specific details, please refer to S95, S96, S97, S98, S99, S910, S911, and S912 and their related text descriptions, which will not be elaborated here.
[0243] Please refer to Figure 11 , Figure 11 is a schematic framework diagram of the first embodiment of the resource quota management system of the present application. The resource quota management system 111 includes: a custom controller 1111 for obtaining at least one item to associate at least one item with at least one namespace; a first processing queue 1112 for storing the items associated with at least one namespace loaded by the custom controller 1111; a loop computer 1113 for starting at least one first thread to load at least one item in the first processing queue 1112 into at least one first thread, and calculating the resource quota information of at least one item in the first processing queue 1112 through at least one first thread.
[0244] In the above solution, by associating at least one item with at least one namespace, loading the items associated with at least one namespace into the first processing queue 1112, and starting at least one first thread, and then loading at least one item in the first processing queue 1112 into at least one first thread to calculate the resource quota information of at least one item in the first processing queue 1112 through at least one first thread, it is possible to manage the resource quotas in multiple namespaces, thus meeting the business requirements corresponding to multiple namespaces currently.
[0245] In some embodiments, the custom controller 1111 may specifically further be used to: count the first quota of the sum of the container sets in at least one namespace corresponding to at least one item.
[0246] In some embodiments, the custom controller 1111 may specifically further be configured to: obtain the second quota of the container set in each namespace; and load the second quota into the project associated with the corresponding namespace.
[0247] In some embodiments, the custom controller 1111 may specifically further be configured to: detect whether there is a project change currently, and when a first project changes, load the first project into the first processing queue 1112, and re - execute the step of starting at least one first thread to load at least one project in the first processing queue 1112 into at least one first thread.
[0248] In some embodiments, the custom controller 1111 may specifically further be configured to: detect whether there is a change in the container set and / or, and when there is a change in the container set and / or, detect whether the changed container set and / or the corresponding namespace is associated with a project, and when the changed container set and / or the corresponding namespace is associated with a second project, perform a quota change on the second project; load the second project with the changed quota into the first processing queue 1112 to re - execute the step of starting at least one first thread to load at least one project in the first processing queue 1112 into at least one first thread.
[0249] In some embodiments, the custom controller 1111 may specifically further be configured to: receive a quota modification instruction input by the user to correspondingly modify the quota upper limit of at least one project; load the third project with the modified quota upper limit into the second processing queue; start at least one second thread to load at least one third project in the second processing queue into at least one second thread; and calculate the resource quota information of at least one third project in the second processing queue through at least one second thread.
[0250] In some embodiments, the custom controller 1111 may specifically further be configured to: receive a registration request of a quota evaluation program to load the quota evaluation program into the loop computer 1113; the loop computer 1113 starts at least one first thread to load at least one project in the first processing queue 1112 into at least one first thread; and the loop computer 1113 calculates the resource quota information of at least one project in the first processing queue 1112 through at least one first thread based on the quota evaluation program.
[0251] In some embodiments, the custom controller 1111 may specifically further be configured to: reload all the currently obtained projects into the first processing queue 1112 every set time, and re - execute the step of starting at least one first thread to load at least one project in the first processing queue 1112 into at least one first thread.
[0252] Please refer to Figure 12 , Figure 12 which is a schematic framework diagram of the second embodiment of the resource quota management system of the present application. The resource quota management system of this embodiment is based on the resource quota management system in Figure 11 , and the resource quota management system 121 further includes a resource creation controller 1214.
[0253] Specifically, the resource creation controller 1214 is used to create a container set and detect whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace, so as to update the quota usage information of the item associated with the corresponding namespace when the currently created container set and the user storage request do not exceed the quota upper limit of the item associated with the corresponding namespace.
[0254] In some embodiments, the resource creation controller 1214 may specifically also be used to: when the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace, the current resource creation fails and an error message indicating the creation failure is returned.
[0255] In some embodiments, the resource creation controller 1214 may specifically also be used to: obtain the container set and; determine whether there is an associated item in the namespace corresponding to the container set and, and when there is an associated item in the namespace corresponding to the container set and, perform the step of creating the container set and.
[0256] In some embodiments, the resource creation controller 1214 may specifically also be used to: load the item associated with the namespace corresponding to the currently created container set and the user storage request into a third processing queue; start at least one third thread to load the items in the third processing queue into at least one third thread; calculate the resource quota information of the items in the third processing queue through at least one third thread.
[0257] In some embodiments, the resource creation controller 1214 may specifically also be used to: determine whether the item associated with the namespace corresponding to the currently created container set and the user storage request is being processed, and when the item associated with the namespace corresponding to the currently created container set and the user storage request is being processed, load the item associated with the namespace corresponding to the currently created container set and the user storage request into a first data queue, and after its processing is completed, transfer it to a second data queue.
[0258] In some embodiments, the resource creation controller 1214 may specifically be further configured to: when the project associated with the namespace corresponding to the currently created container set and the user storage request is not being processed, load the project associated with the namespace corresponding to the currently created container set and the user storage request into the second data queue; sequentially obtain the project associated with the namespace corresponding to the currently created container set and the user storage request from the second data queue, and load it into the third processing queue.
[0259] It can be understood that in this embodiment, the custom controller 1211, the first processing queue 1212, and the loop computer 1213 are the same as the custom controller 1111, the first processing queue 1112, and the loop computer 1113 respectively. For details, please refer to Figure 11 the relevant text content, which will not be elaborated here.
[0260] Please refer to Figure 13 , Figure 13 which is a schematic framework diagram of the third embodiment of the resource quota management system of the present application.
[0261] It can be understood that in this embodiment, the resource quota management system specifically includes a project resource quota controller 131, a project resource quota client 132, a data center 133, a core resource interaction component 134, a project resource change monitor 135, a project management controller 136, a quota management controller 137, a first resource change controller 138, a project resource monitor 139, a first processing queue 1310, a second processing queue 1311, a first processing thread 1312, a second processing thread 1313, a loop calculator 1314, and a project resource registry 1315. The quota management controller 137 further includes a container set monitor 1371 and a user storage request monitor 1372, and the project resource registry 1315 further includes a container set evaluation program 13151 and a user storage request evaluation program 13152.
[0262] Among them, the project management controller 136 is configured to count the pod and pvc quotas in all namespaces under the currently obtained project. The namespace needs to be associated with each project through labels, so as to obtain the information of each pod or pvc in terms of the namespace through the evaluation program data collector, and finally summarize it into the project object.
[0263] It can be understood that the project data sources are specifically divided into the following three parts:
[0264] 1) Monitor the addition and modification actions of the project object through the project resource change monitor 135, and put the project into the first processing queue 1310;
[0265] 2) Monitor the updates and deletions of pods and pvcs through the project resource change monitor 135. If the corresponding namespace is associated with a project, put the project into the second processing queue 1311.
[0266] 3) Periodically resynchronize all currently obtained projects to put all project objects into the first processing queue 1310 and / or the second processing queue 1311.
[0267] Among them, the loop calculator 1314 is specifically a functional unit for obtaining the usage amount of each resource, and each resource has its own statistical method. For example, the processor can obtain it from the limit field of the pod, and the local area network statistical method is queried from other crds (Custom Resource Definition). The project resource registrar 1315 is to register the custom resource statistical methods, such as the container set evaluation program 13151 and the user storage request evaluation program 13152, into the loop calculator 1314, so that the loop calculator 1314 can calculate the corresponding resource quota information based on the container set evaluation program 13151 and the user storage request evaluation program 13152.
[0268] The project management controller 136 is used to add all current projects to the first processing queue 1310; the quota management controller 137 is used to add the projects associated with the namespaces corresponding to the changed resource quotas (pods, pvcs) to the second processing queue 1311 and obtain the resource quotas. The first processing queue 1310 is used to put the projects stored therein into the first processing thread 1312 for calculating resource quota information, and the upper limit of the resource quota corresponding to the projects in the first processing queue 1310 can be modified by the user. If the upper limit of the resource quota of a project is modified, its static and dynamic limits will be inconsistent and the quota needs to be recalculated; the second processing queue 1311 is used to put the projects stored therein into the second processing thread 1313 for calculating resource quota information; the first processing thread 1312 and the second processing thread 1313 are respectively used to calculate the resource quota information of the projects in the first processing queue 1310 and the second processing queue 1311, and specifically, 5 threads are default to handle concurrently.
[0269] Please continue to refer to Figure 14 , Figure 14 which Figure 13 is a schematic framework diagram of some functional units in the resource quota management system.
[0270] It is understandable that the resource quota management system further includes a resource creation controller 1316, a data queue 1317, a dirty data queue 1318, a third processing queue 1319, and a third processing thread 1320.
[0271] Among them, the resource creation controller 1316 is used to verify the resource creation process to prevent the created resources from exceeding the resource quota limit of the corresponding project. And for the creation of all resources, monitoring is required, and the corresponding projects are placed in the third processing queue 1319.
[0272] Specifically, the resource creation controller 1316 is used to judge newly created resources, such as pods and pvcs, etc., to determine whether admission checks are required. After the creation of an object, when it enters the resource creation controller 1316, there will be a dedicated third processing thread 1320 to process it, obtain the project in the namespace where it is located, and calculate the quota resource information. Under the custom resource project, whether the applied resources have exceeded the quota limit of the project. If exceeded, an error indicating creation failure is returned; if successful, the verification is passed, and the quota usage information in the project is updated.
[0273] The data queue 1317 is used to store projects that need to be processed; the dirty data queue 1318 is used to place a newly added project that is being processed at this time into the dirty data queue 1318, so that after execution, the projects in the dirty data queue 1318 are placed into the data queue 1317.
[0274] The third processing queue 1319 is used to verify whether the currently applied resources and the project statistical quota exceed the limit.
[0275] Please refer to Figure 15 , Figure 15 is a schematic framework diagram of an embodiment of the intelligent terminal of the present application. The intelligent terminal 141 includes a memory 1411 and a processor 1412 that are coupled to each other. The processor 1412 is used to execute program instructions stored in the memory 1411 to implement the steps of any of the above-mentioned resource quota management method embodiments.
[0276] In a specific implementation scenario, the intelligent terminal 141 may include, but is not limited to: a computer, a tablet computer, a smart phone, a smart watch, or any other reasonable intelligent terminal. The present application does not make any limitations in this regard.
[0277] Specifically, the processor 1412 is used to control itself and the memory 1411 to implement the steps of any of the above video display method embodiments. The processor 1412 may also be referred to as a CPU (Central Processing Unit). The processor 1412 may be an integrated circuit chip with signal processing capabilities. The processor 1412 may also be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Additionally, the processor 1412 may be implemented jointly by integrated circuit chips.
[0278] Please refer to Figure 16 , Figure 16 which is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application. The computer-readable storage medium 151 stores program instructions 1511 that can be run by a processor, and the program instructions 1511 are used to implement the steps of any of the above resource quota management method embodiments.
[0279] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0280] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0281] In addition, each functional unit in various embodiments of the present application may be integrated into one processing unit, may exist physically alone for each unit, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0282] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.
Claims
1. A method for managing resource quotas in multiple namespaces, characterized in that, the resource quota management method includes: obtaining at least one project; associating at least one of the projects with at least one namespace; loading the projects associated with at least one of the namespaces into a first processing queue; starting at least one first thread to load at least one of the projects in the first processing queue into at least one of the first threads; calculating, by at least one of the first threads, the resource quota information of at least one of the projects in the first processing queue.
2. The resource quota management method according to claim 1, characterized in that, after the step of obtaining at least one project and before the step of associating at least one of the projects with at least one namespace, it further includes: counting a first quota of a container set and a user storage request in at least one of the namespaces corresponding to at least one of the projects.
3. The resource quota management method according to claim 2, characterized in that, after the step of associating at least one of the projects with at least one namespace and before the step of loading the projects associated with at least one of the namespaces into a first processing queue, it further includes: obtaining a second quota of the container set and the user storage request in each of the namespaces; loading the second quota into the projects associated with the corresponding namespaces.
4. The resource quota management method according to claim 1, characterized in that, after the step of calculating, by at least one of the first threads, the resource quota information of at least one of the projects in the first processing queue, it further includes: detecting whether there is a change in any of the projects currently; in response to a change in a first project, loading the first project into the first processing queue and re-executing the step of starting at least one first thread to load at least one of the projects in the first processing queue into at least one of the first threads.
5. The resource quota management method according to claim 2, characterized in that, after the step of calculating, by at least one of the first threads, the resource quota information of at least one of the projects in the first processing queue, it further includes: detecting whether there is a change in the container set and / or the user storage request currently; in response to a change in the container set and / or the user storage request, detecting whether the namespace corresponding to the changed container set and / or the user storage request is associated with a project; in response to the namespace corresponding to the changed container set and / or the user storage request being associated with a second project, performing a quota change on the second project; loading the second project with the changed quota into the first processing queue to re-execute the step of starting at least one first thread to load at least one of the projects in the first processing queue into at least one of the first threads.
6. The resource quota management method according to claim 1, characterized in that, After the step of calculating the resource quota information of at least one of the items in the first processing queue by at least one of the first threads, the method further includes: Receiving a quota modification instruction input by a user to correspondingly modify the quota upper limit of at least one of the items; Loading a third item with a modified quota upper limit into a second processing queue; Starting at least one second thread to load at least one of the third items in the second processing queue into at least one of the second threads; Calculating the resource quota information of at least one of the third items in the second processing queue by at least one of the second threads.
7. The resource quota management method according to claim 1, wherein, before the step of obtaining at least one item, the method further includes: Receiving a registration request of a quota evaluation program to load the quota evaluation program into a loop computer; The step of starting at least one first thread to load at least one of the items in the first processing queue into at least one of the first threads includes: The loop computer starts at least one of the first threads to load at least one of the items in the first processing queue into at least one of the first threads; The step of calculating the resource quota information of at least one of the items in the first processing queue by at least one of the first threads includes: The loop computer calculates the resource quota information of at least one of the items in the first processing queue by at least one of the first threads based on the quota evaluation program.
8. The resource quota management method according to claim 1, wherein, after the step of calculating the resource quota information of at least one of the items in the first processing queue by at least one of the first threads, the method further includes: Reloading all the currently obtained items into the first processing queue at regular intervals, and re-executing the step of starting at least one first thread to load at least one of the items in the first processing queue into at least one of the first threads.
9. The resource quota management method according to claim 9, wherein, after the step of associating at least one of the items with at least one namespace and before the step of loading the item associated with at least one of the namespaces into the first processing queue, the method further includes: Creating a container set and a user storage request; Detecting whether the currently created container set and the user storage request exceed the quota upper limit of the item associated with the corresponding namespace; In response to the currently created container set and the user storage request not exceeding the quota upper limit of the item associated with the corresponding namespace, updating the quota usage information of the item associated with the corresponding namespace, and executing the step of loading the item associated with at least one of the namespaces into the first processing queue.
10. The resource quota management method according to claim 9, wherein, the resource quota management method includes: In response to the current created container set and the user storage request exceeding the quota upper limit of the project associated with the corresponding namespace, the current resource creation fails, and an error message indicating the creation failure is returned.
11. The resource quota management method according to claim 9, wherein, before the step of creating the container set and the user storage request, it further includes: obtaining the container set and the user storage request; judging whether there is an associated project in the namespace corresponding to the container set and the user storage request; in response to there being an associated project in the namespace corresponding to the container set and the user storage request, executing the step of creating the container set and the user storage request.
12. The resource quota management method according to claim 9, wherein, after the step of creating the container set and the user storage request, before the step of detecting whether the currently created container set and the user storage request exceed the quota upper limit of the project associated with the corresponding namespace, it further includes: loading the project associated with the namespace corresponding to the currently created container set and the user storage request into a third processing queue; starting at least one third thread to load the project in the third processing queue into at least one of the third threads; calculating the resource quota information of the project in the third processing queue through at least one of the third threads.
13. For the resource quota management method according to claim 12, before the step of loading the project associated with the namespace corresponding to the currently created container set and the user storage request into the third processing queue, it further includes: judging whether the project associated with the namespace corresponding to the currently created container set and the user storage request is being processed; in response to the project associated with the namespace corresponding to the currently created container set and the user storage request being in the process of being processed, loading the project associated with the namespace corresponding to the currently created container set and the user storage request into a first data queue, and after its processing is completed, transferring it to a second data queue.
14. The resource quota management method according to claim 13, wherein, the resource quota management method includes: in response to the project associated with the namespace corresponding to the currently created container set and the user storage request not being in the process of being processed, loading the project associated with the namespace corresponding to the currently created container set and the user storage request into a second data queue; the step of loading the project associated with the namespace corresponding to the currently created container set and the user storage request into the third processing queue includes: sequentially obtaining the project associated with the namespace corresponding to the currently created container set and the user storage request from the second data queue and loading it into the third processing queue.
15. A resource quota management system, characterized in that, the resource quota management system includes: a custom controller for obtaining at least one project to associate at least one of the projects with at least one namespace; a first processing queue for storing the projects associated with at least one of the namespaces loaded by the custom controller; a loop computer for starting at least one first thread to load at least one of the projects in the first processing queue into at least one of the first threads and calculate the resource quota information of at least one of the projects in the first processing queue through at least one of the first threads.
16. The resource quota management system according to claim 15, characterized in that, the resource quota management system further includes a resource creation controller, and the resource creation controller is used to create a container set and a user storage request, and detect whether the currently created container set and the user storage request exceed the quota upper limit of the project associated with the corresponding namespace, so as to update the quota usage information of the project associated with the corresponding namespace when the currently created container set and the user storage request do not exceed the quota upper limit of the project associated with the corresponding namespace.
17. An intelligent terminal, characterized in that, the intelligent terminal includes a memory and a processor coupled to each other, and the processor is used to execute program instructions stored in the memory to implement the resource quota management method according to any one of claims 1-14.
18. A computer-readable storage medium, on which program instructions are stored, characterized in that, when the program instructions are executed by a processor, the resource quota management method according to any one of claims 1-14 is implemented.
Citation Information
Patent Citations
Pod resource quota adjustment method and device, electronic equipment and storage medium
CN113268310A
Cluster resource allocation and recovery method and device, electronic equipment and storage medium
CN113377541A