WO2020232888A1 - Container application cloning method and apparatus, computer device and storage medium - Google Patents

Container application cloning method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2020232888A1
WO2020232888A1 PCT/CN2019/103176 CN2019103176W WO2020232888A1 WO 2020232888 A1 WO2020232888 A1 WO 2020232888A1 CN 2019103176 W CN2019103176 W CN 2019103176W WO 2020232888 A1 WO2020232888 A1 WO 2020232888A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
container
cloned
information
container application
Prior art date
Application number
PCT/CN2019/103176
Other languages
French (fr)
Chinese (zh)
Inventor
黄桂钦
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020232888A1 publication Critical patent/WO2020232888A1/en

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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/084Configuration by using pre-existing information, e.g. using templates or copying from other elements
    • H04L41/0846Configuration by using pre-existing information, e.g. using templates or copying from other elements based on copy from other elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • 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/45587Isolation or security of virtual machine instances

Definitions

  • This application relates to the field of cloud computing technology, and in particular to a container application cloning method, device, computer equipment and storage medium.
  • cloud service centers need to be added to the cloud service platform, and the newly added cloud service centers need to be configured for the corresponding environment before they can be put into use.
  • a cloud service center environment includes multiple container applications. If the newly-added cloud service center environment is built and configured step by step from scratch, then high professional knowledge is required, and a lot of time and labor are required. cost.
  • the embodiments of this application provide a method, device, computer equipment and storage medium for cloning a container application, which can clone a container application in a cloud server center to a newly-added cloud service center, improving the construction and configuration of the newly-added cloud service center The efficiency has improved the user experience.
  • an embodiment of the present application provides a container application cloning method, which includes:
  • the original container application in the clone setting instruction is obtained, and the preset setting interface is called according to the clone setting instruction to set the environment information of the cloned container application through the preset setting interface; if receiving To the setting completion instruction, obtain the environment information of the cloned container application that is set, and obtain the application information of the original container application and the environment information of the original container application; according to the application information of the original container application and the original container
  • the application environment information and the environment information of the clone container application determine the application information of the clone container application; determine the clone container application according to the application information of the clone container application and the environment information of the clone container application.
  • the container instance IP of the cloned container application create the container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container
  • an embodiment of the present application provides a container application cloning device, which includes a unit for executing the method described in the first aspect.
  • an embodiment of the present application provides a computer device, the computer device includes a memory, and a processor connected to the memory;
  • the memory is used to store a computer program
  • the processor is used to run the computer program stored in the memory to execute the method described in the first aspect above.
  • an embodiment of the present application provides a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the method described in the first aspect.
  • the method of container application cloning improves the efficiency of building and configuring the newly added server center. Moreover, the process of container application cloning is automatically completed, which further improves the efficiency of building and configuring the newly added cloud service center. Improve the user experience.
  • FIG. 1 is a schematic flowchart of a container application cloning method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of a sub-flow of the container application cloning method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a sub-flow of the container application cloning method provided by an embodiment of the present application
  • FIG. 4 is a schematic flowchart of a container application cloning method provided by another embodiment of the present application.
  • FIG. 5 is a schematic diagram of a sub-flow of a container application cloning method provided by another embodiment of the present application.
  • FIG. 6 is a schematic block diagram of a container application cloning device provided by an embodiment of the present application.
  • FIG. 7 is a schematic block diagram of an application information determining unit provided by an embodiment of the present application.
  • FIG. 8 is a schematic block diagram of an activation unit of an application creation unit provided by an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of a container application cloning device provided by another embodiment of the present application.
  • Fig. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application.
  • the environment where a cloud service center is built and configured includes multiple container applications.
  • the original environment In the environment of a cloud service center (destination environment or clone environment).
  • one container application is cloned by one container application during environment cloning. The implementation of container application cloning will be described in detail below.
  • FIG. 1 is a schematic flowchart of a method for cloning a container application provided by an embodiment of the present application. As shown in Figure 1, the method includes S101-S106.
  • both the original container application and the cloned container application belong to the container application.
  • the original container application already exists, but the cloned container application does not yet exist, and the cloned container application is obtained by cloning according to the original container application by using the method in the embodiment of the present application.
  • the clone setting instruction is triggered by the user clicking a related button or image.
  • the user selects one of the original container applications, and clicks the clone setting corresponding button of the original container application, and the clone setting instruction is triggered. In other embodiments, it can also be triggered in other ways.
  • the preset setting interface is a setting interface written by a developer, which can exist in the form of a setting page.
  • the environment information of the clone container application to be cloned can be set through the preset setting interface. Specifically, the environment information of the cloned container application input/selected by the user is received.
  • the setting completion instruction is triggered by the user clicking the corresponding button or image, or it can be triggered in other ways. If the setting completion instruction is received, obtain the environment information of the cloned container application that is set, and obtain the information of the original container application from the database according to the original container application, including the application information of the original container application and the environment information of the original container application, etc. .
  • the information of each container application includes application information of the container application and environmental information of the container application.
  • the application information of the container application includes the application image information of the container application, the number of container instances of the container application, the resources occupied by the container instances, and the application configuration of the container application.
  • the environment information of the container application includes the application environment of the container application, the area of the container application, the usage time of the container application, and the resource group of the container application.
  • the environment information of the container application may also include whether to synchronize to OCPM, the deployment method of the container application, whether to enable monitoring, beneficiary resource pool, etc.
  • the application image information of the container application includes the image version, the image type, and the image name.
  • the image version includes the official version, official 1.1, official 2.3, etc.;
  • the image type refers to which image the container instance uses, such as nginx, tomcat, weblogic, springboot, etc.;
  • the image name refers to the specific image name.
  • the application environment of container applications includes production environment, test environment, development environment, etc. Among them, the production environment means that the container application is successfully created to connect to the external environment, or for external users to access;
  • the test environment means that the container application is successfully created for internal testing;
  • the development environment means that the container application is successfully created for use Development and use.
  • the container application area refers to the location of the computer room where the container application is created.
  • the container application is created in the "xxx safe area” under the "xx area” of the test environment. In the corresponding computer room. It can be understood that different application environments and different areas correspond to different computer rooms.
  • the number of container instances of a container application refers to the number of containers that the container application needs to create. There is no upper limit for the number of containers for the same container application.
  • the usage time of a container application can be measured in months, such as 5 months.
  • the resource group of the container application refers to the resource account under the name of the container application, which is used for the cost of creating the container instance. If the amount of the resource account under the resource group of the container application is not enough to create the container application, a prompt is required and the container application cannot be created.
  • Whether to synchronize to opcm refers to whether to synchronize container application information to the internal information platform of the enterprise for other related parties to view.
  • the container application information also includes a beneficiary resource pool, and the beneficiary resource pool refers to the subsidiary/department that created the container application.
  • the beneficiary resource pool determines the IP network segment allocated by the created container instance and the resource of the container. Different resource pools are used. It is different IP network segments and resources.
  • the deployment method is connected to the company's internal deployment platform to determine the subsequent version release mode of the container application.
  • S103 Determine the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application.
  • the application information of the original container application includes: the application image information of the original container application, the application configuration of the original container application, the number of container instances of the original container application, the resources occupied by the container instances, etc., the environment of the original container application
  • the information includes the application environment of the original container application, the area of the original container application, etc., the environment information of the cloned container application, the application environment of the cloned container application, and the area of the cloned container application.
  • step S103 includes the following steps S1031-S1034.
  • S1031 Determine the application image information of the clone container application according to the environment information of the original container application, the application image information of the original container application, and the environment information of the clone container application.
  • step S1031 includes: determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application; if If the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the application image information of the original container application is determined as the Clone the application image information of the container application; otherwise, push the application image information of the original container application to the image warehouse corresponding to the cloned container application, and determine the application image information pushed to the image warehouse as the clone Application image information of the container application.
  • an area corresponds to a corresponding mirror warehouse to facilitate obtaining application images from the corresponding mirror warehouse to create container applications. If they are inconsistent, you need to push the application image information of the original container application to the image warehouse where the cloned container application is located.
  • the mirror warehouse corresponding to the application image of the original container application is determined according to the application environment of the original container application and the area of the original container application
  • the application mirror location of the cloned container application is determined according to the application environment of the cloned container application and the area of the cloned container application.
  • Corresponding mirror repository according to the mirror name, mirror version and mirror type of the original container application, find the corresponding application mirror from the mirror repository where the original container application is located; push the found application mirror to the mirror corresponding to the cloned container application Warehouse, that is, copy the found application image information to the mirror warehouse corresponding to the cloned container application.
  • the Step S1031 before the execution of determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application, the Step S1031 also includes: judging whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application; if the clone container application has not been created, A step of determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application is performed.
  • the cloned container application first determine whether the cloned container application has been created. If the cloned container application has been created, then there is no need to determine the application information of the cloned container application, and a prompt message is returned.
  • S1032 Determine the number of container instances of the cloned container application according to the number of container instances of the original container application.
  • the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application.
  • step S103 further includes: judging whether there is enough money in the resource group of the cloned container application according to the number of container instances of the cloned container application, the usage time of the cloned container application, and the remaining amount in the resource group of the cloned container application
  • step S1033 is executed. If there is not enough money to create the cloned container application, a prompt message is returned, and the previously executed steps are cancelled at the same time.
  • S1033 Determine the resource to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application.
  • the resource occupied by the container instance of the original container application is determined as the resource occupied by the container instance of the cloned container application to ensure that the resource occupied by the container instance of the cloned container application is consistent with the resource occupied by the container instance of the original container application.
  • S1034 Determine the application configuration of the cloned container application according to the application configuration of the original container application.
  • the application configuration of the container application includes the configuration of environment variables and the configuration of some common paths.
  • the corresponding application configuration can be obtained in the configuration file corresponding to the application configuration of the original container application, and the obtained application configuration of the original container application can be set as the application configuration of the cloned container application. In this way, it can be ensured that the application configuration of the cloned container application is consistent with the application configuration of the original container application.
  • execution order in the above S1031-S1034 is not strictly limited.
  • the execution order of the above steps can be executed in other orders, as long as the application image information of the cloned container application, the number of container instances, and the occupation of the container instance can be determined. The resources and the application configuration of the container application are sufficient.
  • S104 Determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application.
  • the container instance of the cloned container application is determined according to the application environment of the cloned container application, the area of the cloned container application (in one embodiment, also includes the beneficiary resource pool of the cloned container application) and the number of container instances of the cloned container application IP.
  • the location where the cloned container application is created can be determined according to the application environment of the cloned container application and the area of the cloned container application, that is, the specific computer room where the corresponding original container application is cloned.
  • the IP of the container instance used for cloning the container if the information of the container application includes the beneficiary resource pool of the container application, the IP address used to create the container application is determined according to the application environment of the container application, the region of the container application, and the beneficiary resource pool of the container application. Pool.
  • S105 Create a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the IP of the container instance of the cloned container application, and compare the created container instance with the determined container instance. Bind the container instance IP of the cloned container application.
  • the number of container instances of the cloned container application, the resources required by the container instance, the application configuration of the cloned container application, the application environment of the cloned container application, the area of the cloned container application, and the container of the cloned container application Instance IP creates a container instance of the cloned container application, and binds the created container instance to the determined container instance IP of the cloned container application to set the determined container instance IP of the cloned container application to the created container instance IP.
  • step S105 includes the following steps S1051-S1054.
  • S1051 Obtain the application image of the clone container application from the mirror warehouse corresponding to the clone container application according to the application image information of the clone container application.
  • S1052 Determine the creation of the cloned container application according to the application environment of the cloned container application, the area of the cloned container application, the number of container instances of the cloned container application, and the resources that the container instances of the cloned container application need to occupy. The host of the container instance.
  • the location of the cloned container application can be determined, that is, in which computer room the cloned container application is created.
  • S1053 Create a container instance of the clone container application on the determined host machine according to the application image of the clone container application and the application configuration of the clone container application, and set the application configuration of the clone container application.
  • the obtained application image information of the cloned container application and the application configuration allocation of the cloned container application are issued to the determined host machine through the container orchestration tool, so as to create a container instance on the host machine and set the cloned container The application configuration of the application.
  • the container orchestration tool can be maration. It is equivalent to a transfer station, which sends the obtained application image information and the like to the container orchestration tool, and then the container orchestration tool distributes the application image information and the like to the determined host computer to create a container instance.
  • S1054 Bind the created container instance with the determined container instance IP of the cloned container application.
  • an operation and maintenance tool such as ansible is used to connect the container instance, and the created container instance is bound to the container instance IP of the determined clone container application, so as to set the container instance IP of the determined clone container application to The IP of the container instance created.
  • step S1051 execute: determine whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application; if the clone has not been created For the container application, step S1051 is executed.
  • the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application.
  • the step S105 further includes S1051a.
  • S1051a Determine whether there is enough money in the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application. Create the cloned container application.
  • step S1052 is executed to determine the host machine of the container instance of the cloned container application. If there is not enough money to create the cloned container application, a prompt is given, and all the steps previously performed are cancelled at the same time.
  • the foregoing method embodiments implement the cloning of the container application of the newly added cloud service center.
  • the other information of the cloned container application and the original container application is complete. Consistent.
  • the process of cloning the container application in the embodiment of the present application is automatically completed, which improves the efficiency of building and configuring the newly-added cloud service center, and improves the user experience.
  • the foregoing method embodiments implement the cloning of container applications.
  • various environmental information in the newly added cloud service center is matched at the same time, such as matching the IP address and host in the newly added cloud service center. Information to achieve a perfect match between the original container application and the environment of the newly added cloud service center.
  • FIG. 4 is a schematic flowchart of a container application cloning method provided by another embodiment of the present application.
  • the container application cloning method includes S201-S208.
  • steps S201-S205 correspond to steps S101-S105 in the embodiment of FIG. 1.
  • steps S206-S208 will be specifically described below.
  • Relevant information about whether to create a load balancing application is obtained from the database storing the information of the original container application. If the original container application does not create a load balancing application, it means that the cloned container application is cloned and the process ends. If the original container application creates a load balancing application, step S207 is executed. If the original container application creates a load balancing application, it means that when the container application is cloned, the load balancing application corresponding to the container application is cloned.
  • the load balancing application information of the original container application includes the type of the load balancing application, port information of the load balancing application, configuration parameter information of the load balancing application, application mirroring information of the load balancing application, and so on.
  • S208 Create a corresponding load balancing application for the cloned container application according to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application.
  • step S208 includes the following steps S2081-S2083.
  • S2081 Determine the load balancing application type of the cloned container application according to the load balancing application type in the load balancing application information of the original container application.
  • the type of the original load balancing application is determined as the type of the load balancing application of the cloned container application.
  • the types of load balancing applications include F5, LVS, Haproxy, Nginx, etc.
  • S2082 Determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application.
  • IP address pool for creating the load balancing application according to the application environment of the cloned container application and the area where the container application is cloned; obtain an idle IP from the IP address pool as the virtual IP (Virtual IP, VIP) of the load balancing application of the cloned container application.
  • VIP Virtual IP
  • a management IP needs to be determined to facilitate the management of the LVS load balancing application by the cloud service center .
  • the way to determine the management IP is the same as that of the virtual IP.
  • step S2083 includes: determining the F5 device that creates the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application;
  • the created container instance of the cloned container application is associated with the virtual server of the load balancing application of the cloned container application to obtain an association relationship, and the association relationship, the created container instance of the cloned container application, and the load balancing application
  • the port information of the load balancing application, the configuration parameter information of the load balancing application, and the virtual IP are encapsulated into objects; according to the encapsulated object, the creation interface of the F5 load balancing application is called to create the load balancing on the determined F5 device
  • the virtual server of the application and generate the configuration file of the virtual server; if the load balancing application is created, the access domain name is generated according to the preset domain name generation rules
  • step S2083 includes: determining the host for creating the LVS load balancing application according to the application environment of the cloned container application and the region of the cloned container application, and creating the LVS on the host Container; according to the virtual IP, the created container instance of the cloned container application, the port information of the load balancing application, and the configuration parameter information of the load balancing application to reconstruct the configuration file of the LVS load balancing application; open the LVS The container's LVS load balancing service; configure the subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container; add a route to the configured subnet card.
  • step S2083 includes: the application environment of the cloned container application, the region of the cloned container application, determining the host for creating the Haproxy load balancing application, and creating the Haproxy container on the host; Reconstruct the configuration file of the Haproxy load balancing application according to the virtual IP, the container instance of the created cloned container application, the port information of the load balancing application, and the configuration parameter information of the load balancing application; Haproxy load balancing service.
  • the difference between the created configuration file of the cloned container application and the configuration of the original container application includes: the virtual IP of the load balancing application, container instance information, and other things such as the port information of the load balancing application and the load balancing application
  • the configuration parameter information is consistent with the original container application.
  • the method embodiment further creates a load balancing application of the cloned container application based on the load balancing application of the original container application.
  • the process of load balancing application cloning is automatically completed, which improves the efficiency of building and configuring the newly added cloud service center, and improves the user experience. Understandably, if the container application has a load balancing application in this method embodiment, the load balancing application of the container application is cloned.
  • Fig. 6 is a schematic block diagram of a container application cloning device provided by an embodiment of the present application.
  • the device includes a unit corresponding to the foregoing container application cloning method.
  • the device 100 includes a setting unit 101, an obtaining unit 102, an application information determining unit 103, an IP determining unit 104 and an application creating unit 105.
  • the setting unit 101 is configured to, if a clone setting instruction is received, obtain the original container application in the clone setting instruction, and call a preset setting interface according to the clone setting instruction to set the clone container application through the preset setting interface Environmental information.
  • the obtaining unit 102 is configured to obtain the set environment information of the clone container application, and obtain the application information of the original container application and the environment information of the original container application if the setting completion instruction is received.
  • the application information determining unit 103 is configured to determine the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application.
  • the application information of the original container application includes the application image information of the original container application, the application configuration of the original container application, the number of container instances of the original container application, and the resources occupied by the container instances.
  • the application information determining unit 103 includes a mirroring determining unit 1031, an instance number determining unit 1032, a resource determining unit 1033, and a configuration determining unit 1034.
  • the image determining unit 1031 is configured to determine the application image information of the cloned container application according to the environment information of the original container application, the application image information of the original container application, and the environment information of the cloned container application.
  • the instance number determining unit 1032 is configured to determine the number of container instances of the cloned container application according to the number of container instances of the original container application.
  • the resource determining unit 1033 is configured to determine the resources to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application.
  • the configuration determining unit 1034 is configured to determine the application configuration of the cloned container application according to the application configuration of the original container application.
  • the environment information of the original container application includes the application environment of the original container application and the area of the original container application
  • the environment information of the cloned container application includes the application environment of the cloned container application and the area of the cloned container application.
  • the mirror image determining unit 1031 includes an area determining unit and an application mirror determining unit. Wherein, the area judging unit is used to judge whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application.
  • the application image determination unit is configured to: if the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the original container application
  • the application image information of is determined to be the application image information of the cloned container application; and if inconsistencies, the application image information of the original container application is pushed to the mirror warehouse corresponding to the cloned container application, and pushed to the mirror warehouse
  • the application image information in is determined as the application image information of the cloned container application.
  • the mirror image determining unit 1031 further includes an application existence judging unit.
  • the application existence judgment unit is used to judge whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application. If the clone container application is not created, the area judgment unit is triggered.
  • the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application.
  • the application information determining unit 103 also includes an amount determining unit.
  • the amount judgment unit is configured to judge the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application Whether there is enough money to create the cloned container application. If there is enough money to create the cloned container application, trigger the resource determination unit.
  • the IP determining unit 104 is configured to determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application.
  • the application creation unit 105 is configured to create a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and then combine the created container The instance is bound to the determined container instance IP of the cloned container application.
  • the application creation unit 105 includes: an application image acquisition unit 1051, a host determination unit 1052, a container instance creation unit 1053, and an IP binding unit 1054.
  • the application image obtaining unit 1051 is configured to obtain the application image of the clone container application from the mirror warehouse corresponding to the clone container application according to the application image information of the clone container application.
  • the host determining unit 1052 is configured to determine according to the application environment of the cloned container application, the area of the cloned container application, the number of container instances of the cloned container application, and the resources required to be occupied by the container instances of the cloned container application Create a host machine of the container instance of the cloned container application.
  • the container instance creation unit 1053 is configured to create a container instance of the clone container application on the determined host machine according to the application image of the clone container application and the application configuration of the clone container application, and set the clone container application Application configuration.
  • the IP binding unit 1054 binds the created container instance with the determined container instance IP of the cloned container application.
  • the application creation unit 105 also includes an application existence judgment unit. Wherein, there is a judging unit for judging whether the cloned container application has been created in the area corresponding to the cloned container application according to the application environment of the cloned container application and the area of the cloned container application. If the cloned container application is not created, then the application image acquiring unit 1051 is triggered.
  • the application creation unit 105 also includes an amount judgment unit 1051a.
  • the amount judgment unit 1051a is configured to judge the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application Whether there is enough money in the database to create the cloned container application. If there is enough gold to create the cloned container application, the host determining unit 1052 is triggered.
  • FIG. 9 it is a schematic block diagram of a container application cloning device provided by another embodiment of the present application.
  • the container application cloning device 200 includes a setting unit 201, an acquisition unit 202, an application information determination unit 203, an IP determination unit 204, an application creation unit 205, a load detection unit 206, a load acquisition unit 207, and a load creation unit 208.
  • the setting unit 201, the acquiring unit 202, the application information determining unit 203, the IP determining unit 204, the application creating unit 205 are the same as the setting unit 101, the acquiring unit 102, the application information determining unit 103, and the IP determining unit 104 in the embodiment of FIG.
  • the application creation unit 105 respectively correspond. Specifically, please refer to the description of the embodiment in FIG. 6. The differences between the embodiment of the present application and the embodiment in FIG. 6 will be described in detail below: the load detection unit 206, the load acquisition unit 207, and the load creation unit 208.
  • the load detection unit 206 is configured to detect whether the original container application creates a load balancing application.
  • the load obtaining unit 207 is configured to obtain load balancing application information of the original container application if the original container application creates a load balancing application.
  • the load creating unit 208 is configured to create a corresponding load balancing application for the cloned container application according to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application.
  • the load creation unit 208 includes: a type determination unit, a virtual IP determination unit, and a load creation unit.
  • the type determining unit is configured to determine the type of the load balancing application of the cloned container application according to the type of the load balancing application in the information of the load balancing application of the original container application.
  • the virtual IP determining unit is configured to determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the area of the cloned container application.
  • the load creation unit is configured to call the load balancing application creation interface matching the load balancing application type according to the load balancing application information of the original container application, the virtual IP, and the container instance information of the cloned container application, to Create a load balancing application of the cloned container application.
  • the above device may be implemented in the form of a computer program, and the computer program may run on the computer device as shown in FIG. 10.
  • FIG. 10 is a schematic block diagram of a computer device according to an embodiment of the application.
  • the equipment is a terminal and other equipment, such as a server in the PaaS platform.
  • the device 300 includes a processor 302, a memory, and a network interface 303 connected through a system bus 301, where the memory may include a non-volatile storage medium 304 and an internal memory 305.
  • the non-volatile storage medium 304 can store an operating system 3041 and a computer program 3042.
  • the container application cloning method described above can be implemented.
  • the processor 302 is used to provide computing and control capabilities and support the operation of the entire device 300.
  • the internal memory 305 provides an environment for running a computer program in a non-volatile storage medium.
  • the processor 302 can execute the container application cloning method described above.
  • the network interface 303 is used for network communication.
  • the structure shown in the figure is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the device to which the solution of the present application is applied.
  • the specific device may include a diagram More or fewer components are shown in, or some components are combined, or have different component arrangements.
  • the processor 302 is configured to run a computer program stored in a memory to implement any embodiment of the container application cloning method.
  • the processor 302 may be a central processing unit (CPU), and the processor may also be other general-purpose processors or digital signal processors (DSP). , Application-specific integrated circuit (application license Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the computer program may be stored in a storage medium, and the storage medium may be a computer-readable storage medium.
  • the computer program is executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiment.
  • the storage medium may be a computer-readable storage medium, and the computer-readable storage medium includes a non-volatile computer-readable storage medium.
  • the storage medium stores a computer program that, when executed by a processor, implements any embodiment of the container application cloning method.
  • the storage medium is a physical, non-transitory storage medium, such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.
  • a physical, non-transitory storage medium such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.

Abstract

The present application relates to the technical field of cloud computing, and provided in embodiments thereof are a container application cloning method and apparatus, a computer device and a storage medium, which may be applied to a PaaS platform. The method comprises: according to application information and environment information of an original container application and environment information of a set cloned container application, determining application information of the cloned container application; according to the application information of the cloned container application and the environment information of the cloned container application, determining a container instance IP of the cloned container application; according to the application information, environment information and container instance IP of the cloned container application, creating a container instance for the cloned container application, and binding the created container instance to the determined container instance IP of the cloned container application.

Description

容器应用克隆方法、装置、计算机设备及存储介质Container application cloning method, device, computer equipment and storage medium
本申请要求于2019年05月17日提交中国专利局、申请号为201910410621.X、申请名称为“容器应用克隆方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 17, 2019, the application number is 201910410621.X, and the application name is "container application cloning method, device, computer equipment and storage medium", and its entire content Incorporated in this application by reference.
技术领域Technical field
本申请涉及云计算技术领域,尤其涉及一种容器应用克隆方法、装置、计算机设备及存储介质。This application relates to the field of cloud computing technology, and in particular to a container application cloning method, device, computer equipment and storage medium.
背景技术Background technique
由于业务的需求,需要在云服务平台中新增一些云服务中心,新增的云服务中心需要进行相应的环境配置后才可以投入使用。通常一个云服务中心环境中包括有多个容器应用,若对该新增的云服务中心的环境一步一步的从头开始搭建和配置,那么需要较高的专业知识,同时需要大量的时间成本和人工成本。Due to business needs, some cloud service centers need to be added to the cloud service platform, and the newly added cloud service centers need to be configured for the corresponding environment before they can be put into use. Usually a cloud service center environment includes multiple container applications. If the newly-added cloud service center environment is built and configured step by step from scratch, then high professional knowledge is required, and a lot of time and labor are required. cost.
发明内容Summary of the invention
本申请实施例提供一种容器应用克隆方法、装置、计算机设备及存储介质,可将一个云服务器中心的容器应用克隆到新增的云服务中心中,提高了新增的云服务中心搭建和配置的效率,提高了用户的体验。The embodiments of this application provide a method, device, computer equipment and storage medium for cloning a container application, which can clone a container application in a cloud server center to a newly-added cloud service center, improving the construction and configuration of the newly-added cloud service center The efficiency has improved the user experience.
第一方面,本申请实施例提供了一种容器应用克隆方法,该方法包括:In the first aspect, an embodiment of the present application provides a container application cloning method, which includes:
若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息;若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息;根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息;根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP;根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。If a clone setting instruction is received, the original container application in the clone setting instruction is obtained, and the preset setting interface is called according to the clone setting instruction to set the environment information of the cloned container application through the preset setting interface; if receiving To the setting completion instruction, obtain the environment information of the cloned container application that is set, and obtain the application information of the original container application and the environment information of the original container application; according to the application information of the original container application and the original container The application environment information and the environment information of the clone container application determine the application information of the clone container application; determine the clone container application according to the application information of the clone container application and the environment information of the clone container application The container instance IP of the cloned container application; create the container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combine the created container instance Binding with the determined container instance IP of the cloned container application.
第二方面,本申请实施例提供了一种容器应用克隆装置,该容器应用克隆装置包括用于执行上述第一方面所述的方法对应的单元。In a second aspect, an embodiment of the present application provides a container application cloning device, which includes a unit for executing the method described in the first aspect.
第三方面,本申请实施例提供了一种计算机设备,所述计算机设备包括存储器,以及与所述存储器相连的处理器;In a third aspect, an embodiment of the present application provides a computer device, the computer device includes a memory, and a processor connected to the memory;
所述存储器用于存储计算机程序,所述处理器用于运行所述存储器中存储的计算机程序,以执行上述第一方面所述的方法。The memory is used to store a computer program, and the processor is used to run the computer program stored in the memory to execute the method described in the first aspect above.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时,实现上述第一方面所述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium that stores a computer program that, when executed by a processor, implements the method described in the first aspect.
本申请实施例中通过容器应用克隆的方式,提高了新增的服务器中心搭建和配置的效率,而且,容器应用克隆的过程自动完成,进一步提高了新增的云服务中心搭建和配置的效率,提高了用户的体验。In the embodiment of the application, the method of container application cloning improves the efficiency of building and configuring the newly added server center. Moreover, the process of container application cloning is automatically completed, which further improves the efficiency of building and configuring the newly added cloud service center. Improve the user experience.
附图说明Description of the drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. Ordinary technicians can obtain other drawings based on these drawings without creative work.
图1是本申请实施例提供的容器应用克隆方法的流程示意图;FIG. 1 is a schematic flowchart of a container application cloning method provided by an embodiment of the present application;
图2是本申请实施例提供的容器应用克隆方法的子流程示意图;2 is a schematic diagram of a sub-flow of the container application cloning method provided by an embodiment of the present application;
图3是本申请实施例提供的容器应用克隆方法的子流程示意图;3 is a schematic diagram of a sub-flow of the container application cloning method provided by an embodiment of the present application;
图4是本申请另一实施例提供的容器应用克隆方法的流程示意图;4 is a schematic flowchart of a container application cloning method provided by another embodiment of the present application;
图5是本申请另一实施例提供的容器应用克隆方法的子流程示意图;FIG. 5 is a schematic diagram of a sub-flow of a container application cloning method provided by another embodiment of the present application;
图6是本申请实施例提供的容器应用克隆装置的示意性框图;FIG. 6 is a schematic block diagram of a container application cloning device provided by an embodiment of the present application;
图7是本申请实施例提供的应用信息确定单元的示意性框图;FIG. 7 is a schematic block diagram of an application information determining unit provided by an embodiment of the present application;
图8是本申请实施例提供的应用创建单元启用单元的示意性框图;FIG. 8 is a schematic block diagram of an activation unit of an application creation unit provided by an embodiment of the present application;
图9是本申请另一实施例提供的容器应用克隆装置的示意性框图;FIG. 9 is a schematic block diagram of a container application cloning device provided by another embodiment of the present application;
图10是本申请实施例提供的计算机设备的示意性框图。Fig. 10 is a schematic block diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部 的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
需要指出的是,一个云服务中心完成搭建和配置的环境中包括有多个容器应用,对环境进行克隆时,需要将一个云服务中心环境(称为原始环境)中的容器应用都克隆到另一个云服务中心的环境(目的环境或者克隆环境)中。为了防止多个容器应用一起克隆的诸多不可控因素,一般情况下,在进行环境克隆时一个容器应用一个容器应用的进行克隆。以下将详细描述容器应用克隆的实现方式。It should be pointed out that the environment where a cloud service center is built and configured includes multiple container applications. When cloning the environment, you need to clone all the container applications in a cloud service center environment (called the original environment) to another In the environment of a cloud service center (destination environment or clone environment). In order to prevent many uncontrollable factors in the cloning of multiple container applications together, in general, one container application is cloned by one container application during environment cloning. The implementation of container application cloning will be described in detail below.
图1是本申请实施例提供的容器应用克隆方法的流程示意图。如图1所示,该方法包括S101-S106。FIG. 1 is a schematic flowchart of a method for cloning a container application provided by an embodiment of the present application. As shown in Figure 1, the method includes S101-S106.
S101,若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息。S101: If a clone setting instruction is received, obtain the original container application in the clone setting instruction, and call a preset setting interface according to the clone setting instruction to set environment information of the cloned container application through the preset setting interface.
需要注意的是,原始容器应用和克隆容器应用都属于容器应用。原始容器应用已经存在了,而克隆容器应用还不存在,通过本申请实施例中的方法以根据原始容器应用进行克隆从而得到该克隆容器应用。It should be noted that both the original container application and the cloned container application belong to the container application. The original container application already exists, but the cloned container application does not yet exist, and the cloned container application is obtained by cloning according to the original container application by using the method in the embodiment of the present application.
其中,克隆设置指令由用户点击相关按钮或者图像触发。如在云服务中心的原始容器应用的列表中,对应有多个原始容器应用,用户选择其中一个原始容器应用,并点击该原始容器应用所对应的克隆设置等相关按钮,会触发克隆设置指令。在其他实施例中,也可以通过其他的方式触发。Among them, the clone setting instruction is triggered by the user clicking a related button or image. For example, in the list of original container applications in the cloud service center, there are multiple original container applications, and the user selects one of the original container applications, and clicks the clone setting corresponding button of the original container application, and the clone setting instruction is triggered. In other embodiments, it can also be triggered in other ways.
其中,预设设置接口为开发人员编写的设置接口,可以以设置页面的形式存在。通过该预设设置接口可以设置需克隆的克隆容器应用的环境信息。具体地,接收用户输入的/选择的克隆容器应用的环境信息。Among them, the preset setting interface is a setting interface written by a developer, which can exist in the form of a setting page. The environment information of the clone container application to be cloned can be set through the preset setting interface. Specifically, the environment information of the cloned container application input/selected by the user is received.
S102,若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息。S102: If the setting completion instruction is received, obtain the set environment information of the cloned container application, and obtain the application information of the original container application and the environment information of the original container application.
设置完成指令由用户点击相应按钮或者图像触发,也可以通过其他的方式触发。若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并根据原始容器应用从数据库中获取原始容器应用的信息,包括原始容器应用的应用信息和所述原始容器应用的环境信息等。The setting completion instruction is triggered by the user clicking the corresponding button or image, or it can be triggered in other ways. If the setting completion instruction is received, obtain the environment information of the cloned container application that is set, and obtain the information of the original container application from the database according to the original container application, including the application information of the original container application and the environment information of the original container application, etc. .
由于原始容器应用和克隆容器应用都属于容器应用。因此,原始容器应用的信息和克隆容器应用的信息中所对应的相同属性都表示同一个含义,以下以 容器应用的角度来介绍各个属性的含义。Because both the original container application and the cloned container application belong to the container application. Therefore, the same attributes corresponding to the information of the original container application and the information of the cloned container application all have the same meaning. The following describes the meaning of each attribute from the perspective of the container application.
每个容器应用的信息包括容器应用的应用信息和容器应用的环境信息。其中,容器应用的应用信息包括容器应用的应用镜像信息、容器应用的容器实例数量、容器实例所占用的资源、容器应用的应用配置等。容器应用的环境信息包括容器应用的应用环境、容器应用的区域、容器应用的使用时间、容器应用的资源组等。容器应用的环境信息还可以包括是否同步到OCPM、容器应用的部署方式、是否启用监控、受益人资源池等。The information of each container application includes application information of the container application and environmental information of the container application. Among them, the application information of the container application includes the application image information of the container application, the number of container instances of the container application, the resources occupied by the container instances, and the application configuration of the container application. The environment information of the container application includes the application environment of the container application, the area of the container application, the usage time of the container application, and the resource group of the container application. The environment information of the container application may also include whether to synchronize to OCPM, the deployment method of the container application, whether to enable monitoring, beneficiary resource pool, etc.
其中,容器应用的应用镜像信息包括镜像版本、镜像类型和镜像名称。其中,镜像版本包括官方版本、官方1.1、官方2.3等;镜像类型指的是该容器实例使用哪种镜像,如nginx、tomcat、weblogic、springboot等;镜像名称指的是具体的镜像名称。容器应用的应用环境包括生产环境、测试环境、开发环境等。其中,生产环境意味着该容器应用创建成功后对接外部环境,或者以供外部用户进行访问;测试环境意味着该容器应用创建成功后供内部测试使用;开发环境意味着该容器应用创建成功后供开发使用。容器应用的区域指的是创建容器应用的机房位置,由两部分组成:“区域”+“安全区域”。然而,确定容器应用创建在哪个具体地机房中,需要根据容器应用的应用环境和容器应用的区域共同决定,如将容器应用创建在测试环境下的“xx区域”下的“xxx安全区域”的所对应的机房中。可以理解为,不同应用环境、不同区域所对应的机房不同。容器应用的容器实例数量指的是该容器应用需创建的容器数量,同一容器应用的容器数量是没有上限的。容器应用的使用时间,可以月作为计量单位,如使用时间为5个月。需要注意的是,由于每个容器实例都需要花钱,因此容器应用的容器实例数量和容器应用的使用时间决定了容器应用所需要花费的金额。容器应用的资源组指的是容器应用名下的资源账户,用于容器实例的创建所需要使用的费用。若容器应用的资源组下的资源账户的金额不足以用来创建该容器应用,需进行提示,不能进行该容器应用的创建。是否同步到opcm指的是是否同步容器应用信息到企业内部的信息平台,供其他关联方查看。在一些实施例中,容器应用的信息还包括受益人资源池,受益人资源池指的是创建容器应用的子公司/部门。若容器应用的信息还包括受益人资源池,那么受益人资源池与容器应用的应用环境、容器应用的区域一起决定所创建的容器实例分配的IP网段以及容器的资源,不同资源池,使用的是不同的IP网段以及资源。部署方式,对接公司内部的部署平台,用于决定该容器应用的后续版本发布模式。Among them, the application image information of the container application includes the image version, the image type, and the image name. Among them, the image version includes the official version, official 1.1, official 2.3, etc.; the image type refers to which image the container instance uses, such as nginx, tomcat, weblogic, springboot, etc.; the image name refers to the specific image name. The application environment of container applications includes production environment, test environment, development environment, etc. Among them, the production environment means that the container application is successfully created to connect to the external environment, or for external users to access; the test environment means that the container application is successfully created for internal testing; the development environment means that the container application is successfully created for use Development and use. The container application area refers to the location of the computer room where the container application is created. It consists of two parts: "area" + "safe area". However, to determine which specific computer room the container application is created in, it needs to be determined jointly according to the application environment of the container application and the area of the container application. For example, the container application is created in the "xxx safe area" under the "xx area" of the test environment. In the corresponding computer room. It can be understood that different application environments and different areas correspond to different computer rooms. The number of container instances of a container application refers to the number of containers that the container application needs to create. There is no upper limit for the number of containers for the same container application. The usage time of a container application can be measured in months, such as 5 months. It should be noted that since each container instance needs to spend money, the number of container instances of the container application and the usage time of the container application determine the amount of money the container application needs. The resource group of the container application refers to the resource account under the name of the container application, which is used for the cost of creating the container instance. If the amount of the resource account under the resource group of the container application is not enough to create the container application, a prompt is required and the container application cannot be created. Whether to synchronize to opcm refers to whether to synchronize container application information to the internal information platform of the enterprise for other related parties to view. In some embodiments, the container application information also includes a beneficiary resource pool, and the beneficiary resource pool refers to the subsidiary/department that created the container application. If the information of the container application also includes the beneficiary resource pool, then the beneficiary resource pool, the application environment of the container application, and the area of the container application together determine the IP network segment allocated by the created container instance and the resource of the container. Different resource pools are used. It is different IP network segments and resources. The deployment method is connected to the company's internal deployment platform to determine the subsequent version release mode of the container application.
S103,根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息。S103: Determine the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application.
在一实施例中,原始容器应用的应用信息包括:原始容器应用的应用镜像信息、原始容器应用的应用配置、原始容器应用的容器实例数量、容器实例所占用的资源等,原始容器应用的环境信息包括原始容器应用的应用环境、原始容器应用的区域等,克隆容器应用的环境信息克隆容器应用的应用环境、克隆容器应用的区域等。In an embodiment, the application information of the original container application includes: the application image information of the original container application, the application configuration of the original container application, the number of container instances of the original container application, the resources occupied by the container instances, etc., the environment of the original container application The information includes the application environment of the original container application, the area of the original container application, etc., the environment information of the cloned container application, the application environment of the cloned container application, and the area of the cloned container application.
如图2所示,步骤S103包括以下步骤S1031-S1034。As shown in Figure 2, step S103 includes the following steps S1031-S1034.
S1031,根据所述原始容器应用的环境信息、所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息。S1031: Determine the application image information of the clone container application according to the environment information of the original container application, the application image information of the original container application, and the environment information of the clone container application.
可以理解为,不同的环境信息所对应的数据仓库不同,然而在创建容器应用时,需要保证创建容器应用的数据仓库中存在有容器应用的应用镜像信息,从而可以直接从创建容器应用的数据仓库中获取应用镜像信息,而无需跨数据仓库获取应用镜像信息,提高了创建容器应用的速度,保证了信息的安全。It can be understood that different environmental information corresponds to different data warehouses. However, when creating a container application, you need to ensure that the container application image information exists in the data warehouse where the container application is created, so that you can directly create the container application data warehouse Obtain application image information in the application without cross-data warehouse acquisition, which improves the speed of creating container applications and ensures the security of information.
在一实施例中,步骤S1031包括:判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致;若所述原始容器应用的应用环境与所述克隆容器应用的应用环境一致且所述原始容器应用的区域与所述克隆容器应用的区域一致,将所述原始容器应用的应用镜像信息确定为所述克隆容器应用的应用镜像信息;否则将所述原始容器应用的应用镜像信息推送至所述克隆容器应用所对应的镜像仓库中,并将推送至镜像仓库中的该应用镜像信息确定为所述克隆容器应用的应用镜像信息。In one embodiment, step S1031 includes: determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application; if If the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the application image information of the original container application is determined as the Clone the application image information of the container application; otherwise, push the application image information of the original container application to the image warehouse corresponding to the cloned container application, and determine the application image information pushed to the image warehouse as the clone Application image information of the container application.
其中,若原始容器应用的应用环境、原始容器应用的区域与克隆容器应用的应用环境、克隆容器应用的区域不一致,那么确定原始容器应用和克隆容器应用不在同一个区域(机房)。一般一个区域对应有相应的镜像仓库,以方便从相应的镜像仓库中获取应用镜像以创建容器应用。若不一致,那么需要将原始容器应用的应用镜像信息推送至克隆容器应用所在的镜像仓库中。Among them, if the application environment of the original container application and the area of the original container application are inconsistent with the application environment of the cloned container application, and the area of the cloned container application, it is determined that the original container application and the cloned container application are not in the same area (computer room). Generally, an area corresponds to a corresponding mirror warehouse to facilitate obtaining application images from the corresponding mirror warehouse to create container applications. If they are inconsistent, you need to push the application image information of the original container application to the image warehouse where the cloned container application is located.
具体地,根据原始容器应用的应用环境和原始容器应用的区域确定原始容器应用的应用镜像所对应的镜像仓库,根据克隆容器应用的应用环境和克隆容器应用的区域确定克隆容器应用的应用镜像所对应的镜像仓库;根据原始容器 应用的镜像名称、镜像版本和镜像类型从原始容器应用所在的镜像仓库中查找所对应的应用镜像;将所查找到的应用镜像推送至克隆容器应用所对应的镜像仓库,即将所查找到的应用镜像信息复制到克隆容器应用所对应的镜像仓库。Specifically, the mirror warehouse corresponding to the application image of the original container application is determined according to the application environment of the original container application and the area of the original container application, and the application mirror location of the cloned container application is determined according to the application environment of the cloned container application and the area of the cloned container application. Corresponding mirror repository; according to the mirror name, mirror version and mirror type of the original container application, find the corresponding application mirror from the mirror repository where the original container application is located; push the found application mirror to the mirror corresponding to the cloned container application Warehouse, that is, copy the found application image information to the mirror warehouse corresponding to the cloned container application.
在一实施例中,在执行判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致之前,所述步骤S1031还包括:根据所述克隆容器应用的应用环境、克隆容器应用的区域判断所述克隆容器应用所对应的区域中是否已经创建了所述克隆容器应用;若未创建所述克隆容器应用,执行判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致的步骤。In one embodiment, before the execution of determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application, the Step S1031 also includes: judging whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application; if the clone container application has not been created, A step of determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application is performed.
可以理解地,在确定克隆容器应用的应用信息之前先判断是否已创建了克隆容器应用,若已经创建了克隆容器应用,那么无需再确定克隆容器应用的应用信息了,返回提示信息。Understandably, before determining the application information of the cloned container application, first determine whether the cloned container application has been created. If the cloned container application has been created, then there is no need to determine the application information of the cloned container application, and a prompt message is returned.
S1032,根据所述原始容器应用的容器实例数量确定所述克隆容器应用的容器实例数量。S1032: Determine the number of container instances of the cloned container application according to the number of container instances of the original container application.
获取原始容器应用的容器实例数量,将原始容器应用的容器实例数量设置为克隆容器应用的容器实例数量,以使得克隆容器应用的容器实例数量与原始容器应用的容器实例数量相同。Obtain the number of container instances of the original container application, and set the number of container instances of the original container application to the number of container instances of the cloned container application, so that the number of container instances of the cloned container application is the same as the number of container instances of the original container application.
在一实施例中,所述克隆容器应用的环境信息还包括克隆容器应用的使用时间、克隆容器应用的资源组。在步骤S1032之后,步骤S103还包括:根据所述克隆容器应用的容器实例数量、克隆容器应用的使用时间、克隆容器应用的资源组中的剩余金额判断克隆容器应用的资源组是否存在有足够金额以用来创建所述克隆容器应用,若存在足够金额以用来创建所述克隆容器应用,执行步骤S1033。若不存在足够金额以用来创建所述克隆容器应用,返回提示信息,同时撤销之前执行的步骤。In an embodiment, the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application. After step S1032, step S103 further includes: judging whether there is enough money in the resource group of the cloned container application according to the number of container instances of the cloned container application, the usage time of the cloned container application, and the remaining amount in the resource group of the cloned container application For creating the cloned container application, if there is enough money to create the cloned container application, step S1033 is executed. If there is not enough money to create the cloned container application, a prompt message is returned, and the previously executed steps are cancelled at the same time.
可以理解地,在确定克隆容器应用的应用信息的时候就进行创建克隆容器应用的金额是否足够的判断,以避免在没有足够金额的情况下,会多执行一些步骤。Understandably, when determining the application information of the cloned container application, it is judged whether the amount for creating the cloned container application is sufficient, so as to avoid performing more steps when there is not enough money.
S1033,根据所述原始容器应用的容器实例所占用的资源确定所述克隆容器应用的容器实例需占用的资源。S1033: Determine the resource to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application.
根据原始容器应用获取数据库中原始容器应用的容器实例所占用的资源, 其中,容器实例所占用的资源包括容器实例所占用的CPU比率、所占用的内存大小以及所占有的其它资源,例如是否启用监控资源(用来监控容器实例的运行情况)等。将原始容器应用的容器实例所占用的资源确定为克隆容器应用的容器实例需占用的资源,以确保克隆容器应用的容器实例所占用的资源与原始容器应用的容器实例所占用的资源一致。Obtain the resources occupied by the container instance of the original container application in the database according to the original container application, where the resources occupied by the container instance include the ratio of the CPU occupied by the container instance, the size of the memory occupied, and other resources occupied, such as whether to enable Monitoring resources (used to monitor the running status of container instances), etc. The resource occupied by the container instance of the original container application is determined as the resource occupied by the container instance of the cloned container application to ensure that the resource occupied by the container instance of the cloned container application is consistent with the resource occupied by the container instance of the original container application.
S1034,根据所述原始容器应用的应用配置确定所述克隆容器应用的应用配置。S1034: Determine the application configuration of the cloned container application according to the application configuration of the original container application.
容器应用的应用配置包括环境变量的配置和一些通用路径的配置等。可在原始容器应用的应用配置所对应的配置文件中获取对应的应用配置,将所获取的原始容器应用的应用配置设置为克隆容器应用的应用配置。如此,可确保克隆容器应用的应用配置与原始容器应用的应用配置一致。The application configuration of the container application includes the configuration of environment variables and the configuration of some common paths. The corresponding application configuration can be obtained in the configuration file corresponding to the application configuration of the original container application, and the obtained application configuration of the original container application can be set as the application configuration of the cloned container application. In this way, it can be ensured that the application configuration of the cloned container application is consistent with the application configuration of the original container application.
需要注意的是,以上S1031-S1034中的执行顺序并没有严格限定,以上各步骤的执行顺序可按照其他顺序执行,只要最终可以确定克隆容器应用的应用镜像信息、容器实例数量、容器实例所占用的资源、容器应用的应用配置即可。It should be noted that the execution order in the above S1031-S1034 is not strictly limited. The execution order of the above steps can be executed in other orders, as long as the application image information of the cloned container application, the number of container instances, and the occupation of the container instance can be determined. The resources and the application configuration of the container application are sufficient.
S104,根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP。S104: Determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application.
具体地,根据克隆容器应用的应用环境、克隆容器应用的区域(在一实施例中,还包括克隆容器应用的受益人资源池)以及克隆容器应用的容器实例数量确定克隆容器应用的容器实例的IP。Specifically, the container instance of the cloned container application is determined according to the application environment of the cloned container application, the area of the cloned container application (in one embodiment, also includes the beneficiary resource pool of the cloned container application) and the number of container instances of the cloned container application IP.
根据克隆容器应用的应用环境、克隆容器应用的区域可确定克隆容器应用创建的位置,即将所对应的原始容器应用克隆在具体哪个机房中。获取数据库中该创建位置下预先分配的用于创建容器实例的IP地址池;从容器实例的IP地址池中获取与克隆容器应用的容器实例数量相同数量的空闲IP地址,将该空闲IP地址确定为克隆容器应用的容器实例IP。在一实施例中,若容器应用的信息包括容器应用的受益人资源池,那么根据容器应用的应用环境、容器应用的区域、容器应用的受益人资源池一起确定用于创建容器应用的IP地址池。The location where the cloned container application is created can be determined according to the application environment of the cloned container application and the area of the cloned container application, that is, the specific computer room where the corresponding original container application is cloned. Obtain the pre-allocated IP address pool used to create the container instance under the creation location in the database; obtain the same number of free IP addresses as the number of container instances of the cloned container application from the IP address pool of the container instance, and determine the free IP address The IP of the container instance used for cloning the container. In an embodiment, if the information of the container application includes the beneficiary resource pool of the container application, the IP address used to create the container application is determined according to the application environment of the container application, the region of the container application, and the beneficiary resource pool of the container application. Pool.
S105,根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。S105. Create a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the IP of the container instance of the cloned container application, and compare the created container instance with the determined container instance. Bind the container instance IP of the cloned container application.
如根据克隆容器应用的应用镜像信息、克隆容器应用的容器实例数量、容器实例需占用的资源、克隆容器应用的应用配置、克隆容器应用的应用环境、 克隆容器应用的区域以及克隆容器应用的容器实例IP创建克隆容器应用的容器实例,并将所创建的容器实例与所确定的克隆容器应用的容器实例IP绑定,以将所确定的克隆容器应用的容器实例IP设置为所创建的容器实例的IP。For example, according to the application image information of the cloned container application, the number of container instances of the cloned container application, the resources required by the container instance, the application configuration of the cloned container application, the application environment of the cloned container application, the area of the cloned container application, and the container of the cloned container application Instance IP creates a container instance of the cloned container application, and binds the created container instance to the determined container instance IP of the cloned container application to set the determined container instance IP of the cloned container application to the created container instance IP.
在一实施例中,如图3所示,步骤S105包括以下步骤S1051-S1054。In an embodiment, as shown in FIG. 3, step S105 includes the following steps S1051-S1054.
S1051,根据所述克隆容器应用的应用镜像信息从所述克隆容器应用所对应的镜像仓库中获取所述克隆容器应用的应用镜像。S1051: Obtain the application image of the clone container application from the mirror warehouse corresponding to the clone container application according to the application image information of the clone container application.
S1052,根据所述克隆容器应用的应用环境、所述克隆容器应用的区域、所述克隆容器应用的容器实例数量以及所述克隆容器应用的容器实例需占用的资源确定创建所述克隆容器应用的容器实例的宿主机。S1052: Determine the creation of the cloned container application according to the application environment of the cloned container application, the area of the cloned container application, the number of container instances of the cloned container application, and the resources that the container instances of the cloned container application need to occupy. The host of the container instance.
根据克隆容器应用的应用环境、克隆容器应用的区域可确定克隆容器应用创建的位置,即将克隆容器应用创建在具体哪个机房中。获取数据库中创建位置下预先分配的用于创建容器实例的宿主机的IP地址池;根据克隆容器应用的容器实例需占用的资源、容器实例数量从宿主机的IP地址池中确定创建容器实例的宿主机。需要注意的是,创建容器实例是需要占用宿主机的资源的,因此需要根据克隆容器应用的容器实例需占用的资源、容器实例数量确定宿主机。其中,容器实例数量与所确定的宿主机的数量相同。According to the application environment of the cloned container application and the region of the cloned container application, the location of the cloned container application can be determined, that is, in which computer room the cloned container application is created. Obtain the pre-allocated IP address pool of the host used to create the container instance under the creation location in the database; determine the creation of the container instance from the IP address pool of the host according to the resources and the number of container instances to be occupied by the container instance of the cloned container application Host. It should be noted that creating a container instance requires the resources of the host machine to be occupied. Therefore, the host machine needs to be determined according to the resources and the number of container instances that need to be occupied by the container instance of the cloned container application. Among them, the number of container instances is the same as the number of determined host machines.
S1053,根据所述克隆容器应用的应用镜像、所述克隆容器应用的应用配置在所确定的宿主机上创建所述克隆容器应用的容器实例,并设置所述克隆容器应用的应用配置。S1053: Create a container instance of the clone container application on the determined host machine according to the application image of the clone container application and the application configuration of the clone container application, and set the application configuration of the clone container application.
具体地,通过容器编排工具将所获取的克隆容器应用的应用镜像信息、克隆容器应用的应用配置分配下发到所确定的宿主机上,以在所述宿主机上创建容器实例并设置克隆容器应用的应用配置。其中,容器编排工具可以为maration。其相当于一个中转站,将所获取的应用镜像信息等发送到该容器编排工具,然后由容器编排工具将应用镜像信息等分配下发到所确定的宿主机上,以进行容器实例的创建。Specifically, the obtained application image information of the cloned container application and the application configuration allocation of the cloned container application are issued to the determined host machine through the container orchestration tool, so as to create a container instance on the host machine and set the cloned container The application configuration of the application. Among them, the container orchestration tool can be maration. It is equivalent to a transfer station, which sends the obtained application image information and the like to the container orchestration tool, and then the container orchestration tool distributes the application image information and the like to the determined host computer to create a container instance.
S1054,将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。S1054: Bind the created container instance with the determined container instance IP of the cloned container application.
具体地,通过运维工具如ansible去连接容器实例,将所创建的容器实例与所确定的克隆容器应用的容器实例IP进行绑定,以将所确定的克隆容器应用的容器实例IP设置为所创建的容器实例的IP。Specifically, an operation and maintenance tool such as ansible is used to connect the container instance, and the created container instance is bound to the container instance IP of the determined clone container application, so as to set the container instance IP of the determined clone container application to The IP of the container instance created.
若在确定克隆容器应用的应用信息之前,并没有判断是否已经创建了克隆 容器应用,那么在创建克隆容器应用的时候可进行相应的判断。即在步骤S1051之前,执行:根据所述克隆容器应用的应用环境、克隆容器应用的区域判断所述克隆容器应用所对应的区域中是否已经创建了所述克隆容器应用;若未创建所述克隆容器应用,执行步骤S1051。If the application information of the cloned container application is not determined before the application information of the cloned container application is determined, then the corresponding determination can be made when the cloned container application is created. That is, before step S1051, execute: determine whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application; if the clone has not been created For the container application, step S1051 is executed.
若在确定克隆容器应用的应用信息的时候并没有判断是否有足够金额来创建克隆容器应用,那么在创建克隆容器应用的时候可进行相应的判断。在一实施例中,克隆容器应用的环境信息还包括克隆容器应用的使用时间、克隆容器应用的资源组。对应的,在确定创建所述克隆容器应用的容器实例的宿主机之前,即在步骤S1052之前,所述步骤S105还包括S1051a。If when determining the application information of the cloned container application, it is not judged whether there is enough money to create the cloned container application, then corresponding judgments can be made when creating the cloned container application. In an embodiment, the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application. Correspondingly, before determining the host for creating the container instance of the cloned container application, that is, before step S1052, the step S105 further includes S1051a.
S1051a,根据所述克隆容器应用的容器实例数量、所述克隆容器应用的使用时间、所述克隆容器应用的资源组中的剩余金额判断所述克隆容器应用的资源组中是否存在有足够金额以创建所述克隆容器应用。S1051a: Determine whether there is enough money in the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application. Create the cloned container application.
若存在足够金额来创建所述克隆容器应用,执行步骤S1052,以确定所述克隆容器应用的容器实例的宿主机。若不存在足够金额来创建所述克隆容器应用,进行提示,同时撤销之前执行的所有步骤。If there is enough money to create the cloned container application, step S1052 is executed to determine the host machine of the container instance of the cloned container application. If there is not enough money to create the cloned container application, a prompt is given, and all the steps previously performed are cancelled at the same time.
上述方法实施例实现了新增云服务中心的容器应用的克隆,除了克隆容器应用所涉及的环境信息不同,如容器实例的IP地址不一致等之外,克隆容器应用和原始容器应用的其他信息完全一致。本申请实施例中的容器应用克隆的过程自动完成,提高了新增的云服务中心搭建和配置的效率,提高了用户的体验。可以理解地,上述方法实施例实现了容器应用的克隆,在容器应用克隆的时候同时匹配新增云服务中心中的各种环境信息,如匹配新增云服务中心中的IP地址、宿主机等信息,实现了原始容器应用与新增云服务中心的环境完美匹配。The foregoing method embodiments implement the cloning of the container application of the newly added cloud service center. In addition to the different environmental information involved in the cloning of the container application, such as the inconsistent IP address of the container instance, the other information of the cloned container application and the original container application is complete. Consistent. The process of cloning the container application in the embodiment of the present application is automatically completed, which improves the efficiency of building and configuring the newly-added cloud service center, and improves the user experience. Understandably, the foregoing method embodiments implement the cloning of container applications. When the container application is cloned, various environmental information in the newly added cloud service center is matched at the same time, such as matching the IP address and host in the newly added cloud service center. Information to achieve a perfect match between the original container application and the environment of the newly added cloud service center.
图4是本申请另一实施例提供的容器应用克隆方法的流程示意图。如图4所示,所述容器应用克隆方法包括S201-S208。其中,步骤S201-S205与图1实施例中的步骤S101-S105相对应,具体请参看图1实施例中的描述,下面将具体介绍步骤S206-S208。FIG. 4 is a schematic flowchart of a container application cloning method provided by another embodiment of the present application. As shown in Figure 4, the container application cloning method includes S201-S208. Among them, steps S201-S205 correspond to steps S101-S105 in the embodiment of FIG. 1. For details, please refer to the description in the embodiment of FIG. 1. The steps S206-S208 will be specifically described below.
S206,检测所述原始容器应用是否创建了负载均衡应用。S206: Detect whether the original container application creates a load balancing application.
从保存原始容器应用的信息的数据库中获取是否创建负载均衡应用的相关信息。若原始容器应用未创建负载均衡应用,意味着该克隆容器应用克隆完成,流程结束。若原始容器应用创建了负载均衡应用,执行步骤S207。若原始容器应用创建了负载均衡应用,那么意味着克隆容器应用的时候,克隆该容器应用 所对应的负载均衡应用。Relevant information about whether to create a load balancing application is obtained from the database storing the information of the original container application. If the original container application does not create a load balancing application, it means that the cloned container application is cloned and the process ends. If the original container application creates a load balancing application, step S207 is executed. If the original container application creates a load balancing application, it means that when the container application is cloned, the load balancing application corresponding to the container application is cloned.
S207,获取所述原始容器应用的负载均衡应用的信息。S207: Acquire the load balancing application information of the original container application.
其中,原始容器应用的负载均衡应用的信息包括负载均衡应用的类型、负载均衡应用的端口信息、负载均衡应用的配置参数信息、负载均衡应用的应用镜像信息等等。Among them, the load balancing application information of the original container application includes the type of the load balancing application, port information of the load balancing application, configuration parameter information of the load balancing application, application mirroring information of the load balancing application, and so on.
S208,根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,为所述克隆容器应用创建对应的负载均衡应用。S208: Create a corresponding load balancing application for the cloned container application according to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application.
在一实施例中,如图5所示,步骤S208包括以下步骤S2081-S2083。In one embodiment, as shown in FIG. 5, step S208 includes the following steps S2081-S2083.
S2081,根据所述原始容器应用的负载均衡应用的信息中的负载均衡应用的类型确定所述克隆容器应用的负载均衡应用的类型。S2081: Determine the load balancing application type of the cloned container application according to the load balancing application type in the load balancing application information of the original container application.
将原始负载均衡应用的类型确定为克隆容器应用的负载均衡应用的类型。其中,所述负载均衡应用的类型包括F5、LVS、Haproxy、Nginx等。The type of the original load balancing application is determined as the type of the load balancing application of the cloned container application. Wherein, the types of load balancing applications include F5, LVS, Haproxy, Nginx, etc.
S2082,根据所述克隆容器应用的应用环境、所述克隆容器应用的区域,确定所述克隆容器应用的负载均衡应用的虚拟IP。S2082: Determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application.
根据克隆容器应用的应用环境、克隆容器应用的区域确定创建负载均衡应用的IP地址池;从IP地址池中获取一个空闲IP作为克隆容器应用的负载均衡应用的虚拟IP(Virtual IP,VIP)。其中,需要注意的是,若负载均衡应用的类型为LVS负载均衡应用,那么除了确定负载均衡应用的虚拟IP之外,还需要确定一个管理IP,以方便云服务中心对LVS负载均衡应用的管理。其中,确定管理IP的方式跟虚拟IP的相同。Determine the IP address pool for creating the load balancing application according to the application environment of the cloned container application and the area where the container application is cloned; obtain an idle IP from the IP address pool as the virtual IP (Virtual IP, VIP) of the load balancing application of the cloned container application. Among them, it should be noted that if the type of load balancing application is LVS load balancing application, in addition to determining the virtual IP of the load balancing application, a management IP needs to be determined to facilitate the management of the LVS load balancing application by the cloud service center . Among them, the way to determine the management IP is the same as that of the virtual IP.
S2083,根据所述原始容器应用的负载均衡应用的信息、所述虚拟IP、所述克隆容器应用的信息,调用与所述负载均衡应用类型匹配的负载均衡应用创建接口,以创建所述克隆容器应用的负载均衡应用。S2083: According to the load balancing application information of the original container application, the virtual IP, and the cloned container application information, call a load balancing application creation interface matching the load balancing application type to create the cloned container Application load balancing application.
其中,若负载均衡应用的类型为F5,步骤S2083,包括:根据所述克隆容器应用的应用环境、所述克隆容器应用的区域确定创建所述克隆容器应用的负载均衡应用的F5设备;将所创建的克隆容器应用的容器实例与所述克隆容器应用的负载均衡应用的虚拟服务器进行关联以得到关联关系,并将所述关联关系、所创建的克隆容器应用的容器实例、所述负载均衡应用的端口信息、所述负载均衡应用的配置参数信息以及所述虚拟IP封装成对象;根据封装后的对象,调用F5负载均衡应用的创建接口,以在所确定的F5设备上创建所述负载均衡应 用的虚拟服务器,并生成虚拟服务器的配置文件;若负载均衡应用创建完成,根据预设的域名生成规则生成访问域名,将所述访问域名与虚拟服务器的虚拟IP进行绑定,以通过所述访问域名来访问所述虚拟服务器。Wherein, if the type of the load balancing application is F5, step S2083 includes: determining the F5 device that creates the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application; The created container instance of the cloned container application is associated with the virtual server of the load balancing application of the cloned container application to obtain an association relationship, and the association relationship, the created container instance of the cloned container application, and the load balancing application The port information of the load balancing application, the configuration parameter information of the load balancing application, and the virtual IP are encapsulated into objects; according to the encapsulated object, the creation interface of the F5 load balancing application is called to create the load balancing on the determined F5 device The virtual server of the application, and generate the configuration file of the virtual server; if the load balancing application is created, the access domain name is generated according to the preset domain name generation rules, and the access domain name is bound with the virtual IP of the virtual server to pass the Access the domain name to access the virtual server.
若负载均衡应用的类型为LVS,步骤S2083,包括:根据所述克隆容器应用的应用环境、所述克隆容器应用的区域确定创建LVS负载均衡应用的宿主机,并在所述宿主机上创建LVS容器;根据所述虚拟IP、所创建的克隆容器应用的容器实例、所述负载均衡应用的端口信息、所述负载均衡应用的配置参数信息重构LVS负载均衡应用的配置文件;开启所述LVS容器的LVS负载均衡服务;配置所述LVS容器的子网卡,以将所述虚拟IP与所述LVS容器的子网卡进行绑定;为配置后的所述子网卡添加路由。If the type of the load balancing application is LVS, step S2083 includes: determining the host for creating the LVS load balancing application according to the application environment of the cloned container application and the region of the cloned container application, and creating the LVS on the host Container; according to the virtual IP, the created container instance of the cloned container application, the port information of the load balancing application, and the configuration parameter information of the load balancing application to reconstruct the configuration file of the LVS load balancing application; open the LVS The container's LVS load balancing service; configure the subnet card of the LVS container to bind the virtual IP with the subnet card of the LVS container; add a route to the configured subnet card.
若负载均衡应用的类型为LVS,步骤S2083,包括:述克隆容器应用的应用环境、所述克隆容器应用的区域确定创建Haproxy负载均衡应用的宿主机,并在所述宿主机上创建Haproxy容器;根据所述虚拟IP、所创建的克隆容器应用的容器实例、所述负载均衡应用的端口信息、所述负载均衡应用的配置参数信息重构Haproxy负载均衡应用的配置文件;开启所述Haproxy容器的Haproxy负载均衡服务。If the type of load balancing application is LVS, step S2083 includes: the application environment of the cloned container application, the region of the cloned container application, determining the host for creating the Haproxy load balancing application, and creating the Haproxy container on the host; Reconstruct the configuration file of the Haproxy load balancing application according to the virtual IP, the container instance of the created cloned container application, the port information of the load balancing application, and the configuration parameter information of the load balancing application; Haproxy load balancing service.
可以理解地,所创建的克隆容器应用的配置文件与原始容器应用的配置文静的不同包括:负载均衡应用的虚拟IP、容器实例信息,其他的如负载均衡应用的端口信息、所述负载均衡应用的配置参数信息等与原始容器应用中的一致。Understandably, the difference between the created configuration file of the cloned container application and the configuration of the original container application includes: the virtual IP of the load balancing application, container instance information, and other things such as the port information of the load balancing application and the load balancing application The configuration parameter information is consistent with the original container application.
该方法实施例进一步根据原始容器应用的负载均衡应用创建克隆容器应用的负载均衡应用。该方法实施例中的负载均衡应用克隆的过程自动完成,提高了新增的云服务中心搭建和配置的效率,提高了用户的体验。可以理解地,该方法实施例中若容器应用有负载均衡应用,实现容器应用的负载均衡应用的克隆,在负载均衡应用克隆的时候同时匹配新增云服务中心中的各种环境信息,如匹配新增云服务中心中的虚拟IP、宿主机等信息,实现了负载均衡应用与新增云服务中心的环境完美匹配。The method embodiment further creates a load balancing application of the cloned container application based on the load balancing application of the original container application. In this method embodiment, the process of load balancing application cloning is automatically completed, which improves the efficiency of building and configuring the newly added cloud service center, and improves the user experience. Understandably, if the container application has a load balancing application in this method embodiment, the load balancing application of the container application is cloned. When the load balancing application is cloned, various environmental information in the newly added cloud service center is matched at the same time, such as matching The virtual IP, host and other information in the new cloud service center have been added to realize the perfect match between the load balancing application and the environment of the new cloud service center.
图6是本申请实施例提供的容器应用克隆装置的示意性框图。该装置包括用于执行上述容器应用克隆方法所对应的单元。具体地,如图6所示,该装置100包括设置单元101、获取单元102、应用信息确定单元103、IP确定单元104以及应用创建单元105。Fig. 6 is a schematic block diagram of a container application cloning device provided by an embodiment of the present application. The device includes a unit corresponding to the foregoing container application cloning method. Specifically, as shown in FIG. 6, the device 100 includes a setting unit 101, an obtaining unit 102, an application information determining unit 103, an IP determining unit 104 and an application creating unit 105.
设置单元101,用于若接收到克隆设置指令,获取所述克隆设置指令中的 原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息。获取单元102,用于若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息。应用信息确定单元103,用于根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息。The setting unit 101 is configured to, if a clone setting instruction is received, obtain the original container application in the clone setting instruction, and call a preset setting interface according to the clone setting instruction to set the clone container application through the preset setting interface Environmental information. The obtaining unit 102 is configured to obtain the set environment information of the clone container application, and obtain the application information of the original container application and the environment information of the original container application if the setting completion instruction is received. The application information determining unit 103 is configured to determine the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application.
在一实施例中,所述原始容器应用的应用信息包括原始容器应用的应用镜像信息、原始容器应用的应用配置、原始容器应用的容器实例数量、容器实例所占用的资源。如图7所示,应用信息确定单元103包括镜像确定单元1031、实例数量确定单元1032、资源确定单元1033以及配置确定单元1034。其中,镜像确定单元1031,用于根据所述原始容器应用的环境信息、所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息。实例数量确定单元1032,用于根据所述原始容器应用的容器实例数量确定所述克隆容器应用的容器实例数量。资源确定单元1033,用于根据所述原始容器应用的容器实例所占用的资源确定所述克隆容器应用的容器实例需占用的资源。配置确定单元1034,用于根据所述原始容器应用的应用配置确定所述克隆容器应用的应用配置。In an embodiment, the application information of the original container application includes the application image information of the original container application, the application configuration of the original container application, the number of container instances of the original container application, and the resources occupied by the container instances. As shown in FIG. 7, the application information determining unit 103 includes a mirroring determining unit 1031, an instance number determining unit 1032, a resource determining unit 1033, and a configuration determining unit 1034. The image determining unit 1031 is configured to determine the application image information of the cloned container application according to the environment information of the original container application, the application image information of the original container application, and the environment information of the cloned container application. The instance number determining unit 1032 is configured to determine the number of container instances of the cloned container application according to the number of container instances of the original container application. The resource determining unit 1033 is configured to determine the resources to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application. The configuration determining unit 1034 is configured to determine the application configuration of the cloned container application according to the application configuration of the original container application.
在一实施例中,所述原始容器应用的环境信息包括原始容器应用的应用环境、原始容器应用的区域,所述克隆容器应用的环境信息包括克隆容器应用的应用环境、克隆容器应用的区域。所述镜像确定单元1031包括区域判断单元、应用镜像确定单元。其中,区域判断单元,用于判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致。应用镜像确定单元,用于若所述原始容器应用的应用环境与所述克隆容器应用的应用环境一致且所述原始容器应用的区域与所述克隆容器应用的区域一致,将所述原始容器应用的应用镜像信息确定为所述克隆容器应用的应用镜像信息;以及若不一致,将所述原始容器应用的应用镜像信息推送至所述克隆容器应用所对应的镜像仓库中,并将推送至镜像仓库中的该应用镜像信息确定为所述克隆容器应用的应用镜像信息。In an embodiment, the environment information of the original container application includes the application environment of the original container application and the area of the original container application, and the environment information of the cloned container application includes the application environment of the cloned container application and the area of the cloned container application. The mirror image determining unit 1031 includes an area determining unit and an application mirror determining unit. Wherein, the area judging unit is used to judge whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application. The application image determination unit is configured to: if the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the original container application The application image information of is determined to be the application image information of the cloned container application; and if inconsistencies, the application image information of the original container application is pushed to the mirror warehouse corresponding to the cloned container application, and pushed to the mirror warehouse The application image information in is determined as the application image information of the cloned container application.
在一实施例中,所述镜像确定单元1031还包括应用存在判断单元。其中,应用存在判断单元,用于根据所述克隆容器应用的应用环境、克隆容器应用的区域判断所述克隆容器应用所对应的区域中是否已经创建了所述克隆容器应 用。若未创建所述克隆容器应用,触发区域判断单元。In an embodiment, the mirror image determining unit 1031 further includes an application existence judging unit. Wherein, the application existence judgment unit is used to judge whether the clone container application has been created in the area corresponding to the clone container application according to the application environment of the clone container application and the area of the clone container application. If the clone container application is not created, the area judgment unit is triggered.
在一实施例中,所述克隆容器应用的环境信息还包括克隆容器应用的使用时间、克隆容器应用的资源组。应用信息确定单元103还包括金额判断单元。其中,金额判断单元,用于根据所述克隆容器应用的容器实例数量、所述克隆容器应用的使用时间、所述克隆容器应用的资源组中的剩余金额判断所述克隆容器应用的资源组中是否存在有足够金额以创建所述克隆容器应用。若存在足够金额以创建所述克隆容器应用,触发资源确定单元。In an embodiment, the environment information of the cloned container application further includes the usage time of the cloned container application and the resource group of the cloned container application. The application information determining unit 103 also includes an amount determining unit. Wherein, the amount judgment unit is configured to judge the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application Whether there is enough money to create the cloned container application. If there is enough money to create the cloned container application, trigger the resource determination unit.
IP确定单元104,用于根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP。The IP determining unit 104 is configured to determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application.
应用创建单元105,用于根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及克隆容器应用的容器实例IP,创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。The application creation unit 105 is configured to create a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and then combine the created container The instance is bound to the determined container instance IP of the cloned container application.
在一实施例中,如图8所示,应用创建单元105包括:应用镜像获取单元1051、宿主机确定单元1052、容器实例创建单元1053以及IP绑定单元1054。其中,应用镜像获取单元1051,用于根据所述克隆容器应用的应用镜像信息,从所述克隆容器应用所对应的镜像仓库中获取所述克隆容器应用的应用镜像。宿主机确定单元1052,用于根据所述克隆容器应用的应用环境、所述克隆容器应用的区域、所述克隆容器应用的容器实例数量以及所述克隆容器应用的容器实例需占用的资源,确定创建所述克隆容器应用的容器实例的宿主机。容器实例创建单元1053,用于根据所述克隆容器应用的应用镜像、所述克隆容器应用的应用配置在所确定的宿主机上创建所述克隆容器应用的容器实例,并设置所述克隆容器应用的应用配置。IP绑定单元1054,将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。In an embodiment, as shown in FIG. 8, the application creation unit 105 includes: an application image acquisition unit 1051, a host determination unit 1052, a container instance creation unit 1053, and an IP binding unit 1054. Wherein, the application image obtaining unit 1051 is configured to obtain the application image of the clone container application from the mirror warehouse corresponding to the clone container application according to the application image information of the clone container application. The host determining unit 1052 is configured to determine according to the application environment of the cloned container application, the area of the cloned container application, the number of container instances of the cloned container application, and the resources required to be occupied by the container instances of the cloned container application Create a host machine of the container instance of the cloned container application. The container instance creation unit 1053 is configured to create a container instance of the clone container application on the determined host machine according to the application image of the clone container application and the application configuration of the clone container application, and set the clone container application Application configuration. The IP binding unit 1054 binds the created container instance with the determined container instance IP of the cloned container application.
在一实施例中,若若在确定克隆容器应用的应用信息之前,并没有判断是否已经创建了克隆容器应用,那么在创建克隆容器应用的时候可进行相应的判断。所述应用创建单元105还包括应用存在判断单元。其中,存在判断单元,用于根据所述克隆容器应用的应用环境、克隆容器应用的区域判断所述克隆容器应用所对应的区域中是否已经创建了所述克隆容器应用。若未创建所述克隆容器应用,接着触发应用镜像获取单元1051。In one embodiment, if it is not determined whether the clone container application has been created before determining the application information of the clone container application, then a corresponding determination can be made when the clone container application is created. The application creation unit 105 also includes an application existence judgment unit. Wherein, there is a judging unit for judging whether the cloned container application has been created in the area corresponding to the cloned container application according to the application environment of the cloned container application and the area of the cloned container application. If the cloned container application is not created, then the application image acquiring unit 1051 is triggered.
在一实施例中,若在确定克隆容器应用的应用信息的时候并没有判断是否 有足够金额来创建克隆容器应用,那么在创建克隆容器应用的时候可进行相应的判断。所述应用创建单元105还包括金额判断单元1051a。其中,金额判断单元1051a,用于根据所述克隆容器应用的容器实例数量、所述克隆容器应用的使用时间、所述克隆容器应用的资源组中的剩余金额判断所述克隆容器应用的资源组中是否存在有足够金额以创建所述克隆容器应用。若存在足够金以来创建所述克隆容器应用,触发所述宿主机确定单元1052。In one embodiment, if the application information of the cloned container application is not determined when determining whether there is enough money to create the cloned container application, then a corresponding determination can be made when the cloned container application is created. The application creation unit 105 also includes an amount judgment unit 1051a. The amount judgment unit 1051a is configured to judge the resource group of the clone container application according to the number of container instances of the clone container application, the usage time of the clone container application, and the remaining amount in the resource group of the clone container application Whether there is enough money in the database to create the cloned container application. If there is enough gold to create the cloned container application, the host determining unit 1052 is triggered.
在一实施例中,如图9所示,是本申请另一实施例提供的容器应用克隆装置的示意性框图。该容器应用克隆装置200包括设置单元201、获取单元202、应用信息确定单元203、IP确定单元204、应用创建单元205、负载检测单元206、负载获取单元207以及负载创建单元208。其中,设置单元201、获取单元202、应用信息确定单元203、IP确定单元204、应用创建单元205与图6实施例中的设置单元101、获取单元102、应用信息确定单元103、IP确定单元104以及应用创建单元105分别对应,具体地,请参看图6实施例的描述。下面将详细描述本申请实施例与图6实施例的区别之处:负载检测单元206、负载获取单元207以及负载创建单元208。In one embodiment, as shown in FIG. 9, it is a schematic block diagram of a container application cloning device provided by another embodiment of the present application. The container application cloning device 200 includes a setting unit 201, an acquisition unit 202, an application information determination unit 203, an IP determination unit 204, an application creation unit 205, a load detection unit 206, a load acquisition unit 207, and a load creation unit 208. Among them, the setting unit 201, the acquiring unit 202, the application information determining unit 203, the IP determining unit 204, the application creating unit 205 are the same as the setting unit 101, the acquiring unit 102, the application information determining unit 103, and the IP determining unit 104 in the embodiment of FIG. And the application creation unit 105 respectively correspond. Specifically, please refer to the description of the embodiment in FIG. 6. The differences between the embodiment of the present application and the embodiment in FIG. 6 will be described in detail below: the load detection unit 206, the load acquisition unit 207, and the load creation unit 208.
负载检测单元206,用于检测所述原始容器应用是否创建了负载均衡应用。负载获取单元207,用于若所述原始容器应用创建了负载均衡应用,获取所述原始容器应用的负载均衡应用的信息。负载创建单元208,用于根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息为所述克隆容器应用创建对应的负载均衡应用。The load detection unit 206 is configured to detect whether the original container application creates a load balancing application. The load obtaining unit 207 is configured to obtain load balancing application information of the original container application if the original container application creates a load balancing application. The load creating unit 208 is configured to create a corresponding load balancing application for the cloned container application according to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application.
在一实施例中,负载创建单元208包括:类型确定单元、虚拟IP确定单元以及负载创建单元。其中,类型确定单元,用于根据所述原始容器应用的负载均衡应用的信息中的负载均衡应用的类型确定所述克隆容器应用的负载均衡应用的类型。虚拟IP确定单元,用于根据所述克隆容器应用的应用环境、所述克隆容器应用的区域确定所述克隆容器应用的负载均衡应用的虚拟IP。负载创建单元,用于根据所述原始容器应用的负载均衡应用的信息、所述虚拟IP、所述克隆容器应用的容器实例信息调用与所述负载均衡应用类型匹配的负载均衡应用创建接口,以创建所述克隆容器应用的负载均衡应用。In an embodiment, the load creation unit 208 includes: a type determination unit, a virtual IP determination unit, and a load creation unit. Wherein, the type determining unit is configured to determine the type of the load balancing application of the cloned container application according to the type of the load balancing application in the information of the load balancing application of the original container application. The virtual IP determining unit is configured to determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the area of the cloned container application. The load creation unit is configured to call the load balancing application creation interface matching the load balancing application type according to the load balancing application information of the original container application, the virtual IP, and the container instance information of the cloned container application, to Create a load balancing application of the cloned container application.
需要说明的是,所属领域的技术人员可以清楚地了解到,上述装置和各单元的具体实现过程,可以参考前述方法实施例中的相应描述,为了描述的方便和简洁,在此不再赘述。It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned device and each unit can refer to the corresponding description in the foregoing method embodiment. For the convenience and brevity of the description, it will not be repeated here.
上述装置可以实现为一种计算机程序的形式,计算机程序可以在如图10所示的计算机设备上运行。The above device may be implemented in the form of a computer program, and the computer program may run on the computer device as shown in FIG. 10.
图10为本申请实施例提供的一种计算机设备的示意性框图。该设备为终端等设备,如PaaS平台中的服务器等。该设备300包括通过系统总线301连接的处理器302、存储器和网络接口303,其中,存储器可以包括非易失性存储介质304和内存储器305。FIG. 10 is a schematic block diagram of a computer device according to an embodiment of the application. The equipment is a terminal and other equipment, such as a server in the PaaS platform. The device 300 includes a processor 302, a memory, and a network interface 303 connected through a system bus 301, where the memory may include a non-volatile storage medium 304 and an internal memory 305.
该非易失性存储介质304可存储操作系统3041和计算机程序3042。该非易失性存储介质中所存储的计算机程序3042被处理器302执行时,可实现上述所述的容器应用克隆方法。该处理器302用于提供计算和控制能力,支撑整个设备300的运行。该内存储器305为非易失性存储介质中的计算机程序的运行提供环境,该计算机程序被处理器302执行时,可使得处理器302执行上述所述的容器应用克隆方法。该网络接口303用于进行网络通信。本领域技术人员可以理解,图中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的设备的限定,具体的设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The non-volatile storage medium 304 can store an operating system 3041 and a computer program 3042. When the computer program 3042 stored in the non-volatile storage medium is executed by the processor 302, the container application cloning method described above can be implemented. The processor 302 is used to provide computing and control capabilities and support the operation of the entire device 300. The internal memory 305 provides an environment for running a computer program in a non-volatile storage medium. When the computer program is executed by the processor 302, the processor 302 can execute the container application cloning method described above. The network interface 303 is used for network communication. Those skilled in the art can understand that the structure shown in the figure is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the device to which the solution of the present application is applied. The specific device may include a diagram More or fewer components are shown in, or some components are combined, or have different component arrangements.
其中,所述处理器302用于运行存储在存储器中的计算机程序,以实现上述容器应用克隆方法的任一实施例。Wherein, the processor 302 is configured to run a computer program stored in a memory to implement any embodiment of the container application cloning method.
应当理解,在本申请实施例中,所称处理器302可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(应用程序lication Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in the embodiment of the present application, the processor 302 may be a central processing unit (CPU), and the processor may also be other general-purpose processors or digital signal processors (DSP). , Application-specific integrated circuit (application license Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
本领域普通技术人员可以理解的是实现上述实施例的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成。该计算机程序可存储于一存储介质中,该存储介质可以为计算机可读存储介质。该计算机程序被该计算机系统中的至少一个处理器执行,以实现上述方法的实施例的流程步骤。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the foregoing embodiments can be implemented by computer programs instructing relevant hardware. The computer program may be stored in a storage medium, and the storage medium may be a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the foregoing method embodiment.
因此,本申请还提供了一种存储介质。该存储介质可以为计算机可读存储介质,该计算机可读存储介质包括非易失性计算机可读存储介质。该存储介质存储有计算机程序,该计算机程序当被处理器执行时实现上述容器应用克隆方 式的任一实施例。Therefore, this application also provides a storage medium. The storage medium may be a computer-readable storage medium, and the computer-readable storage medium includes a non-volatile computer-readable storage medium. The storage medium stores a computer program that, when executed by a processor, implements any embodiment of the container application cloning method.
所述存储介质为实体的、非瞬时性的存储介质,例如可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的实体存储介质。The storage medium is a physical, non-transitory storage medium, such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. medium.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置、设备和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置、设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。In the several embodiments provided in this application, it should be understood that the disclosed devices, equipment, and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, and the division of the units is only a logical function division, and there may be other division methods in actual implementation. Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working processes of the devices, equipment and units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here. The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Anyone familiar with the technical field can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种容器应用克隆方法,包括:A method of container application cloning includes:
    若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息;If a clone setting instruction is received, the original container application in the clone setting instruction is acquired, and a preset setting interface is called according to the clone setting instruction to set the environment information of the cloned container application through the preset setting interface;
    若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息;If the setting completion instruction is received, obtain the environment information of the cloned container application that is set, and obtain the application information of the original container application and the environment information of the original container application;
    根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息;Determining the application information of the clone container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the clone container application;
    根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP;Determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application;
    根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。Create the container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combine the created container instance with the determined all Bind the container instance IP of the cloned container application.
  2. 根据权利要求1所述的方法,其中,所述原始容器应用的应用信息包括原始容器应用的应用镜像信息、应用配置、容器实例数量、容器实例所占用的资源;The method according to claim 1, wherein the application information of the original container application includes application image information of the original container application, application configuration, number of container instances, and resources occupied by the container instances;
    所述根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息,包括:The determining the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application includes:
    根据所述原始容器应用的环境信息和所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息;Determine the application image information of the cloned container application according to the environment information of the original container application and the application image information of the original container application, and the environment information of the cloned container application;
    根据所述原始容器应用的容器实例数量确定所述克隆容器应用的容器实例数量;Determining the number of container instances of the cloned container application according to the number of container instances of the original container application;
    根据所述原始容器应用的容器实例所占用的资源确定所述克隆容器应用的容器实例需占用的资源;Determine the resources to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application;
    根据所述原始容器应用的应用配置确定所述克隆容器应用的应用配置。The application configuration of the cloned container application is determined according to the application configuration of the original container application.
  3. 根据权利要求2所述的方法,其中,所述原始容器应用的环境信息包括原始容器应用的应用环境、原始容器应用的区域,所述克隆容器应用的环境信息包括克隆容器应用的应用环境、克隆容器应用的区域;The method according to claim 2, wherein the environment information of the original container application includes the application environment of the original container application, the area of the original container application, and the environment information of the cloned container application includes the application environment of the cloned container application, the clone The area where the container is applied;
    所述根据所述原始容器应用的环境信息和所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息, 包括:The determining the application image information of the cloned container application according to the environment information of the original container application and the application image information of the original container application, and the environment information of the cloned container application includes:
    判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致;Determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application;
    若所述原始容器应用的应用环境与所述克隆容器应用的应用环境一致且所述原始容器应用的区域与所述克隆容器应用的区域一致,将所述原始容器应用的应用镜像信息确定为所述克隆容器应用的应用镜像信息;If the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the application image information of the original container application is determined to be all The application image information of the cloned container application;
    否则将所述原始容器应用的应用镜像信息推送至所述克隆容器应用所对应的镜像仓库中,并将推送至镜像仓库中的该应用镜像信息确定为所述克隆容器应用的应用镜像信息。Otherwise, the application image information of the original container application is pushed to the image warehouse corresponding to the cloned container application, and the application image information pushed to the image warehouse is determined as the application image information of the cloned container application.
  4. 根据权利要求1所述的方法,其中,所述克隆容器应用的应用信息包括所述克隆容器应用的应用镜像信息、容器实例数量、容器实例需占用的资源、应用配置;所述克隆容器应用的环境信息包括所述克隆容器应用的应用环境、所述克隆容器应用的区域;The method according to claim 1, wherein the application information of the cloned container application includes the application image information of the cloned container application, the number of container instances, the resources to be occupied by the container instances, and the application configuration; The environment information includes the application environment of the cloned container application and the area of the cloned container application;
    所述根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定,包括:The creating a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combining the created container instance with the determined container instance The binding of the container instance IP of the cloned container application includes:
    根据所述克隆容器应用的应用镜像信息,从所述克隆容器应用所对应的镜像仓库中获取所述克隆容器应用的应用镜像;Obtaining the application image of the cloned container application from the mirror warehouse corresponding to the cloned container application according to the application image information of the cloned container application;
    根据所述克隆容器应用的应用环境、区域、容器实例数量以及容器实例需占用的资源,确定创建所述克隆容器应用的容器实例的宿主机;Determine the host machine for creating the container instance of the cloned container application according to the application environment, area, number of container instances, and the resources required by the container instance of the cloned container application;
    根据所述克隆容器应用的应用镜像、应用配置,在所确定的宿主机上创建所述克隆容器应用的容器实例,并设置所述克隆容器应用的应用配置;According to the application image and application configuration of the cloned container application, create a container instance of the cloned container application on the determined host machine, and set the application configuration of the cloned container application;
    将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。Bind the created container instance with the determined container instance IP of the cloned container application.
  5. 根据权利要求4所述的方法,其中,所述克隆容器应用的环境信息还包括克隆容器应用的使用时间、克隆容器应用的资源组;The method according to claim 4, wherein the environment information of the cloned container application further comprises the usage time of the cloned container application and the resource group of the cloned container application;
    所述方法还包括:根据所述克隆容器应用的容器实例数量、使用时间、资源组中的剩余金额判断所述资源组中是否存在有足够金额以创建所述克隆容器应用;The method further includes: judging whether there is enough money in the resource group to create the clone container application according to the number of container instances of the clone container application, usage time, and the remaining amount in the resource group;
    若所述资源组中存在足够金额以创建所述克隆容器应用,执行所述根据所述克隆容器应用的应用环境、区域、容器实例数量以及容器实例需占用的资源,确 定创建所述克隆容器应用的容器实例的宿主机的步骤。If there is a sufficient amount in the resource group to create the cloned container application, execute the process of determining to create the cloned container application according to the application environment, region, number of container instances, and the resources required by the container instances of the cloned container application The steps of the host of the container instance.
  6. 根据权利要求1所述的方法,其中,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    检测所述原始容器应用是否创建了负载均衡应用;Detecting whether the original container application creates a load balancing application;
    若所述原始容器应用创建了负载均衡应用,获取所述原始容器应用的负载均衡应用的信息;If the original container application creates a load balancing application, acquiring information about the load balancing application of the original container application;
    根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,为所述克隆容器应用创建对应的负载均衡应用。According to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application, a corresponding load balancing application is created for the cloned container application.
  7. 根据权利要求6所述的方法,其中,所述根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,为所述克隆容器应用创建对应的负载均衡应用,包括:The method according to claim 6, wherein the information of the load balancing application according to the original container application, the application information of the cloned container application, and the environment information of the cloned container application are the cloned container application Create the corresponding load balancing application, including:
    根据所述原始容器应用的负载均衡应用的信息中的负载均衡应用的类型确定所述克隆容器应用的负载均衡应用的类型;Determining the type of the load balancing application of the cloned container application according to the type of the load balancing application in the information of the load balancing application of the original container application;
    根据所述克隆容器应用的应用环境、所述克隆容器应用的区域,确定所述克隆容器应用的负载均衡应用的虚拟IP;Determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application;
    根据所述原始容器应用的负载均衡应用的信息、所述虚拟IP、所述克隆容器应用的容器实例信息,调用与所述负载均衡应用类型匹配的负载均衡应用创建接口,以创建所述克隆容器应用的负载均衡应用。According to the load balancing application information of the original container application, the virtual IP, and the container instance information of the cloned container application, call the load balancing application creation interface matching the load balancing application type to create the cloned container Application load balancing application.
  8. 根据权利要求2所述的方法,其中,所述容器实例所占用的资源包括所述容器实例所占用的CPU比率以及所占用的内存大小。The method according to claim 2, wherein the resources occupied by the container instance include the ratio of CPU occupied by the container instance and the memory size occupied by the container instance.
  9. 根据权利要求6所述的方法,其中,原始容器应用的负载均衡应用的信息包括负载均衡应用的类型、负载均衡应用的端口信息、负载均衡应用的配置参数信息、负载均衡应用的应用镜像信息。The method according to claim 6, wherein the information of the load balancing application of the original container application includes the type of the load balancing application, port information of the load balancing application, configuration parameter information of the load balancing application, and application mirroring information of the load balancing application.
  10. 一种容器应用克隆装置,包括:A container application cloning device, including:
    设置单元,用于若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息;The setting unit is configured to, if a clone setting instruction is received, obtain the original container application in the clone setting instruction, and call a preset setting interface according to the clone setting instruction to set the clone container application through the preset setting interface Environmental information;
    获取单元,用于若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息;The obtaining unit is configured to obtain the set environment information of the cloned container application, and obtain the application information of the original container application and the environment information of the original container application if the setting completion instruction is received;
    应用信息确定单元,用于根据所述原始容器应用的应用信息和所述原始容器 应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息;An application information determining unit, configured to determine the application information of the cloned container application according to the application information of the original container application and the environmental information of the original container application, and the environmental information of the cloned container application;
    IP确定单元,用于根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息确定所述克隆容器应用的容器实例IP;An IP determining unit, configured to determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application;
    创建单元,用于根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。The creation unit is configured to create a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the IP of the container instance of the cloned container application, and combine the created container instance Binding with the determined container instance IP of the cloned container application.
  11. 一种计算机设备,包括存储器,以及与所述存储器相连的处理器;其中,所述存储器用于存储计算机程序;所述处理器用于运行所述存储器中存储的计算机程序,以执行以下步骤:A computer device includes a memory and a processor connected to the memory; wherein the memory is used to store a computer program; the processor is used to run the computer program stored in the memory to perform the following steps:
    若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息;If a clone setting instruction is received, the original container application in the clone setting instruction is acquired, and a preset setting interface is called according to the clone setting instruction to set the environment information of the cloned container application through the preset setting interface;
    若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息;If the setting completion instruction is received, obtain the environment information of the cloned container application that is set, and obtain the application information of the original container application and the environment information of the original container application;
    根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息;Determining the application information of the clone container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the clone container application;
    根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP;Determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application;
    根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。Create the container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combine the created container instance with the determined all Bind the container instance IP of the cloned container application.
  12. 根据权利要求11所述的计算机设备,其中,所述原始容器应用的应用信息包括原始容器应用的应用镜像信息、应用配置、容器实例数量、容器实例所占用的资源;The computer device according to claim 11, wherein the application information of the original container application includes application image information of the original container application, application configuration, number of container instances, and resources occupied by the container instances;
    所述根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息,包括:The determining the application information of the cloned container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the cloned container application includes:
    根据所述原始容器应用的环境信息和所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息;Determine the application image information of the cloned container application according to the environment information of the original container application and the application image information of the original container application, and the environment information of the cloned container application;
    根据所述原始容器应用的容器实例数量确定所述克隆容器应用的容器实例 数量;Determining the number of container instances of the cloned container application according to the number of container instances of the original container application;
    根据所述原始容器应用的容器实例所占用的资源确定所述克隆容器应用的容器实例需占用的资源;Determine the resources to be occupied by the container instance of the cloned container application according to the resources occupied by the container instance of the original container application;
    根据所述原始容器应用的应用配置确定所述克隆容器应用的应用配置。The application configuration of the cloned container application is determined according to the application configuration of the original container application.
  13. 根据权利要求12所述的计算机设备,其中,所述原始容器应用的环境信息包括原始容器应用的应用环境、原始容器应用的区域,所述克隆容器应用的环境信息包括克隆容器应用的应用环境、克隆容器应用的区域;The computer device according to claim 12, wherein the environmental information of the original container application includes the application environment of the original container application and the area of the original container application, and the environmental information of the cloned container application includes the application environment of the cloned container application, Clone the container application area;
    所述根据所述原始容器应用的环境信息和所述原始容器应用的应用镜像信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用镜像信息,包括:The determining the application image information of the cloned container application according to the environment information of the original container application and the application image information of the original container application, and the environment information of the cloned container application includes:
    判断所述原始容器应用的应用环境与所述克隆容器应用的应用环境是否一致且所述原始容器应用的区域与所述克隆容器应用的区域是否一致;Determining whether the application environment of the original container application is consistent with the application environment of the cloned container application and whether the area of the original container application is consistent with the area of the cloned container application;
    若所述原始容器应用的应用环境与所述克隆容器应用的应用环境一致且所述原始容器应用的区域与所述克隆容器应用的区域一致,将所述原始容器应用的应用镜像信息确定为所述克隆容器应用的应用镜像信息;If the application environment of the original container application is consistent with the application environment of the cloned container application and the area of the original container application is consistent with the area of the cloned container application, the application image information of the original container application is determined to be all The application image information of the cloned container application;
    否则将所述原始容器应用的应用镜像信息推送至所述克隆容器应用所对应的镜像仓库中,并将推送至镜像仓库中的该应用镜像信息确定为所述克隆容器应用的应用镜像信息。Otherwise, the application image information of the original container application is pushed to the image warehouse corresponding to the cloned container application, and the application image information pushed to the image warehouse is determined as the application image information of the cloned container application.
  14. 根据权利要求11所述的计算机设备,其中,所述克隆容器应用的应用信息包括所述克隆容器应用的应用镜像信息、容器实例数量、容器实例需占用的资源、应用配置;所述克隆容器应用的环境信息包括所述克隆容器应用的应用环境、所述克隆容器应用的区域;The computer device according to claim 11, wherein the application information of the cloned container application includes application image information of the cloned container application, the number of container instances, the resources that the container instances need to occupy, and the application configuration; the cloned container application The environment information includes the application environment of the cloned container application and the area of the cloned container application;
    所述根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定,包括:The creating a container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combining the created container instance with the determined container instance The binding of the container instance IP of the cloned container application includes:
    根据所述克隆容器应用的应用镜像信息,从所述克隆容器应用所对应的镜像仓库中获取所述克隆容器应用的应用镜像;Obtaining the application image of the cloned container application from the mirror warehouse corresponding to the cloned container application according to the application image information of the cloned container application;
    根据所述克隆容器应用的应用环境、区域、容器实例数量以及容器实例需占用的资源,确定创建所述克隆容器应用的容器实例的宿主机;Determine the host machine for creating the container instance of the cloned container application according to the application environment, area, number of container instances, and the resources required by the container instance of the cloned container application;
    根据所述克隆容器应用的应用镜像、应用配置,在所确定的宿主机上创建所 述克隆容器应用的容器实例,并设置所述克隆容器应用的应用配置;According to the application image and application configuration of the cloned container application, create a container instance of the cloned container application on the determined host machine, and set the application configuration of the cloned container application;
    将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。Bind the created container instance with the determined container instance IP of the cloned container application.
  15. 根据权利要求14所述的计算机设备,其中,所述克隆容器应用的环境信息还包括克隆容器应用的使用时间、克隆容器应用的资源组;The computer device according to claim 14, wherein the environment information of the cloned container application further comprises the usage time of the cloned container application and the resource group of the cloned container application;
    所述方法还包括:根据所述克隆容器应用的容器实例数量、使用时间、资源组中的剩余金额判断所述资源组中是否存在有足够金额以创建所述克隆容器应用;The method further includes: judging whether there is enough money in the resource group to create the clone container application according to the number of container instances of the clone container application, usage time, and the remaining amount in the resource group;
    若所述资源组中存在足够金额以创建所述克隆容器应用,执行所述根据所述克隆容器应用的应用环境、区域、容器实例数量以及容器实例需占用的资源,确定创建所述克隆容器应用的容器实例的宿主机的步骤。If there is a sufficient amount in the resource group to create the cloned container application, execute the process of determining to create the cloned container application according to the application environment, region, number of container instances, and the resources required by the container instances of the cloned container application The steps of the host of the container instance.
  16. 根据权利要求11所述的计算机设备,其中,还包括:The computer device according to claim 11, further comprising:
    检测所述原始容器应用是否创建了负载均衡应用;Detecting whether the original container application creates a load balancing application;
    若所述原始容器应用创建了负载均衡应用,获取所述原始容器应用的负载均衡应用的信息;If the original container application creates a load balancing application, acquiring information about the load balancing application of the original container application;
    根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,为所述克隆容器应用创建对应的负载均衡应用。According to the load balancing application information of the original container application, the application information of the cloned container application, and the environment information of the cloned container application, a corresponding load balancing application is created for the cloned container application.
  17. 根据权利要求16所述的计算机设备,其中,所述根据所述原始容器应用的负载均衡应用的信息、所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,为所述克隆容器应用创建对应的负载均衡应用,包括:The computer device according to claim 16, wherein the information of the load balancing application according to the original container application, the application information of the clone container application, and the environment information of the clone container application are the clone container Application to create corresponding load balancing applications, including:
    根据所述原始容器应用的负载均衡应用的信息中的负载均衡应用的类型确定所述克隆容器应用的负载均衡应用的类型;Determining the type of the load balancing application of the cloned container application according to the type of the load balancing application in the information of the load balancing application of the original container application;
    根据所述克隆容器应用的应用环境、所述克隆容器应用的区域,确定所述克隆容器应用的负载均衡应用的虚拟IP;Determine the virtual IP of the load balancing application of the cloned container application according to the application environment of the cloned container application and the region of the cloned container application;
    根据所述原始容器应用的负载均衡应用的信息、所述虚拟IP、所述克隆容器应用的容器实例信息,调用与所述负载均衡应用类型匹配的负载均衡应用创建接口,以创建所述克隆容器应用的负载均衡应用。According to the load balancing application information of the original container application, the virtual IP, and the container instance information of the cloned container application, call the load balancing application creation interface matching the load balancing application type to create the cloned container Application load balancing application.
  18. 根据权利要求12所述的计算机设备,其中,所述容器实例所占用的资源包括所述容器实例所占用的CPU比率以及所占用的内存大小。The computer device according to claim 12, wherein the resources occupied by the container instance include the ratio of the CPU occupied by the container instance and the amount of memory occupied.
  19. 根据权利要求16所述的计算机设备,其中,原始容器应用的负载均衡应 用的信息包括负载均衡应用的类型、负载均衡应用的端口信息、负载均衡应用的配置参数信息、负载均衡应用的应用镜像信息。The computer device according to claim 16, wherein the information of the load balancing application of the original container application includes the type of the load balancing application, port information of the load balancing application, configuration parameter information of the load balancing application, and application mirroring information of the load balancing application .
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时使所述处理器执行以下操作:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor performs the following operations:
    若接收到克隆设置指令,获取所述克隆设置指令中的原始容器应用,并根据所述克隆设置指令调用预设设置接口,以通过所述预设设置接口设置克隆容器应用的环境信息;If a clone setting instruction is received, the original container application in the clone setting instruction is acquired, and a preset setting interface is called according to the clone setting instruction to set the environment information of the cloned container application through the preset setting interface;
    若接收到设置完成指令,获取所设置的克隆容器应用的环境信息,并获取所述原始容器应用的应用信息和所述原始容器应用的环境信息;If the setting completion instruction is received, obtain the environment information of the cloned container application that is set, and obtain the application information of the original container application and the environment information of the original container application;
    根据所述原始容器应用的应用信息和所述原始容器应用的环境信息,以及所述克隆容器应用的环境信息,确定所述克隆容器应用的应用信息;Determining the application information of the clone container application according to the application information of the original container application and the environment information of the original container application, and the environment information of the clone container application;
    根据所述克隆容器应用的应用信息和所述克隆容器应用的环境信息,确定所述克隆容器应用的容器实例IP;Determine the container instance IP of the cloned container application according to the application information of the cloned container application and the environment information of the cloned container application;
    根据所述克隆容器应用的应用信息、所述克隆容器应用的环境信息以及所述克隆容器应用的容器实例IP创建所述克隆容器应用的容器实例,并将所创建的容器实例与所确定的所述克隆容器应用的容器实例IP进行绑定。Create the container instance of the cloned container application according to the application information of the cloned container application, the environment information of the cloned container application, and the container instance IP of the cloned container application, and combine the created container instance with the determined all Bind the container instance IP of the cloned container application.
PCT/CN2019/103176 2019-05-17 2019-08-29 Container application cloning method and apparatus, computer device and storage medium WO2020232888A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910410621.XA CN110290172B (en) 2019-05-17 2019-05-17 Container application cloning method and device, computer equipment and storage medium
CN201910410621.X 2019-05-17

Publications (1)

Publication Number Publication Date
WO2020232888A1 true WO2020232888A1 (en) 2020-11-26

Family

ID=68002161

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103176 WO2020232888A1 (en) 2019-05-17 2019-08-29 Container application cloning method and apparatus, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN110290172B (en)
WO (1) WO2020232888A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11650809B2 (en) 2021-06-15 2023-05-16 International Business Machines Corporation Autonomous and optimized cloning, reinstating, and archiving of an application in a containerized platform

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130346976A1 (en) * 2008-11-11 2013-12-26 Netapp Inc. Cloning virtual machines
CN104639374A (en) * 2015-03-03 2015-05-20 上海瀚银信息技术有限公司 Application program deployment management system
CN107908460A (en) * 2017-11-23 2018-04-13 平安科技(深圳)有限公司 Virtual machine rapid volume-expanding method, device, equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101702656B (en) * 2009-11-11 2011-11-30 北京神州泰岳软件股份有限公司 Discovery method of network topology based on MPLS-VPN
CN103793259B (en) * 2013-09-30 2017-02-22 中国电子设备系统工程公司研究所 Virtual device generating and deploying method
CN106936882A (en) * 2015-12-31 2017-07-07 深圳先进技术研究院 A kind of electronic article transaction system
CN105678156B (en) * 2016-01-04 2019-06-28 成都卫士通信息产业股份有限公司 A kind of cloud cryptographic service platform and its workflow based on virtualization technology
CN107526626B (en) * 2017-08-24 2020-12-01 武汉大学 Docker container thermal migration method and system based on CRIU

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130346976A1 (en) * 2008-11-11 2013-12-26 Netapp Inc. Cloning virtual machines
CN104639374A (en) * 2015-03-03 2015-05-20 上海瀚银信息技术有限公司 Application program deployment management system
CN107908460A (en) * 2017-11-23 2018-04-13 平安科技(深圳)有限公司 Virtual machine rapid volume-expanding method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11650809B2 (en) 2021-06-15 2023-05-16 International Business Machines Corporation Autonomous and optimized cloning, reinstating, and archiving of an application in a containerized platform

Also Published As

Publication number Publication date
CN110290172B (en) 2022-02-11
CN110290172A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
US10324754B2 (en) Managing virtual machine patterns
US20120180044A1 (en) Communications Between Virtual Machines That Have Been Migrated
CN110289983B (en) Load balancing application creation method and device, computer equipment and storage medium
US9400669B2 (en) Virtual appliance chaining and management
CN108287708B (en) Data processing method and device, server and computer readable storage medium
CN109995814B (en) Cloud host resource migration method and device, communication equipment and storage medium
US10001989B2 (en) Verifying source code in disparate source control systems
WO2020232887A1 (en) Configuration modification method and apparatus for container application, and computer device and storage medium
US20190007320A1 (en) Virtual Network Function Load Balancer
US10783073B2 (en) Chronologically ordered out-of-place update key-value storage system
CN109032753B (en) Heterogeneous virtual machine hard disk hosting method and system, storage medium and Nova platform
WO2020232888A1 (en) Container application cloning method and apparatus, computer device and storage medium
US11195137B2 (en) Model-driven and automated system for shared resource solution design
US9870304B2 (en) System for verifying historical artifacts in disparate source control systems
WO2020252921A1 (en) Multi-active load balancing application expansion method, application, device, and storage medium
WO2021140397A1 (en) Safely processing integrated flows of messages in a multi-tenant container
CN111124614B (en) Virtual machine migration flow control test method, device, equipment and storage medium
US9032326B2 (en) Late instantiation of dependent objects
CN109783196B (en) Virtual machine migration method and device
WO2023050956A1 (en) Automatic selection of nodes on which to perform tasks
US11645583B2 (en) Automatic rule learning in shared resource solution design
US11929889B2 (en) Connection management based on server feedback using recent connection request service times
CN110278243B (en) Load balancing application management method and device, computer equipment and storage medium
JP7048898B2 (en) Systems, methods, and programs
US11748236B2 (en) Multi-user debugging with user data isolation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19929922

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19929922

Country of ref document: EP

Kind code of ref document: A1