CN114661426A - Container management method and device, electronic equipment and storage medium - Google Patents

Container management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114661426A
CN114661426A CN202210454721.4A CN202210454721A CN114661426A CN 114661426 A CN114661426 A CN 114661426A CN 202210454721 A CN202210454721 A CN 202210454721A CN 114661426 A CN114661426 A CN 114661426A
Authority
CN
China
Prior art keywords
container
event
engine
target
control instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210454721.4A
Other languages
Chinese (zh)
Inventor
汤波
周晓庆
沈一帆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210454721.4A priority Critical patent/CN114661426A/en
Publication of CN114661426A publication Critical patent/CN114661426A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present disclosure provides a container management method, which can be applied to the container technical field, the financial field or other fields. The method comprises the following steps: responding to a trigger host machine access event, and acquiring a target host machine associated with the host machine access event, wherein the target host machine is configured with a container engine; writing the information of the container associated with the container engine into a memory to obtain a container information list; inserting a listener object as a consumer into a consumer queue associated with a container engine, wherein the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine if the container change event is generated; and in response to receiving the container event notification, processing a list of container information based on the container change event carried in the container event notification. In addition, the disclosure also provides a container management device, an electronic device and a storage medium.

Description

Container management method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of container technology and the field of finance, and more particularly, to a container management method, a container management apparatus, an electronic device, a storage medium, and a program product.
Background
Container technology can package all necessary components needed to run an application as one mirror image to run the application and its dependent items in a resource isolation process, and containers are increasingly applied in the application development process due to their standardized and easily portable nature. With the development of computer technology and container technology, multiple containers need to be managed in the application development process.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: in the related art, when the container is managed, a plurality of requests need to be converted, the communication link is long, and the execution efficiency is low.
Disclosure of Invention
In view of the above, the present disclosure provides a container management method, a container management apparatus, an electronic device, a readable storage medium, and a computer program product.
One aspect of the present disclosure provides a container management method, including: responding to a trigger host machine access event, and acquiring a target host machine associated with the host machine access event, wherein the target host machine is configured with a container engine; writing the information of the container associated with the container engine into a memory to obtain a container information list; inserting a listener object as a consumer into a consumer queue associated with the container engine, wherein the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine if the container change event is generated; and in response to receiving the container event notification, processing the container information list based on a container change event carried in the container event notification.
According to an embodiment of the present disclosure, the processing the container information list based on the container change event carried in the container event notification in response to receiving the container event notification includes: in response to receiving the container event notification, analyzing the container event notification to obtain the container change event; under the condition that the event type of the container changing event is determined to be a preset type, target container information is obtained from the container information list; and adjusting the target container information based on the container change event.
According to an embodiment of the present disclosure, the preset types of container change events include a container creation event, a container death event, a container destruction event, and a container restart event.
According to an embodiment of the present disclosure, the method further comprises: receiving a first control instruction for a target container from the target host; determining a target container engine related to the target container from the container information list; processing the first control instruction based on the type of the target container engine to obtain a second control instruction; and loading the second control instruction into the target container engine, wherein the target container engine executes the second control instruction for the first target container, generating the container change event.
According to an embodiment of the present disclosure, the types of the target container engine include a generic container engine and a custom container engine; wherein the processing the first control instruction based on the type of the target container engine to obtain a second control instruction comprises: determining that the second control instruction is the first control instruction when the type of the target container engine is the general container engine; and processing the first control instruction based on an interface rule of the target container engine to obtain the second control instruction under the condition that the type of the target container engine is the custom container engine.
According to an embodiment of the present disclosure, the method further comprises: in response to triggering a timing task, processing the container information list with information of a container associated with a container engine configured by the target host to perform information synchronization on the container information list.
Another aspect of the present disclosure provides a container management apparatus including: the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for responding to a trigger host access event and acquiring a target host associated with the host access event, and the target host is configured with a container engine; the storage module is used for writing the information of the container associated with the container engine into a memory to obtain a container information list; a first processing module, configured to insert a listener object as a consumer into a consumer queue associated with the container engine, where the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine when the container change event is generated; and the second processing module is used for responding to the received container event notification and processing the container information list based on the container change event carried in the container event notification.
Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the disclosure provides a computer program product comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, when a host machine is accessed, a container information list of a container configured in the host machine is established in a memory, and when a user utilizes the host machine to carry out container operation and maintenance management, the information and the state of the container can be acquired through the container information list, so that the efficiency of the container operation and maintenance management is improved; by inserting the listener object into the consumer queue of the container engine, when a container change event is monitored, the information in the container information list can be adjusted according to the container change event, so that the access frequency of the container during the operation and maintenance management of the container is reduced. Through the technical means, the technical problems that a plurality of request conversions need to be completed when the container is managed in the related art, the communication link is long, and the execution efficiency is low are at least partially solved, so that the efficiency of the operation and maintenance management of the container is effectively improved, and the resource consumption is reduced.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an exemplary system architecture to which the container management method and apparatus may be applied, according to an embodiment of the present disclosure.
Fig. 2 schematically shows a flow chart of a container management method according to an embodiment of the present disclosure.
Fig. 3 schematically illustrates a flow chart of a container management method according to another embodiment of the present disclosure.
Fig. 4 schematically illustrates a schematic diagram of a container management system according to an embodiment of the disclosure.
Fig. 5 schematically illustrates a block diagram of a container management apparatus according to an embodiment of the present disclosure.
Fig. 6 schematically shows a block diagram of an electronic device adapted to implement a container management method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
While cloud computing is developed greatly, as computer technology is developed, unified specifications required by application development and original development modes are disorderly and become major obstacles for pursuing progress. In the related art, a container is often used to solve problems existing in the application development stage. However, as the application scale becomes larger, the logic becomes more complex, the iterative update becomes more frequent, and a plurality of containers need to be inevitably used and managed in the application development stage.
K8S (kubernets) is an open source system for automated deployment, scaling, and management of containerized applications, and Docker is an open source containerization platform that can package and containerize applications and dependencies. In the related art, along with the standardization and ecological diversification of containers, the container market, including K8S, is gradually becoming a trend of discarding Docker, and a large number of heterogeneous containers are emerging in the container market. Such as: safety containers, functionally enhanced rich containers, efficient serverless containers, and the like, the diversity and diversification of demand makes heterogeneous containers more market-advantageous. However, for management of different container runtimes, namely, software which complies with the oci (open container initiative) standard and realizes basic functions of containers, images and the like, a general container management method is lacking in the related art.
The container engine can be a component for adapting a container Runtime interface, and for K8S, the interface of the container Runtime it proposes is a CRI (Container Runtime interface) interface, and the container engine adapting the interface includes docker-shim and rkt-shim. Since K8S is a dimension management container based on a namespace, a template, etc., but is limited by the function restriction of K8S, the container engine has the problems that it is difficult to obtain the personalized information of the container during the container management, and the container life cycle cannot be managed and operated. Meanwhile, the K8S is used for managing the loss of the performance of the container on a single host machine, multiple request conversion needs to be completed through a Master node, the communication link is long, and the execution efficiency is low.
In view of this, embodiments of the present disclosure provide a container management method, which may complete interaction with a container engine through a localized interface manner, ensure real-time synchronization of container state information, and implement management and operation and maintenance of a container. Specifically, the method comprises the following steps: responding to a trigger host machine access event, and acquiring a target host machine associated with the host machine access event, wherein the target host machine is configured with a container engine; writing the information of the container associated with the container engine into a memory to obtain a container information list; inserting a listener object as a consumer into a consumer queue associated with a container engine, wherein the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine if the container change event is generated; and, in response to receiving the container event notification, altering the event handling container information list based on the container carried in the container event notification.
It should be noted that the container management method and apparatus determined by the embodiments of the present disclosure may be used in the container technical field or the financial field, and may also be used in any field other than the container technical field and the financial field.
Fig. 1 schematically illustrates an exemplary system architecture to which the container management method and apparatus may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105.
The terminal devices 101, 102, 103 may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired and/or wireless communication links, and so forth.
The server 105 may be any type of server including, but not limited to, a backend server, a proxy server, a cloud server, and the like.
It should be noted that the container management method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the container management apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. Alternatively, the container management method provided by the embodiment of the present disclosure may also be executed by the terminal device 101, 102, or 103, or may also be executed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the container management apparatus provided in the embodiments of the present disclosure may also be disposed in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103.
For example, any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto) may be installed with a container management tool, and the container management tool may be implemented based on the container management method provided in the embodiments of the present disclosure, and with the container management tool, the terminal device 101 may implement operation and maintenance management on a container engine and a container configured in the terminal device 101, and may also implement operation and maintenance management on a container engine and a container configured in the terminal device 102, 103 or the server 105 through the network 104. Alternatively, the container management tool may be installed on the server 105, and the user may control the container management tool in the server 105 through any one of the terminal devices 101, 102, or 103 by using the network 104, so as to implement operation and maintenance management on the container engine and the container configured in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically shows a flow chart of a container management method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S204.
It should be noted that, unless explicitly stated that there is an execution sequence between different operations or there is an execution sequence between different operations in technical implementation, the execution sequence between multiple operations may not be sequential, or multiple operations may be executed simultaneously in the flowchart in this disclosure.
In operation S201, in response to a trigger host access event, a target host associated with the host access event is acquired. The target host is configured with a container engine.
In operation S202, information of a container associated with the container engine is written into the memory, and a container information list is obtained.
In operation S203, a listener object, which is a consumer, is inserted into a consumer queue associated with the container engine. The container engine, upon generating a container change event, sends a container event notification carrying the container change event to all consumers in the consumer queue associated with the container engine.
In operation S204, in response to receiving the container event notification, the event handling container information list is changed based on the container carried in the container event notification.
According to embodiments of the present disclosure, a host may be assigned an electronic device configured with any number of container engines and containers.
According to an embodiment of the present disclosure, a host access event may refer to an event triggered when the container management method according to an embodiment of the present disclosure is implemented in a target host, or may refer to an event triggered when an electronic device configured with the container management method according to an embodiment of the present disclosure performs operation and maintenance management on the target host.
According to embodiments of the present disclosure, the container engine configured in the target host may be any component that supports a CRI interface, including but not limited to rkt, pouch, contiinerd, CRI-o, and the like.
According to the embodiment of the present disclosure, the containers associated with the container engine may include containers of standard structures such as sequence containers, associative containers, and non-sequential containers, and may also include heterogeneous containers such as secure containers, rich containers, and no service containers. Each container engine may be associated with one or more containers.
According to an embodiment of the present disclosure, the memory may refer to an internal memory of a target host, or may refer to an internal memory of an electronic device that performs operation and maintenance management on the target host, which is not limited herein.
According to an embodiment of the present disclosure, the information of the container may include information of an ID of the container, a name of the container, a resource occupation amount of the container, an operation state of the container, and the like. The type and number of the container information that may be included in the container information list may be set according to a specific application scenario, and are not limited herein.
According to embodiments of the present disclosure, for each container engine, each container associated with the container engine may be added as a consumer to a consumer queue. In the case where any one of the containers associated with the container engine is changed, for example, the container fails due to the end of a life cycle, the container fails due to cluster upgrade, the container changes the operating state due to an external instruction, and the like, the container engine may generate a container change event and send a notification carrying the container change event to all the consumers in the consumer queue.
According to an embodiment of the present disclosure, processing the container information list based on the container change event may be to modify container information of any item in the container information list. For example, the state information of the container in the container information list may be modified according to the state of the container that has been changed.
According to the embodiment of the disclosure, when a host machine is accessed, a container information list of a container configured in the host machine is established in a memory, and when a user uses the host machine to carry out container operation and maintenance management, the information and the state of the container can be acquired through the container information list, so that the efficiency of the container operation and maintenance management is improved; by inserting the monitoring object into the consumer queue of the container engine, when a container change event is monitored, the information in the container information list can be adjusted according to the container change event, so that the access frequency of the container during the operation and maintenance management of the container is reduced. Through the technical means, the technical problems that a plurality of requests need to be converted when the container is managed in the related technology, the communication link is long, and the execution efficiency is low are at least partially solved, so that the efficiency of operation and maintenance management of the container is effectively improved, and the resource consumption is reduced.
The method shown in fig. 2 is further described with reference to fig. 3-4 in conjunction with specific embodiments.
According to embodiments of the present disclosure, the container engine may be used to manage containers using an interface associated with K8S.
According to an embodiment of the present disclosure, operation S204 may include the following operations:
analyzing the container event notification to obtain a container change event in response to receiving the container event notification; under the condition that the event type of the container changing event is determined to be a preset type, target container information is stored in the container information list; and adjusting the target container information based on the container change event.
According to an embodiment of the present disclosure, the container change event is classified according to an event type, and the container change event may be a container query event, a container stop event, a container refresh event, a container death event, a container restart event, or the like.
According to embodiments of the present disclosure, preset types of container change events may include container creation events, container death events, container destruction events, and container restart events.
According to an embodiment of the present disclosure, for a non-preset type of container change event, no response may be made to the container event notification, that is, no adjustment may be made to the container information list when a container event notification regarding a non-preset type of container change event is received.
In the embodiment of the present disclosure, the container change event may be triggered by factors such as a control policy and a life cycle of the container itself, or may be triggered by an external instruction.
Fig. 3 schematically illustrates a flow chart of a container management method according to another embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S305.
In operation S301, a first control instruction for a target container is received from a target host.
In operation S302, a target container engine related to the target container is determined from the container information list.
In operation S303, the first control instruction is processed based on the type of the target container engine, resulting in a second control instruction.
In operation S304, a second control instruction is loaded into the target container engine. And the target container engine executes the second control instruction aiming at the first target container and generates a container change event.
In operation S305, in response to receiving the container event notification, the event handling container information list is changed based on the container carried in the container event notification.
According to the embodiment of the disclosure, the first control instruction may be a control instruction input by a user in the target host machine, or may also be a control instruction input by the user on other electronic devices, and the control instruction may be transmitted to the target host machine through interfaces such as socket and http. The first control instruction may be implemented based on any programming language, and is not limited herein.
According to embodiments of the present disclosure, the types of target container engines include a generic container engine and a custom container engine. A generic container engine may refer to a container engine for managing standard structured containers and a custom container engine may refer to a container engine for managing heterogeneous containers.
According to an embodiment of the present disclosure, operation S303 may include the operations of:
determining that the second control instruction is the first control instruction under the condition that the type of the target container engine is the universal container engine; and processing the first control instruction based on the interface rule of the target container engine to obtain a second control instruction under the condition that the type of the target container engine is the custom container engine.
According to an embodiment of the present disclosure, processing the first control instruction based on the interface rule of the target container engine may include: based on the supported program language of the target container engine, the program language is used for recompiling the first control instruction aiming at the semantic information of the first control instruction to obtain a second control instruction; may also include: and recompiling the first control instruction by utilizing the difference between the interface of the target container engine and the interface of the universal container engine to obtain a second control instruction.
According to the embodiment of the disclosure, the management of the heterogeneous container can be realized by processing the control instruction by using the interface rule, and the universality of the operation and maintenance management of the container is improved.
Fig. 4 schematically illustrates a schematic diagram of a container management system according to an embodiment of the disclosure.
As shown in fig. 4, in a container management system 400, a container management tool 410 may implement management of multiple container engines 420, where each container engine 420 may manage multiple containers 430. The container management system 400 may be deployed on a host 440.
The container management tool 410 may include an interface services module 401, a scheduling module 402, an execution module 403, and a monitoring module 404.
The interface service module 401 may provide various call interfaces such as socket and http, and the host 440 may input an external control instruction into the container management tool 410 through the call interface provided by the interface service module 401. The external control command may perform functions including, but not limited to, querying container details, adding a container, deleting a container, keeping a container alive, changing a container status, and the like.
The interface service module 401 may further include an authority authentication sub-module, and when the host 440 accesses the interface service module 401, the authority authentication sub-module may initiate access authority authentication, and allow the host 440 to use the call interface when the host 440 passes the access authority authentication.
The scheduling module 402 may, when accessing the host 440, extract information of the container engine 420 and the container 430 configured in the host 440, so as to establish a container information list in the memory; meanwhile, the scheduling module 403 may create and initialize a corresponding number and type of execution modules 403 and a corresponding number of monitoring modules 404 based on the number and type of container engines 420.
After the initialization of the execution module 403 is completed, the scheduling module 402 may also periodically call the execution module 403 to acquire information of the container 430 and implement reconciliation on the container information list based on the acquired information, and specifically, may process the container information list with information of the container 430 associated with the container engine 420 configured by the host 440 in response to triggering a timing task to perform information synchronization on the container information list.
The execution module 403 may implement adaptation and interface translation for different types of container engines 420. That is, before the external control command is input into the container engine 420, the external control command may be processed by the execution module 403 to obtain a control command suitable for the container engine 420 to execute.
The execution module 403 may support a common container engine facing the CRI interface, and may also support a custom container engine facing the custom interface, such as a butt joint connection consistent.
The monitoring module 404, upon initialization, establishes a snoop in the container engine 420 regarding container 430 related events. In particular, the monitoring module 404 may implement the listening of the container engine 420 by means of the notification mechanism of the container engine 420 as a consumer in the consumer queue of the corresponding container engine 420. The monitoring module 404 may notify the scheduling module 402 upon listening for a container change event. The scheduling module 402 may filter the container change event, and after the container change event passes the filtering, the scheduling module 402 may use the container change event to adjust the container information list.
Fig. 5 schematically illustrates a block diagram of a container management apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, the container management apparatus 500 includes an acquisition module 510, a storage module 520, a first processing module 530, and a second processing module 540.
An obtaining module 510, configured to, in response to a host access triggering event, obtain a target host associated with the host access event, where the target host is configured with a container engine.
The storage module 520 is configured to write information of a container associated with the container engine into a memory, so as to obtain a container information list.
A first processing module 530, configured to insert a listener object as a consumer into a consumer queue associated with a container engine, where the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine in a case that the container change event is generated.
And the second processing module 540 is configured to, in response to receiving the container event notification, process the container information list based on the container change event carried in the container event notification.
According to the embodiment of the disclosure, when a host machine is accessed, a container information list of a container configured in the host machine is established in a memory, and when a user uses the host machine to carry out container operation and maintenance management, the information and the state of the container can be acquired through the container information list, so that the efficiency of the container operation and maintenance management is improved; by inserting the monitoring object into the consumer queue of the container engine, when a container change event is monitored, the information in the container information list can be adjusted according to the container change event, so that the access frequency of the container during the operation and maintenance management of the container is reduced. Through the technical means, the technical problems that a plurality of requests need to be converted when the container is managed in the related technology, the communication link is long, and the execution efficiency is low are at least partially solved, so that the efficiency of operation and maintenance management of the container is effectively improved, and the resource consumption is reduced.
According to an embodiment of the present disclosure, the second processing module 540 includes a first processing unit, a second processing unit, and a third processing unit.
And the first processing unit is used for responding to the received container event notification, analyzing the container event notification and obtaining a container change event.
And the second processing unit is used for obtaining the target container information from the container information list under the condition that the event type of the container changing event is determined to be a preset type.
And the third processing unit is used for adjusting the target container information based on the container change event.
According to an embodiment of the present disclosure, the preset types of container change events include a container creation event, a container death event, a container destruction event, and a container restart event.
According to an embodiment of the present disclosure, the container management apparatus 500 further includes a receiving module, a determining module, a third processing module, and a loading module.
The receiving module is used for receiving a first control instruction aiming at the target container from the target host machine.
And the determining module is used for determining a target container engine related to the target container from the container information list.
And the third processing module is used for processing the first control instruction based on the type of the target container engine to obtain a second control instruction.
And the loading module is used for loading the second control instruction into the target container engine, wherein the target container engine executes the second control instruction aiming at the first target container and generates a container change event.
According to embodiments of the present disclosure, the types of target container engines include a generic container engine and a custom container engine.
According to an embodiment of the present disclosure, the third processing module includes a fourth processing unit and a fifth processing unit.
And the fourth processing unit is used for determining that the second control instruction is the first control instruction under the condition that the type of the target container engine is the universal container engine.
And the fifth processing unit is used for processing the first control instruction based on the interface rule of the target container engine under the condition that the type of the target container engine is the custom container engine to obtain a second control instruction.
According to an embodiment of the present disclosure, the container management device 500 further includes a fourth processing module.
And the fourth processing module is used for responding to the triggering timing task and processing the container information list by utilizing the information of the container associated with the container engine configured by the target host machine so as to perform information synchronization on the container information list.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or the same in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations of software, hardware, and firmware, or in any suitable combination of any several of them. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be implemented at least partly as a computer program module, which when executed, may perform a corresponding function.
For example, any number of the obtaining module 510, the storing module 520, the first processing module 530 and the second processing module 540 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the obtaining module 510, the storing module 520, the first processing module 530 and the second processing module 540 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware by any other reasonable manner of integrating or packaging a circuit, or may be implemented in any one of three implementations of software, hardware and firmware, or in a suitable combination of any of them. Alternatively, at least one of the obtaining module 510, the storing module 520, the first processing module 530 and the second processing module 540 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.
It should be noted that the container management apparatus portion in the embodiment of the present disclosure corresponds to the container management method portion in the embodiment of the present disclosure, and the description of the container management apparatus portion specifically refers to the container management method portion, which is not described herein again.
Fig. 6 schematically shows a block diagram of an electronic device adapted to implement a container management method according to an embodiment of the present disclosure. The electronic device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, a computer electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include on-board memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 600 may also include input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604, according to an embodiment of the disclosure. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be embodied in the devices/apparatuses/systems described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the method of container management provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 601, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 609, and/or installed from the removable medium 611. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A method of container management, comprising:
responding to a trigger host machine access event, and acquiring a target host machine associated with the host machine access event, wherein the target host machine is configured with a container engine;
writing the information of the container associated with the container engine into a memory to obtain a container information list;
inserting a listener object as a consumer into a consumer queue associated with the container engine, wherein the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine if the container change event is generated; and
in response to receiving the container event notification, processing the container information list based on a container change event carried in the container event notification.
2. The method of claim 1, wherein the processing the list of container information based on a container change event carried in the container event notification in response to receiving the container event notification comprises:
in response to receiving the container event notification, analyzing the container event notification to obtain the container change event;
under the condition that the event type of the container changing event is determined to be a preset type, target container information is obtained from the container information list; and
adjusting the target container information based on the container change event.
3. The method of claim 2, wherein the preset types of container change events include a container creation event, a container death event, a container destruction event, and a container restart event.
4. The method of claim 1, further comprising:
receiving a first control instruction for a target container from the target host;
determining a target container engine related to the target container from the container information list;
processing the first control instruction based on the type of the target container engine to obtain a second control instruction; and
loading the second control instruction into the target container engine, wherein the target container engine executes the second control instruction for the first target container, generating the container change event.
5. The method of claim 4, wherein the types of target container engines include a generic container engine and a custom container engine;
wherein the processing the first control instruction based on the type of the target container engine to obtain a second control instruction comprises:
determining that the second control instruction is the first control instruction when the type of the target container engine is the general container engine; and
and processing the first control instruction based on an interface rule of the target container engine to obtain the second control instruction under the condition that the type of the target container engine is the custom container engine.
6. The method of claim 1, further comprising:
in response to triggering a timing task, processing the container information list with information of a container associated with a container engine configured by the target host to perform information synchronization on the container information list.
7. A container management apparatus comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for responding to a trigger host access event and acquiring a target host associated with the host access event, and the target host is configured with a container engine;
the storage module is used for writing the information of the container associated with the container engine into a memory to obtain a container information list;
a first processing module, configured to insert a listener object as a consumer into a consumer queue associated with the container engine, where the container engine sends a container event notification carrying a container change event to all consumers in the consumer queue associated with the container engine when the container change event is generated; and
and the second processing module is used for responding to the received container event notification and processing the container information list based on the container change event carried in the container event notification.
8. An electronic device, comprising:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.
10. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 6 when executed.
CN202210454721.4A 2022-04-26 2022-04-26 Container management method and device, electronic equipment and storage medium Pending CN114661426A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210454721.4A CN114661426A (en) 2022-04-26 2022-04-26 Container management method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210454721.4A CN114661426A (en) 2022-04-26 2022-04-26 Container management method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114661426A true CN114661426A (en) 2022-06-24

