A resource processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202210224786.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2042-03-07
AI Technical Summary
[0002]现有的超算平台大部分基于kubernetes构建,kubernetes本身只有namespace的概念,没有用户,企业项目等概念,企业将超算应用到生产中,资源很难较好的与公司内部的部门,项目等对应起来
[0042] Compared with the prior art, the technical solution provided in this application has the following advantages: When receiving a resource processing request initiated by the requester, this application will determine the target object to which the resource processing request belongs, and then query the target cluster corresponding to the target object, thereby establishing a correspondence between the target object and the target cluster, realizing decoupling between the cluster and the system, and improving the isolation and security of the overall system.
Smart Images

Figure CN114662086B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computing technology, and in particular to a resource processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Most existing supercomputing platforms are built on Kubernetes. Kubernetes itself only has the concept of namespaces, but not users, enterprise projects, etc. When enterprises apply supercomputing to production, it is difficult to properly map resources to internal departments and projects.
[0003] Most existing technologies adapt to enterprise-level concepts by developing new API interfaces for enterprise, project, and other related concepts. While this method can achieve the desired functionality, it is too tightly coupled with the existing system. When Kubernetes is upgraded, the newly added APIs must be modified and adapted accordingly, which can have a ripple effect. Summary of the Invention
[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides a resource processing method, apparatus, electronic device and storage medium.
[0005] According to one aspect of the embodiments of this application, a resource processing method is provided, including:
[0006] Obtain the resource processing request from the requester and determine the target object to which the requester belongs;
[0007] Obtain the target cluster corresponding to the target object;
[0008] Parse the resource processing request to determine the processing content carried by the resource processing request;
[0009] Within the target cluster, execute the resource processing operations indicated by the processing content.
[0010] Furthermore, within the target cluster, executing the resource processing operations indicated by the processing content includes:
[0011] When the processing content is used to instruct the creation of a resource, the field information for creating the resource is read from the processing content;
[0012] The callback function is invoked to create the target resource in the target cluster based on the field information, and the field information is stored when the creation of the target resource is detected to be complete.
[0013] Furthermore, after storing the field information, the method further includes:
[0014] Obtain the original access key corresponding to the requester;
[0015] The original access key is encrypted using the field information to obtain the encrypted first access key;
[0016] The first access key is stored in the storage system.
[0017] Furthermore, the method also includes:
[0018] Receive a key update request from the requesting party, wherein the key update request carries a second access key;
[0019] The second access key is verified, and if the second access key passes the verification, the first access key is updated using the second access key.
[0020] Furthermore, the method also includes:
[0021] Monitor the lifetime of the target resource;
[0022] If the generation time reaches the preset lifecycle corresponding to the target resource, a prompt message is generated and sent to the requester corresponding to the target resource.
[0023] Receive the change information fed back by the requesting party based on the prompt information;
[0024] Perform a change operation on the target resource according to the change information.
[0025] Furthermore, within the target cluster, executing the resource processing operations indicated by the processing content includes:
[0026] When the processing content is used to indicate access to resources, obtain the target role information corresponding to the requester;
[0027] Based on the correspondence between role information and permission information, the target permission information corresponding to the target role information is determined;
[0028] Based on the processing content, determine the target resource to be accessed by the requester from within the target cluster;
[0029] If the target permission information matches the target resource, resource information that satisfies the processing content is obtained from the target resource.
[0030] Furthermore, the method also includes:
[0031] Receive a permission configuration request, wherein the permission configuration request carries multiple role information;
[0032] In response to the permission configuration request, obtain multiple permission information;
[0033] Establish the correspondence between the role information and the permission information.
[0034] According to another aspect of the embodiments of this application, a resource processing apparatus is also provided, comprising:
[0035] The acquisition module is used to acquire resource processing requests from the requester and determine the target object to which the requester belongs;
[0036] The query module is used to obtain the target cluster corresponding to the target object;
[0037] The parsing module is used to parse the resource processing request and determine the processing content carried by the resource processing request;
[0038] The processing module is used to execute the resource processing operations indicated by the processing content within the target cluster.
[0039] According to another aspect of the embodiments of this application, a storage medium is also provided, the storage medium including a stored program that executes the above steps when the program is run.
[0040] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the programs stored in the memory.
[0041] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the above-described method.
[0042] Compared with the prior art, the technical solution provided in this application has the following advantages: When receiving a resource processing request initiated by the requester, this application will determine the target object to which the resource processing request belongs, and then query the target cluster corresponding to the target object, thereby establishing a correspondence between the target object and the target cluster, realizing decoupling between the cluster and the system, and improving the isolation and security of the overall system. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 A flowchart of a resource processing method provided in an embodiment of this application;
[0046] Figure 2 A block diagram of a resource processing device provided in an embodiment of this application;
[0047] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0050] This application provides a resource processing method, apparatus, electronic device, and storage medium. The method provided by this invention can be applied to any electronic device as needed, such as a server, terminal, or other electronic device. No specific limitation is made here, and for ease of description, it will be referred to as an electronic device below.
[0051] According to one aspect of the embodiments of this application, a method embodiment of a resource processing method is provided. Figure 1 A flowchart of a resource processing method provided in an embodiment of this application is shown below. Figure 1 As shown, the method includes:
[0052] Step S11: Obtain the resource processing request from the requester and determine the target object to which the requester belongs.
[0053] The method provided in this application embodiment is applied to a cache controller in a business system. It can receive resource processing requests from requesters through the cache controller's API server, and then obtain the requester's information, such as enterprise information or department information. Based on the requester information, it determines the target object to which the requester belongs; the target object can be an enterprise or department, etc.
[0054] Step S12: Obtain the target cluster corresponding to the target object.
[0055] In this embodiment of the application, the cache controller stores the correspondence between objects and clusters, and determines the target cluster corresponding to the target based on the correspondence. The target cluster may be a Kubernetes cluster.
[0056] In this embodiment of the application, in order to achieve resource isolation between different enterprises or different departments, before deploying resources in the cache controller, users can set the cluster corresponding to their object (enterprise / department) in the cache controller, and then establish the association between the object (enterprise / department) and the cluster. The association is stored in the cache controller so that other people in the same department or enterprise can use it directly when creating resources later.
[0057] Step S13: Parse the resource processing request and determine the processing content carried by the resource processing request.
[0058] In this embodiment, the cache controller parses the resource processing request to obtain the processing content carried by the request. This processing content can be either resource creation or resource access. It is understood that resource creation refers to the requester requesting the creation of a corresponding resource in the target cluster. Resource access refers to the requester requesting access to a resource in the target cluster to obtain the corresponding service.
[0059] Step S14: Within the target cluster, execute the resource processing operations indicated by the processing content.
[0060] In this embodiment of the application, step S14, within the target cluster, executes the resource processing operation indicated by the processing content, including the following steps A1-A2:
[0061] Step A1: If the processing content is used to indicate the creation of a resource, read the field information for creating the resource from the processing content.
[0062] Step A2: Call the callback function to create the target resource in the target cluster based on the field information, and store the field information when the creation of the target resource is detected to be complete.
[0063] In this embodiment, when the processing type is resource creation, the cache controller can directly read the field information used to create the resource from the processing content. For example, taking the creation of a user resource as an example, it will include a name field and a password resource. Subsequently, the cache controller can call a callback function to create the target resource in the target cluster based on the name field and the password resource.
[0064] In this embodiment of the application, when the cache controller detects that the target resource has been created in the target cluster, it stores field information. By storing the field information, the access key of the requester can be encrypted based on the field information in the future.
[0065] In this embodiment of the application, after storing the field information, the method further includes the following steps B1-B3:
[0066] Step B1: Obtain the original access key corresponding to the requester.
[0067] Step B2: Encrypt the original access key using the field information to obtain the encrypted first access key.
[0068] Step B3: Store the first access key in the storage system.
[0069] In this embodiment, the original access key corresponding to the requester is obtained. This original access key can be the key used by the user when initially creating the target resource. To ensure the security of the target resource, the cache controller, after storing the field information, encrypts the original access key using the field information to obtain an encrypted first access key. The first access key is then stored in the storage system. Simultaneously, the first access key is also fed back to the requester.
[0070] In this embodiment of the application, the method further includes the following steps C1-C2:
[0071] Step C1: Receive a key update request from the requester, wherein the key update request carries a second access key.
[0072] In this embodiment of the application, the requester may also initiate a key change request. The requester may include the second access key in the key update request and then send the key change request to the cache controller.
[0073] Step C2: Verify the second access key. If the second access key passes the verification, update the first access key using the second access key.
[0074] In this embodiment of the application, after receiving a key update request, the cache controller will query the storage system to see if there is a first access key associated with the requester. If there is a first access key, the second access key will be verified. If the second access key is verified, the first access key will be updated using the second access key.
[0075] In this embodiment of the application, the process of verifying the second access key includes: detecting the key format of the second access key; if the key format meets the preset key format, the second access key is determined to be verified. The key format includes: the character format of the characters carried by the key, the number of characters, etc.
[0076] In this embodiment of the application, the method further includes the following steps D1-D4:
[0077] Step D1: Monitor the lifetime of the target resource.
[0078] Step D2: If the generation time reaches the preset lifecycle corresponding to the target resource, generate a prompt message and send the prompt message to the requester corresponding to the target resource.
[0079] Step D3: Receive the change information from the requester based on the prompt message.
[0080] Step D4: Perform change operations on the target resource according to the change information.
[0081] In this embodiment, after the target resource is created, the cache controller also monitors the lifetime of the target resource. If the lifetime reaches the preset generation period corresponding to the target resource, a prompt message is generated. The preset generation period can be set by the requester when creating the target resource.
[0082] In this embodiment of the application, after the cache controller generates the prompt information, it will send the prompt information to the requester corresponding to the target resource. After receiving the prompt information, the receiver will feed back the change information to the cache controller according to the prompt information. The change information can be used to indicate that the target resource is deleted, or to indicate that the preset life time of the target resource is extended.
[0083] In this embodiment of the application, when the cache controller receives the change information from the requester, it will perform the corresponding change operation based on the change information.
[0084] In this embodiment of the application, step S14, within the target cluster, executes the resource processing operation indicated by the processing content, including the following steps E1-E4:
[0085] Step E1: If the processing content is used to indicate access to resources, obtain the target role information corresponding to the requester.
[0086] In this embodiment of the application, when the processing type is resource access type, the cache controller will obtain the target role information corresponding to the requester. The target role information can be the department role of the requester, such as: manager role, ordinary user role, etc.
[0087] Step E2: Based on the correspondence between role information and permission information, determine the target permission information corresponding to the target role information.
[0088] In this embodiment of the application, after determining the target role information of the requester, the target permission information corresponding to the target role information is determined based on the correspondence between role information and permission information. The target permission information may include: permission to use the target resource.
[0089] In this embodiment of the application, the method further includes the following steps F1-F3:
[0090] Step F1: Receive a permission configuration request, which carries multiple role information.
[0091] Step F2: In response to the permission configuration request, obtain multiple permission information.
[0092] Step F3: Establish the correspondence between role information and permission information.
[0093] As an example, roles can be categorized according to resource levels: cluster role, workspace role, and namespace role. Different roles define the resources that the role can currently access. First, ordinary users can only operate on resources within a specific namespace. Administrator roles can access all resources. Enterprise space administrator roles can manage all resources within their respective enterprise spaces.
[0094] In this embodiment of the application, by creating rights for each role, assigning different resource usage permissions to each role, and binding roles with permissions, the rights are ensured to remain within their limits.
[0095] Step E3: Determine the target resource to be accessed by the requester from within the target cluster based on the processing content.
[0096] Step E4: If the target permission information matches the target resource, process the target resource according to the processing content.
[0097] In this embodiment of the application, the cache controller can determine the target resource to be accessed by the requester from the target cluster according to the processing content, and then perform corresponding processing on the target resource according to the processing content, such as performing an upgrade operation on the target resource, or performing a deletion operation on the target resource, etc.
[0098] When this application embodiment receives a resource processing request initiated by the requester, it determines the target object to which the resource processing request belongs, and then queries the target cluster corresponding to the target object, thereby establishing a correspondence between the target object and the target cluster, realizing decoupling between the cluster and the system, and improving the isolation and security of the overall system.
[0099] Figure 2 This is a block diagram of a resource processing apparatus provided in an embodiment of this application. This apparatus can be implemented as part or all of an electronic device through software, hardware, or a combination of both. For example... Figure 2 As shown, the device includes:
[0100] The acquisition module 21 is used to acquire resource processing requests from the requester and determine the target object to which the requester belongs;
[0101] Query module 22 is used to obtain the target cluster corresponding to the target object;
[0102] Parsing module 23 is used to parse the resource processing request and determine the processing content carried by the resource processing request;
[0103] Processing module 24 is used to execute resource processing operations indicated by the processing content within the target cluster.
[0104] In this embodiment of the application, the processing module 24 is used to read field information for creating resources from the processing content when the processing content is to create resources; call a callback function to create target resources in the target cluster based on the field information; and store the field information when the creation of the target resources is detected to be complete.
[0105] In this embodiment of the application, the resource processing device further includes: an encryption module, used to obtain the original access key corresponding to the requester; encrypt the original access key using field information to obtain an encrypted first access key; and store the first access key in a storage system.
[0106] In this embodiment of the application, the resource processing device further includes: a change module, configured to receive a key update request from a requester, wherein the key update request carries a second access key; verify the second access key, and if the second access key passes the verification, update the first access key using the second access key.
[0107] In this embodiment of the application, the resource processing device further includes: a monitoring module, used to monitor the lifetime of the target resource; when the generation time reaches the preset lifetime period corresponding to the target resource, generate a prompt message and send the prompt message to the requester corresponding to the target resource; receive change information fed back by the requester based on the prompt message; and perform a change operation on the target resource according to the change information.
[0108] In this embodiment of the application, the processing module 24 is used to obtain the target role information corresponding to the requester when the processing content is accessing resources; determine the target permission information corresponding to the target role information based on the correspondence between role information and permission information; determine the target resource to be accessed by the requester from the target cluster according to the processing content; and process the target resource according to the processing content when the target permission information matches the target resource.
[0109] In this embodiment of the application, the resource processing device further includes: a creation module, configured to receive a permission configuration request, wherein the permission configuration request carries multiple role information; in response to the permission configuration request, obtain multiple permission information; and establish a correspondence between the role information and the permission information.
[0110] When this application embodiment receives a resource processing request initiated by the requester, it determines the target object to which the resource processing request belongs, and then queries the target cluster corresponding to the target object, thereby establishing a correspondence between the target object and the target cluster, realizing decoupling between the cluster and the system, and improving the isolation and security of the overall system.
[0111] This application also provides an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504, wherein the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504.
[0112] Memory 1503 is used to store computer programs;
[0113] When the processor 1501 executes the computer program stored in the memory 1503, it implements the steps of the above embodiments.
[0114] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0115] The communication interface is used for communication between the aforementioned terminal and other devices.
[0116] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0117] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0118] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the resource processing methods described in the above embodiments.
[0119] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the resource processing methods described in the above embodiments.
[0120] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive).
[0121] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
[0122] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A resource processing method, characterized in that, The method is applied to the cache controller in a business system, and the method includes: The cache controller's API server obtains resource processing requests from the requester and determines the target object to which the requester belongs. The mapping relationship between objects and clusters stored in the cache controller is queried to obtain the target cluster corresponding to the target object; the mapping relationship is pre-set and established by the target object before deploying resources, and is shared by all requesters under the same object; Parse the resource processing request to determine the processing content carried by the resource processing request; Within the target cluster, execute the resource processing operations indicated by the processing content; The execution of the resource processing operations indicated by the processing content within the target cluster includes: When the processing content is used to instruct the creation of a resource, the field information for creating the resource is read from the processing content; The callback function is invoked to create the target resource in the target cluster based on the field information, and the field information is stored when the creation of the target resource is detected to be complete. After storing the field information, the method further includes: Obtain the original access key corresponding to the requester; The original access key is encrypted using the field information to obtain an encrypted first access key, which is then sent back to the requesting party. Store the first access key in the storage system; The execution of the resource processing operations indicated by the processing content within the target cluster includes: When the processing content is used to indicate access to resources, obtain the target role information corresponding to the requester; Based on the correspondence between role information and permission information, the target permission information corresponding to the target role information is determined; the role information is divided according to resource level, including cluster-level roles, workspace-level roles, and namespace-level roles; Based on the processing content, determine the target resource to be accessed by the requester from within the target cluster; If the target permission information matches the target resource, resource information that satisfies the processing content is obtained from the target resource.
2. The method according to claim 1, characterized in that, The method further includes: Receive a key update request from the requesting party, wherein the key update request carries a second access key; The second access key is verified, and if the second access key passes the verification, the first access key is updated using the second access key.
3. The method according to claim 1, characterized in that, The method further includes: Monitor the lifetime of the target resource; When the survival time reaches the preset survival period corresponding to the target resource, a prompt message is generated and sent to the requester corresponding to the target resource; Receive the change information fed back by the requesting party based on the prompt information; Perform a change operation on the target resource according to the change information.
4. The method according to claim 1, characterized in that, The method further includes: Receive a permission configuration request, wherein the permission configuration request carries multiple role information; In response to the permission configuration request, obtain multiple permission information; Establish the correspondence between the role information and the permission information.
5. A resource processing apparatus, employing the method according to any one of claims 1-4, characterized in that, include: The acquisition module is used to acquire resource processing requests from the requester and determine the target object to which the requester belongs; The query module is used to obtain the target cluster corresponding to the target object; The parsing module is used to parse the resource processing request and determine the processing content carried by the resource processing request; The processing module is used to execute the resource processing operations indicated by the processing content within the target cluster.
6. A storage medium, characterized in that, The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1-4 when it is run.
7. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor for executing the method steps of any one of claims 1-4 by running a program stored in memory.
Citation Information
Patent Citations
Cloud edge cooperation system and cluster resource control method and device
CN112925647A