Family

ID=82037062

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210454721.4A Pending CN114661426A (en) 2022-04-26 2022-04-26 Container management method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114661426A (en)

Similar Documents

Publication Publication Date Title
US11159411B2 (en) Distributed testing service
WO2018137564A1 (en) Service processing method and apparatus
US9182975B2 (en) Automatic application updates
US20220188170A1 (en) Multi-Tenant Control Plane Management on Computing Platform
EP2553587B1 (en) Mapping rdma semantics to high speed storage
US9678767B2 (en) Unified extensible firmware interface (UEFI) driver and protocol
US9519600B2 (en) Driver shimming
US20150012669A1 (en) Platform runtime abstraction
CN107291481A (en) A kind of component update method, device and system
CN112930530B (en) Client application for network application execution
EP4414836A1 (en) Container engine, container engine implementation methods, electronic device and storage medium
CN115794219A (en) Data source dynamic control method and device, electronic equipment and medium
US20150186252A1 (en) Testing of transaction tracking software
CN114661426A (en) Container management method and device, electronic equipment and storage medium
CN112988604B (en) Object testing method, testing system, electronic device and readable storage medium
US20220237448A1 (en) Resource constraint aware deep learning model optimization for serverless-based inference systems
CN114925066A (en) Data processing method and device, electronic equipment and storage medium
CN114035864A (en) Interface processing method, interface processing device, electronic device, and storage medium
CN111142972B (en) Method, apparatus, system, and medium for extending functions of application program
CN112506781A (en) Test monitoring method, test monitoring device, electronic device, storage medium, and program product
US20190356725A1 (en) Generating client applications from service model descriptions
US20150350340A1 (en) Management of headless hardware in data center
US20130081007A1 (en) Providing continuous application availability during application update
US10853040B2 (en) Address space splitting for legacy application compatibility
CN115033251A (en) Software deployment method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination