Development environment creation method, storage medium, electronic device and computer program product
By creating a symbiotic container that supports pause in the container orchestration platform, the problem that the development environment cannot enter the pause state caused by the inability to pause the placeholder container group, and the efficient utilization of resources and the rapid state transition of the development environment are achieved.
Patent Information
- Application Number
- CN202411353508.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-09-26
AI Technical Summary
Since the placeholder container group does not support the pause function, the development environment cannot enter the pause state from the running state, and the existing technology has not effectively solved this problem.
By creating a symbiotic container in the container orchestration platform and using it as the carrier of the development environment, the symbiotic container supports the pause function, thereby realizing the pause state transition of the development environment.
It realizes the transformation of the development environment from the operating state to the paused state, solves the resource release problem caused by the inability to pause the placeholder container group, and improves the resource utilization efficiency and the management efficiency of the development environment.
Smart Images

Figure CN118885158B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and in particular, to a method for creating a development environment, a storage medium, an electronic device, and a computer program product. Background Art
[0002] Artificial intelligence development platforms are usually based on container orchestration platforms (Kubernetes), providing users with development environments, training tasks and other functions for model development. In artificial intelligence development platforms, when computing resources are tight, it is necessary to make the development environment enter the paused state from the running state and release the computing resources it occupies to ensure that model training can proceed normally. After the model training is completed, the computing resources are reallocated to the development environment to restore it from the paused state to the running state. The container orchestration platform uses the container group (Pod) as the smallest deployment management unit. However, Pod does not support the pause function and can only release resources by deleting the Pod. Since the placeholder container group (shadowpod) is a type of Pod and does not support the pause function, the container orchestration platform with Pod as the smallest deployment management unit cannot make the development environment enter the paused state from the running state.
[0003] In the related art, since the placeholder container group cannot be paused, resulting in the development environment being unable to enter the paused state from the running state, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a method for creating a development environment, a storage medium, an electronic device, and a computer program product to at least solve the problem that the development environment cannot enter a paused state from a running state because a placeholder container group cannot be paused.
[0005] According to an embodiment of the present application, a method for creating a development environment is provided, which is applied to a container orchestration platform, wherein the container orchestration platform includes a management node and multiple computing nodes, wherein the management node has a database component, a development platform control component, and a resource management component; wherein the computing node has a container runtime and a development platform daemon component, comprising: through the development platform control component, when a creation event of a development platform resource is monitored in the database component, a placeholder container group corresponding to the development platform resource is created in the database component, wherein the development platform resource is a custom resource in the container orchestration platform; through the resource management component, In the case where a creation event of the placeholder container group is monitored in the database component, a computing node is allocated to the placeholder container group; through the development platform daemon component in the target computing node, in the case where the state of the placeholder container group in the database component is monitored to be a running state, the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resources, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0006] In an exemplary embodiment, the computing node also has a node manager; after the computing node is assigned to the placeholder container group, the method also includes: through the node manager in the target computing node, when it is determined that the placeholder container group is assigned to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group, creating corresponding placeholder containers and pause containers for the placeholder container group; through the node manager in the target computing node, modifying the state of the placeholder container group to a running state.
[0007] In an exemplary embodiment, the method further includes: when a creation event of a development platform resource is monitored in the database component, creating a traffic forwarding resource corresponding to the development platform resource in the database component; after the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resource, the method further includes: performing network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0008] In an exemplary embodiment, in the process of creating corresponding placeholder containers and paused containers for the placeholder container group according to the configuration information of the placeholder container group, the method also includes: calling, through the node manager in the target computing node, the network plug-in of the container orchestration platform to allocate a first virtual network card device to the placeholder container group, so that the placeholder container group can access the network of the container orchestration platform; performing network configuration for the symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node, including: transferring the first virtual network card device from the placeholder container group to the symbiotic container, so that the symbiotic container can access the network of the container orchestration platform.
[0009] In an exemplary embodiment, after the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resources, the method further includes: recording the name of the target computing node and the identifier of the symbiotic container in the development platform resources through the development platform daemon component in the target computing node; and setting the state of the development platform resources to a running state through the development platform daemon component in the target computing node.
[0010] In an exemplary embodiment, the method further includes: by means of the development platform control component, upon monitoring that the development platform resources have annotation information, deleting the placeholder container group corresponding to the development platform resources, wherein the annotation information is used to indicate the suspension of the development environment; by means of the development platform daemon component in the target computing node, upon monitoring that the placeholder container group in the database component is deleted, changing the state of the symbiotic container from a running state to a stopped state, and setting the state of the development platform resources to a suspended state.
[0011] In an exemplary embodiment, the computing node also has a node manager; after deleting the placeholder container group corresponding to the development platform resources, the method also includes: through the node manager in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, calling the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group.
[0012] In an exemplary embodiment, the method further includes: through the development platform control component, when it is detected that the annotation information of the development platform resource is deleted, creating a placeholder container group corresponding to the development platform resource in the database component, and specifying the placeholder container group to run on the target computing node, wherein the name of the target computing node and the identifier of the symbiotic container are recorded in the development platform resource; through the resource management component, when it is detected that the creation event of the placeholder container group is detected in the database component, and the placeholder container group is specified to run on the target computing node, determining whether the resources of the target computing node meet preset conditions, and when it is determined that the resources of the target computing node meet the preset conditions, allocating the placeholder container group to the target computing node; through the development platform daemon component in the target computing node, when it is detected that the state of the placeholder container group in the database component is the running state, modifying the state of the symbiotic container recorded in the development platform resource from the stopped state to the running state, and setting the state of the development platform resource to the running state.
[0013] In an exemplary embodiment, the computing node further includes a node manager; after the placeholder container group is assigned to the target computing node, the method further includes: when determining that the placeholder container group is assigned to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group through the node manager in the target computing node, creating a corresponding placeholder container and a pause container for the placeholder container group; modifying the state of the placeholder container group to a running state through the node manager in the target computing node; modifying the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state Before changing to the running state, the method also includes: updating the configuration information of the symbiotic container according to the configuration information of the placeholder container; the method also includes: when a creation event of a development platform resource is listened to in the database component, creating a traffic forwarding resource corresponding to the development platform resource in the database component; after changing the state of the symbiotic container recorded in the development platform resource from the stopped state to the running state, the method also includes: performing network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0014] In an exemplary embodiment, after determining whether the resources of the target computing node meet the preset conditions, the method further includes: when it is determined that the resources of the target computing node do not meet the preset conditions, sending a prompt message through the resource management component, wherein the prompt message is used to indicate that the placeholder container group cannot allocate a computing node.
[0015] In an exemplary embodiment, the method further includes: by means of the development platform control component, when the development platform resources are monitored to be deleted in the database component, deleting the placeholder container group and traffic forwarding resources corresponding to the development platform resources in the database component; by means of the development platform daemon component in the target computing node, when the placeholder container group in the database component is monitored to be deleted, calling the container runtime of the target computing node to delete the symbiotic container corresponding to the development platform resources.
[0016] In an exemplary embodiment, the computing node also has a node manager; after deleting the placeholder container group and traffic forwarding resources corresponding to the development platform resources in the database component, the method further includes: through the node manager in the target computing node, when monitoring that the placeholder container group in the database component is deleted, calling the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group.
[0017] According to another embodiment of the embodiment of the present application, there is also provided a device for creating a development environment, which is applied to a container orchestration platform, wherein the container orchestration platform includes a management node and multiple computing nodes, wherein the management node has a database component, a development platform control component and a resource management component; the computing node has a container runtime and a development platform daemon component, including: a creation module, which is used to create a placeholder container group corresponding to the development platform resource in the database component when a creation event of the development platform resource is monitored in the database component through the development platform control component, wherein the development platform resource is a custom resource in the container orchestration platform; an allocation module, which is used to allocate a placeholder container group corresponding to the development platform resource in the database component through the resource A management component, which allocates a computing node to the placeholder container group when a creation event of the placeholder container group is monitored in the database component; a calling module, which is used to call the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node when the state of the placeholder container group in the database component is monitored to be in a running state, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0018] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0019] According to another embodiment of the present application, an electronic device is provided, including a memory and a second processor, wherein a computer program is stored in the second memory, and the second processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0020] According to another embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0021] Through the present application, in the process of creating a development environment, a corresponding symbiotic container is created, and the symbiotic container is used as a carrier of the development environment. Since the symbiotic container can be paused, the development environment can be paused by pausing the symbiotic container, so that the development environment can enter the paused state from the running state, thereby solving the problem that the development environment cannot enter the paused state from the running state because the placeholder container group cannot be paused. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0023] Figure 1 It is a hardware structure block diagram of a server device of a method for creating a development environment according to an embodiment of the present application;
[0024] Figure 2 is a flow chart of a method for creating a development environment according to an embodiment of the present application;
[0025] Figure 3 is a schematic diagram of the architecture of a container orchestration platform according to an embodiment of the present application;
[0026] Figure 4 It is a timing diagram of creating a development environment according to a container orchestration platform of an embodiment of the present application;
[0027] Figure 5 It is a timing diagram of a container orchestration platform suspending creation of a development environment according to an embodiment of the present application;
[0028] Figure 6 It is a timing diagram of restoring a development environment of a container orchestration platform according to an embodiment of the present application;
[0029] Figure 7 It is a timing diagram of a container orchestration deletion platform development environment according to an embodiment of the present application;
[0030] Figure 8 is a schematic diagram of a symbiotic container network configuration according to an embodiment of the present application;
[0031] Fig. 9 It is a timing diagram of an optional container orchestration platform saving development environment data according to an embodiment of the present application;
[0032] Fig.10 is a structural block diagram of a device for creating a development environment according to an embodiment of the present application;
[0033] Fig.11 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0034] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0036] The method for creating a development environment provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a method for creating a development environment according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a first processor 102 (the first processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a first memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0037] The first memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for creating the development environment in the embodiment of the present application. The first processor 102 executes various functional applications and data processing by running the computer program stored in the first memory 104, that is, to implement the above method. The first memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the first memory 104 may further include a memory remotely arranged relative to the first processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0038] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0039] In order to solve the above problems, a method for creating a development environment is provided in this embodiment, which is applied to a container orchestration platform. The container orchestration platform includes a management node and multiple computing nodes. The management node has a database component, a development platform control component, and a resource management component; the computing node has a container runtime and a development platform daemon component, such as Figure 2 As shown, the process includes the following steps S202-S206:
[0040] Step S202: when a creation event of a development platform resource is monitored in the database component by the development platform control component, a placeholder container group corresponding to the development platform resource is created in the database component, wherein the development platform resource is a custom resource in the container orchestration platform;
[0041] Optionally, Figure 3 The diagram shows the architecture of a container orchestration platform (such as Kubernetes). The container orchestration platform may include a management node and multiple computing nodes. The management node includes: database component (ETCD), database entry component (kube-apiserver), resource management component (kube-scheduler) and development platform control component (devplatformcontroller); the computing node includes: node manager (kubelet), container runtime (docker), development platform daemon component (devplatform daemon), placeholder container group (shadowpod) and symbiotic container (symbiotic-container); shadowpod includes: pause container (pause-container) and placeholder container (placeholder-container).
[0042] It should be noted that the kubernetes platform includes core components such as ETCD, kube-apiserver, kubelet, development platform control component manager (kube-controller-manager), kube-scheduler, proxy server (kube-proxy), core domain name (coredns), etc. Figure 3 Only some of the key components that interact with each other are shown: ETCD, kube-apiserver, kube-scheduler, and kubelet; docker is a container runtime used to create and manage the container lifecycle; in Kubernetes, ETCD is a database component, and kube-apiserver is the entry component for accessing the database. All access to the ETCD database needs to be completed through kube-apiserver; kube-scheduler is the resource management component responsible for allocating computing nodes to Pods, and listens to Pod events through kube-apiserver, then allocates nodes to newly created Pods and records them in the database; kubelet listens to Pod events through kube-apiserver, and then calls docker to maintain the container status in the Pod according to the event type.
[0043] Step S204: when the database component monitors the creation event of the placeholder container group, the resource management component allocates a computing node to the placeholder container group;
[0044] Step S206: Through the development platform daemon component in the target computing node, when it is monitored that the status of the placeholder container group in the database component is in the running state, the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resources, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0045] It should be noted that ShadowPod is a placeholder Pod, the purpose of which is to leave a record in the Kubernetes platform so that the Kubernetes platform can allocate nodes and resources to it;
[0046] It should be noted that the devplatform controller component can be deployed on any management node of the kubernetes platform. The devplatform controller component will create a CRD resource named Devplatform (the above-mentioned development platform resource) in the kubernetes platform, then listen to the change events of Devplatform, and create and maintain ShadowPod according to the received Devplatform events;
[0047] It should be noted that the devplatform daemon component needs to be deployed on all computing nodes in the kubernetes platform. It will monitor Pod change events and Docker container lifecycle events, and call Docker to create and maintain the lifecycle status of symbiotic-container based on these events. The resource configuration of symbiotic-container is the same as ShadowPod, and it is the actual carrier of the development environment.
[0048] Optionally, when symbiotic-container is started, a network protocol daemon (Secure Shell Daemon, abbreviated as sshd) will be started inside the container. After symbiotic-container is started, the user terminal can connect to the symbiotic container through the secure shell (Secure Shell, abbreviated as ssh) network protocol tool to perform business development work.
[0049] Optionally, the management method of the development environment includes creation, deletion, suspension, and recovery.
[0050] It should be noted that the existence of the placeholder container group ensures that the container orchestration platform can manage and schedule resources normally, while the symbiotic container carries the actual development environment and user data, achieving efficient resource utilization and seamless data transition.
[0051] In the above steps S202-S206, during the process of creating the development environment, a symbiotic container is correspondingly created, and the symbiotic container is used as the carrier of the development environment. Since the symbiotic container can be paused, the development environment can be paused by pausing the symbiotic container, so that the development environment can enter the paused state from the running state, thereby solving the problem that the development environment cannot enter the paused state from the running state because the placeholder container group cannot be paused.
[0052] In an exemplary embodiment, the computing node further includes a node manager; after allocating the computing node to the placeholder container group, the method further includes the following steps S11-S12:
[0053] Step S11: When determining, by the node manager in the target computing node, that the placeholder container group is allocated to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group, creating corresponding placeholder containers and pause containers for the placeholder container group;
[0054] Step S12: modifying the state of the placeholder container group to a running state through the node manager in the target computing node.
[0055] It should be noted that through the above steps, efficient and rapid deployment of the development environment on the container orchestration platform is achieved. Specifically, the configuration information of the placeholder container group contains the computing resources (CPU, memory, storage, etc.) and network configuration required for the development environment. By calling the container runtime of the target computing node, a container instance matching the configuration information can be quickly created, thereby avoiding the redundant steps of traditional container creation, such as image downloading, initializing the container environment, etc., and significantly improving the speed and efficiency of container creation.
[0056] In addition, changing the status of the placeholder container group to the running state means that it will obtain resource allocation and management from the container orchestration platform, such as Internet Protocol (IP) address and port binding. This step ensures that the development environment can immediately access the network and provide a stable network connection, making it easier for users to access the development environment in the symbiotic container through network services. Since the paused containers contained in the placeholder container group are in a paused state when they are created, they will not consume additional computing resources. Therefore, in a resource-constrained environment, this method can effectively allocate and utilize limited hardware resources.
[0057] In an exemplary embodiment, the method further comprises the following steps: when a creation event of a development platform resource is monitored in the database component, creating a traffic forwarding resource corresponding to the development platform resource in the database component;
[0058] In an exemplary embodiment, after the symbiotic container corresponding to the development platform resources is created when the container runtime of the target computing node is called, the method further includes the following steps: performing network configuration for the symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0059] It should be noted that the above steps enhance the network accessibility and stability of the development environment. After the creation event of the development platform resource (CRD resource of Devplatform) is monitored in the database component, the corresponding traffic forwarding resource (Service) is created. This operation ensures that no matter which node the development environment (i.e., symbiotic container) is scheduled to, the external access traffic can be redirected to the correct container through the fixed Service address. The introduction of Service ensures the continuity and transparency of network access. Even if the node where the development environment is located or its IP address changes, users can maintain connection with the development environment through Service, thereby improving user experience and development efficiency.
[0060] In addition, the development platform daemon component (devplatform daemon) on the target computing node configures the network for the symbiotic container, which realizes the automation and standardization of network configuration. When the development environment is created or restored, the devplatform daemon can ensure that the symbiotic container correctly accesses the network of the container orchestration platform. By configuring the default route and using the Address Resolution Protocol (arp) proxy service provided by Calico, the symbiotic container can use the network stack of the placeholder container group to directly communicate over the network. This step not only simplifies user operations and avoids the complexity and errors of manual network configuration, but also ensures seamless switching of network connections when the development environment transitions between different states (such as resuming from a paused state to a running state).
[0061] Through traffic forwarding resources and automated network configuration, data security and access stability are ensured during the suspension and resumption of the development environment. User data will not be lost due to the deletion and reconstruction of the container. At the same time, through the traffic redirection of the Service, users do not have to worry about the changes in the underlying container and can always access their development environment through the Service address, maintaining the continuity and efficiency of development work.
[0062] In an exemplary embodiment, in the process of creating corresponding placeholder containers and pause containers for the placeholder container group according to the configuration information of the placeholder container group, the method further comprises the following steps: calling, through the node manager in the target computing node, a network plug-in of the container orchestration platform to allocate a first virtual network card device to the placeholder container group, so that the placeholder container group is connected to the network of the container orchestration platform;
[0063] In an exemplary embodiment, the network configuration for the symbiotic container corresponding to the development platform resources is performed through the development platform daemon component in the target computing node, including: transferring the first virtual network card device from the placeholder container group to the symbiotic container, so that the symbiotic container is connected to the network of the container orchestration platform.
[0064] Optionally, refer to Figure 8 In the kubernetes platform, network plug-ins are usually deployed for cross-node communication. In an embodiment of the present application, the network plug-in of the container orchestration platform is the Calico network plug-in, and the network of the container orchestration platform is the Calico network. When kubelet creates the pause-container of ShadowPod, it will call Calico to allocate a network to ShadowPod. And Calico will create a veth peer virtual network card device pair on the host machine, with one end on the host machine and the other end in ShadowPod. In the present invention, the network card device at this end of ShadowPod is transferred to the symbiotic container, and then the default route is configured to access the Internet through the arp proxy (i.e. calixxxx) set by Calico, and the symbiotic container can be directly connected to the Calico network. The command to transfer the network card is as follows:
[0065] symbiotic_pID=$(docker inspect --format '{{.State.PID}}' <symbiotic-id>);
[0066] pause_pID=$(docker inspect --format '{{.State.PID}}' <pause-id>);
[0067] ln -s / proc / $symbiotic_pID / ns / net / var / run / netns / <symbiotic-id>;
[0068] ln -s / proc / $pause_pID / ns / net / var / run / netns / <pause-id>;
[0069] ip netns exec <pause-id>ip link set dev eth0 <symbiotic-id>;
[0070] It should be noted that <symbiotic-id>is the container ID of the symbiotic container, <pause-id>It is the container ID of the pause-container of ShadowPod.
[0071] It should be noted that by transferring the first virtual network card device from the placeholder container group to the symbiotic container, it is ensured that during the suspension and resumption of the development environment, the symbiotic container can seamlessly access the Calico network to maintain network coherence and consistency. In this way, users will not be affected by container restarts or node changes when making network connections or data transmissions in the development environment, maintaining the stability of the network status of the development environment. At the same time, it avoids the need to reallocate network resources each time the development environment is resumed, reduces network configuration overhead, and enables resources to be used more efficiently. Since the allocation and management overhead of network resources is minimized, the suspension and resumption process of the development environment becomes faster, improving the overall response speed of the platform.
[0072] In an exemplary embodiment, after the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resource, the method further includes the following steps S21-S22:
[0073] Step S21: recording the name of the target computing node and the identifier of the symbiotic container in the development platform resources through the development platform daemon component in the target computing node;
[0074] It should be noted that by recording the name of the target computing node and the identifier of the symbiotic container, the container orchestration platform cluster can accurately track the computing node where the corresponding symbiotic container is located, as well as the specific ID of the container. The establishment of this mapping relationship is crucial for subsequent development environment management operations (such as pause, resume, and delete), which can ensure that these operations can accurately act on the correct entity and avoid errors that may be caused by confusion of resource identifiers.
[0075] Step S21: Setting the state of the development platform resources to a running state through the development platform daemon component in the target computing node.
[0076] It should be noted that setting the state of the development platform resources to the running state achieves the consistency between the state of the development platform resources and the actual running state of the container. In Kubernetes, the state of resources reflects the different stages in their life cycle, such as pending, running, successful, failed, etc. When the symbiotic container is successfully started and running, by synchronously setting the state of the development platform resources to the running state, it is ensured that the external (such as the user interface or management system) can obtain the real state of the development environment in a timely and accurate manner, which is conducive to real-time monitoring and management of the development environment state.
[0077] Optionally, in order to better understand the creation process of the above development environment, Figure 4 To create a sequence diagram for the development environment, specifically: When a user initiates a request to create a Devplatform, the kube-apiserver will create a Devplatform instance. The devplatform controller component listens to the Devplatform creation event and creates ShadowPod and Service instances. The kube-scheduler component listens to the ShadowPod creation event and allocates a node with sufficient resources to ShadowPod. After the node is allocated, the kubelet component on this node listens to the ShadowPod being scheduled to this node, and then calls docker to create and start the pause-container and placeholder containers required by ShadowPod. When they are successfully started, the kubelet changes the ShadowPod status to Running. The devplatform daemon component listens to the ShadowPod entering the Running state, and then calls docker to create and start the symbiotic container. After the symbiotic container is successfully started, the devplatform daemon component configures the network for it, then records the node name and the ID of the symbiotic container in the Devplatform instance field, and sets the Devplatform status field to the running state. Finally, the user accesses the Service address to connect via SSH. Kubernetes will redirect the Service traffic to the Pod's IP address. In the step of configuring the network, the Pod's network card will be transferred to the symbiotic container, and the user will finally connect to the symbiotic container via SSH.
[0078] In an exemplary embodiment, the method further comprises the following steps S31-S32:
[0079] Step S31: deleting the placeholder container group corresponding to the development platform resource when monitoring that the development platform resource has annotation information through the development platform control component, wherein the annotation information is used to indicate pausing the development environment;
[0080] Optionally, when computing resources are tight, deleting the placeholder container group means releasing the resources it occupies on the target computing node, such as CPU, memory, etc., which can ensure the normal progress of resource-intensive tasks such as model training.
[0081] Step S32: Through the development platform daemon component in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, the state of the symbiotic container is changed from the running state to the stopped state, and the state of the development platform resources is set to the paused state.
[0082] Optionally, to better understand the suspension process of the above development environment, Figure 5 This is a timing diagram for pausing the development environment. Specifically: the user initiates the first request to pause Devplatform. The first request can mark Devplatform, that is, add an annotation information to Devplatform. The annotation key is status-control and the annotation value is paused. The devplatform controller component reads the Devplatform annotation information as a pause event, and then deletes the corresponding ShadowPod. The kubelet component on the corresponding node listens to the ShadowPod deletion event and calls docker to stop and delete the pause-container and the placeholder container. At the same time, the devplatform daemon component listens to the ShadowPod deletion event and stops the symbiotic container. After the stop is successful, the status field of Devplatform is set to paused.
[0083] It should be noted that by changing the state of the symbiotic container from the running state to the stopped state instead of deleting the container, this method ensures that the user data in the development environment is retained, avoiding data loss, especially retaining dynamic data (such as installed software packages).
[0084] In an exemplary embodiment, the computing node also has a node manager; after deleting the placeholder container group corresponding to the development platform resources, the method also includes the following steps: through the node manager in the target computing node, when monitoring that the placeholder container group in the database component is deleted, calling the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group.
[0085] It should be noted that the node manager directly monitors the deletion events of the placeholder container group in the database component, which means that once the placeholder container group is marked for deletion, the node manager can respond immediately and call the container runtime to delete the placeholder container and suspend the container, thereby releasing the computing resources they occupy in a timely manner. This mechanism avoids delays in resource release and ensures effective recycling and reallocation of resources, especially when resources are tight, and can make room for other tasks (such as model training) more quickly.
[0086] At the same time, because the node manager interacts directly with the database component, it can obtain the status information of the container more accurately, ensuring that the state of the container runtime is consistent with the state recorded in the database component during the deletion operation. This helps avoid potential problems caused by inconsistent states, such as container deletion failures and abnormal resource usage.
[0087] In an exemplary embodiment, the method further comprises the following steps S41-S43:
[0088] Step S41: When the development platform control component detects that the annotation information of the development platform resource is deleted, a placeholder container group corresponding to the development platform resource is created in the database component, and the placeholder container group is specified to run on the target computing node, wherein the name of the target computing node and the identifier of the symbiotic container are recorded in the development platform resource;
[0089] Step S42: when the database component monitors a creation event of the placeholder container group, and the placeholder container group is designated to run on the target computing node, by means of the resource management component, determining whether the resources of the target computing node meet a preset condition, and when it is determined that the resources of the target computing node meet the preset condition, allocating the placeholder container group to the target computing node;
[0090] Step S43: Through the development platform daemon component in the target computing node, when it is monitored that the state of the placeholder container group in the database component is in the running state, the state of the symbiotic container recorded in the development platform resources is changed from the stopped state to the running state, and the state of the development platform resources is set to the running state.
[0091] In an exemplary embodiment, after determining whether the resources of the target computing node meet the preset conditions, the method further includes: when it is determined that the resources of the target computing node do not meet the preset conditions, sending a prompt message through the resource management component, wherein the prompt message is used to indicate that the placeholder container group cannot allocate a computing node.
[0092] In an exemplary embodiment, the computing node further includes a node manager; after the placeholder container group is allocated to the target computing node, the method further includes the following steps: when determining that the placeholder container group is allocated to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group by the node manager in the target computing node, creating corresponding placeholder containers and pause containers for the placeholder container group; and modifying the state of the placeholder container group to a running state by the node manager in the target computing node;
[0093] In an exemplary embodiment, after changing the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state, the method further includes the following steps: performing network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0094] Optionally, to better understand the above process of restoring the development environment, Figure 6 This is a timing diagram of the development environment. Specifically, the user initiates a second request to restore Devplatform. The second request only needs to delete the mark added during the pause. The devplatform controller component uses the action of deleting the mark as the Devplatform recovery event, then creates ShadowPod and specifies that ShadowPod runs on the node recorded by Devplatform (that is, the node where the symbiotic container is located). When kube-scheduler listens to the ShadowPod creation event, it will check whether the node specified by ShadowPod has sufficient resources to meet the resource configuration requirements of ShadowPod. If the node specified by ShadowPod does not have sufficient resources, it will issue a ShadowPod scheduling failure event, and finally notify the user that the node resources are insufficient and the development environment cannot be restored. If the node specified by ShadowPod has sufficient resources, the node will be allocated to ShadowPod again. After the node is allocated, the kubelet component on this node will listen to the ShadowPod being scheduled to this node, and then call docker to create and start the pause-container and placeholder containers required by ShadowPod. When they are successfully started, kubelet will change the ShadowPod status to Running. When the devplatform daemon component detects that ShadowPod has entered the Running state, it will find the ID of the symbiotic container recorded by Devplatform and call docker to start the symbiotic container based on this ID. After the symbiotic container is successfully started, the devplatform daemon component will configure the network for it again and then set the Devplatform status field to the Running state.
[0095] It should be noted that by creating a placeholder container group on the target computing node and scheduling it to run immediately when resources are sufficient, the development environment can be quickly restored without having to create all components from scratch, greatly reducing resource consumption and waiting time. The symbiotic container can be restarted directly while retaining its original state, thus achieving rapid recovery of the development environment.
[0096] In an exemplary embodiment, before modifying the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state, the method further comprises the following steps: updating the configuration information of the symbiotic container according to the configuration information of the placeholder container;
[0097] Optionally, during the process of restoring the development environment, before starting the symbiotic container, the devplatform daemon component may update the symbiotic container resource configuration according to the placeholder container resource configuration in the ShadowPod.
[0098] It should be noted that the above steps provide a more efficient and flexible development environment management and resource scheduling mechanism. Through the coordination of the node manager and the container runtime, placeholder containers and paused containers can be quickly created on the target computing node, which not only speeds up the resource allocation process, but also enables the symbiotic container to be started faster when the development environment is restored, thereby reducing the waiting time for users. Before the symbiotic container is restored from the stopped state to the running state, the configuration of the symbiotic container is updated according to the latest configuration information of the placeholder container, ensuring that the resource configuration of the development environment is up to date. Adjusting the resource configuration during the suspension of the development environment, such as increasing memory, central processing unit (CPU), etc., can adapt to more complex or more efficient workload requirements. When the development platform resources are created, the corresponding traffic forwarding resources (such as Service) are automatically created in the database component. This ensures that the development environment can be accessed through a fixed traffic forwarding resource address, and even if the underlying container or Pod changes, it will not affect the stability and accessibility of the connection.
[0099] In an exemplary embodiment, the method further comprises the following steps S51-S52:
[0100] Step S51: When the development platform control component monitors in the database component that the development platform resource is deleted, the placeholder container group and the traffic forwarding resource corresponding to the development platform resource are deleted in the database component;
[0101] Step S52: When the development platform daemon component in the target computing node detects that the placeholder container group in the database component is deleted, the container runtime of the target computing node is called to delete the symbiotic container corresponding to the development platform resources.
[0102] In an exemplary embodiment, the computing node also has a node manager; after deleting the placeholder container group and traffic forwarding resources corresponding to the development platform resources in the database component, the method also includes the following steps: through the node manager in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, calling the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group.
[0103] Optionally, to better understand the above deletion of the development environment, Figure 7 The following is a sequence diagram for deleting the development environment: When the user initiates the third request to delete Devplatform, kube-apiserver deletes the Devplatform instance. The devplatform controller component listens to the Devplatform deletion event and deletes its corresponding ShadowPod and Service. The kubelet component on the corresponding node listens to the ShadowPod deletion event and calls docker to stop and delete the pause-container and placeholder container. At the same time, the devplatform daemon component listens to the Devplatform deletion event and stops and deletes the symbiotic container.
[0104] In an exemplary embodiment, when the container runtime of the target computing node fails to create the symbiotic container corresponding to the development platform resource, the method further includes the following steps: Optionally, Fig. 9 As shown in the figure, when the development environment data needs to be saved, a DockerAction resource object is created. After Kubernetes listens to this resource object, it converts the image-related data that needs to be saved transmitted by this resource object into a related container operation request, and then sends it to the container operation agent, and finally calls the docker engine to request to save the development environment as an image. After the image is saved, it is pushed to the image warehouse. In this way, the function of saving the development environment is completed. When data needs to be restored, using the saved image to create a new development environment can ensure the integrity of user data.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0106] In this embodiment, a device for creating a development environment is also provided, which is applied to a container orchestration platform. The container orchestration platform includes a management node and multiple computing nodes. The management node has a database component, a development platform control component, and a resource management component; the computing node has a container runtime and a development platform daemon component, and the computing node also has a node manager for implementing the above-mentioned embodiments and preferred implementation methods. Those that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware that implements a predetermined function. Although the modules described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0107] Fig.10 : is a structural block diagram of a device for creating a development environment according to an embodiment of the present application, the device comprising:
[0108] A creation module 1002 is used to create a placeholder container group corresponding to the development platform resource in the database component when a creation event of the development platform resource is monitored in the database component through the development platform control component, wherein the development platform resource is a custom resource in the container orchestration platform;
[0109] An allocation module 1004, configured to allocate a computing node to the placeholder container group when a creation event of the placeholder container group is monitored in the database component through the resource management component;
[0110] The calling module 1006 is used to call the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node, when it is monitored that the state of the placeholder container group in the database component is in the running state, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0111] The above-mentioned device, in the process of creating a development environment, creates a corresponding symbiotic container and uses the symbiotic container as a carrier of the development environment. Since the symbiotic container can be paused, the development environment can be paused by pausing the symbiotic container, so that the development environment can enter the paused state from the running state, thereby solving the problem that the development environment cannot enter the paused state from the running state because the placeholder container group cannot be paused.
[0112] In an exemplary embodiment, the creation module 1002 is further used to, after allocating a computing node to the placeholder container group, call the container runtime of the target computing node according to the configuration information of the placeholder container group through the node manager in the target computing node, when determining that the placeholder container group is allocated to the target computing node, and create corresponding placeholder containers and pause containers for the placeholder container group; and modify the state of the placeholder container group to a running state through the node manager in the target computing node.
[0113] In an exemplary embodiment, the creation module 1002 is also used to create a traffic forwarding resource corresponding to the development platform resource in the database component when a creation event of the development platform resource is monitored in the database component; after creating the symbiotic container corresponding to the development platform resource when the container runtime of the target computing node is called, perform network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0114] In an exemplary embodiment, the calling module 1006 is further used to, during the process of creating corresponding placeholder containers and pause containers for the placeholder container group according to the configuration information of the placeholder container group, call the network plug-in of the container orchestration platform through the node manager in the target computing node to allocate a first virtual network card device to the placeholder container group so that the placeholder container group can access the network of the container orchestration platform; the creating module 1002 is further used to transfer the first virtual network card device from the placeholder container group to the symbiotic container so that the symbiotic container can access the network of the container orchestration platform.
[0115] In an exemplary embodiment, the above-mentioned device also includes: a processing module, which is used to record the name of the target computing node and the identifier of the symbiotic container in the development platform resources through the development platform daemon component in the target computing node after creating the symbiotic container corresponding to the development platform resources when the container runtime of the target computing node is called; and set the state of the development platform resources to the running state through the development platform daemon component in the target computing node.
[0116] In an exemplary embodiment, the processing module is also used to, through the development platform control component, delete the placeholder container group corresponding to the development platform resources when it is monitored that the development platform resources have annotation information, wherein the annotation information is used to indicate the suspension of the development environment; through the development platform daemon component in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, change the state of the symbiotic container from the running state to the stopped state, and set the state of the development platform resources to the suspended state.
[0117] In an exemplary embodiment, the calling module 1006 is also used to, after deleting the placeholder container group corresponding to the development platform resources, call the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group when monitoring that the placeholder container group in the database component is deleted through the node manager in the target computing node.
[0118] In an exemplary embodiment, the creation module 1002 is also used to create a placeholder container group corresponding to the development platform resource in the database component through the development platform control component, and specify the placeholder container group to run on the target computing node, when it is detected that the annotation information of the development platform resource is deleted, wherein the name of the target computing node and the identifier of the symbiotic container are recorded in the development platform resource; the allocation module 1004 is also used to determine whether the resources of the target computing node meet the preset conditions through the resource management component, and when it is determined that the resources of the target computing node meet the preset conditions, allocate the placeholder container group to the target computing node; the processing module is also used to modify the state of the symbiotic container recorded in the development platform resource from the stopped state to the running state, and set the state of the development platform resource to the running state, when it is detected that the state of the placeholder container group in the database component is the running state through the development platform daemon component in the target computing node.
[0119] In an exemplary embodiment, the creation module 1002 is also used to, after allocating the placeholder container group to the target computing node, call the container runtime of the target computing node according to the configuration information of the placeholder container group when determining that the placeholder container group is allocated to the target computing node through the node manager in the target computing node, and create corresponding placeholder containers and pause containers for the placeholder container group; modify the state of the placeholder container group to a running state through the node manager in the target computing node; before modifying the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state, update the configuration information of the symbiotic container according to the configuration information of the placeholder container; in a case where a creation event of the development platform resource is monitored in the database component, create a traffic forwarding resource corresponding to the development platform resource in the database component; after modifying the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state, perform network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
[0120] In an exemplary embodiment, the processing module is further used to, after determining whether the resources of the target computing node meet the preset conditions, send a prompt message through the resource management component if it is determined that the resources of the target computing node do not meet the preset conditions, wherein the prompt message is used to indicate that the placeholder container group cannot allocate a computing node.
[0121] In an exemplary embodiment, the processing module is also used to, through the development platform control component, delete the placeholder container group and traffic forwarding resources corresponding to the development platform resources in the database component when it is heard that the development platform resources are deleted in the database component; the calling module 1006 is also used to, through the development platform daemon component in the target computing node, call the container runtime of the target computing node to delete the symbiotic container corresponding to the development platform resources when it is heard that the placeholder container group in the database component is deleted.
[0122] In an exemplary embodiment, the calling module 1006 is also used to, after deleting the placeholder container group and the traffic forwarding resources corresponding to the development platform resources in the database component, call the container runtime of the target computing node to delete the placeholder container and the pause container of the placeholder container group through the node manager in the target computing node when it is monitored that the placeholder container group in the database component is deleted.
[0123] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0124] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0125] Optionally, in this embodiment, the computer program may be configured to perform the following steps by means of the computer program:
[0126] S1, through the development platform control component, when a creation event of a development platform resource is monitored in the database component, a placeholder container group corresponding to the development platform resource is created in the database component, wherein the development platform resource is a custom resource in the container orchestration platform;
[0127] S2, allocating a computing node to the placeholder container group when a creation event of the placeholder container group is monitored in the database component by the resource management component;
[0128] S3, through the development platform daemon component in the target computing node, when it is monitored that the status of the placeholder container group in the database component is in the running state, calling the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0129] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0130] The embodiment of the present application also provides an electronic device, such as Fig.11 As shown, the electronic device includes a second memory 1102 and a second processor 1104, wherein the second memory 1102 stores a computer program, and the second processor 1104 is configured to execute the steps of any of the above method embodiments through the computer program.
[0131] Optionally, in this embodiment, the second processor 1104 may be configured to perform the following steps through a computer program:
[0132] S1, through the development platform control component, when a creation event of a development platform resource is monitored in the database component, a placeholder container group corresponding to the development platform resource is created in the database component, wherein the development platform resource is a custom resource in the container orchestration platform;
[0133] S2, allocating a computing node to the placeholder container group when a creation event of the placeholder container group is monitored in the database component by the resource management component;
[0134] S3, through the development platform daemon component in the target computing node, when it is monitored that the status of the placeholder container group in the database component is in the running state, calling the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node.
[0135] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0136] Alternatively, a person skilled in the art may understand that: Fig.11 The structure shown is for illustration only. Fig.11 The structure of the electronic device is not limited. For example, the electronic device may also include Fig.11 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.11 Different configurations shown.
[0137] Among them, the second memory 1102 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method for creating a development environment and the device for creating a development environment in the embodiments of the present application. The second processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the second memory 1102, that is, realizing the above-mentioned method for creating a development environment. The second memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the second memory 1102 may further include a memory remotely located relative to the second processor 1104, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Among them, the second memory 1102 may specifically be used, but is not limited to, to store information such as system configuration files. As an example, such as Fig.11 As shown, the second memory 1102 may include but is not limited to the creation module 1002, the allocation module 1004, and the calling module 1006 in the creation device of the development environment. In addition, other module units in the creation device of the development environment may also be included but are not limited to, which will not be repeated in this example.
[0138] Optionally, the transmission device 1106 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1106 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0139] In addition, the electronic device further includes: a display 1108; and a connection bus 1110, which is used to connect various module components in the electronic device.
[0140] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0141] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0142] The embodiments of the present application also provide a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the above method embodiments.
[0143] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0144] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for creating a development environment, characterized in that: Applied to a container orchestration platform, the container orchestration platform includes a management node and multiple computing nodes, the management node has a database component, a development platform control component and a resource management component; The computing node has a container runtime and a development platform daemon component; include: By means of the development platform control component, when a creation event of a development platform resource is monitored in the database component, a placeholder container group corresponding to the development platform resource is created in the database component, wherein the development platform resource is a custom resource in the container orchestration platform; By means of the resource management component, when the creation event of the placeholder container group is monitored in the database component, a computing node is allocated to the placeholder container group; By means of the development platform daemon component in the target computing node, when monitoring that the state of the placeholder container group in the database component is in the running state, calling the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources, wherein the placeholder container group is allocated to the target computing node, the resource configuration of the symbiotic container is the same as the configuration information of the placeholder container in the placeholder container group corresponding to the development platform resources, the symbiotic container is a carrier of the development environment, and the multiple computing nodes include the target computing node; The computing node also has a node manager; after the computing node is assigned to the placeholder container group, the method further includes: when determining that the placeholder container group is assigned to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group through the node manager in the target computing node, creating corresponding placeholder containers and pause containers for the placeholder container group; modifying the state of the placeholder container group to a running state through the node manager in the target computing node; The method further includes: when a creation event of a development platform resource is monitored in the database component, creating a traffic forwarding resource corresponding to the development platform resource in the database component; after the container runtime of the target computing node is called to create a symbiotic container corresponding to the development platform resource, the method further includes: performing network configuration for the symbiotic container corresponding to the development platform resource through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource; Among them, in the process of creating corresponding placeholder containers and paused containers for the placeholder container group according to the configuration information of the placeholder container group, the method also includes: calling the network plug-in of the container orchestration platform through the node manager in the target computing node to allocate a first virtual network card device to the placeholder container group, so that the placeholder container group can access the network of the container orchestration platform; performing network configuration for the symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node, including: transferring the first virtual network card device from the placeholder container group to the symbiotic container, so that the symbiotic container can access the network of the container orchestration platform.
2. The method according to claim 1, characterized in that After calling the container runtime of the target computing node to create a symbiotic container corresponding to the development platform resources, the method further includes: Recording the name of the target computing node and the identifier of the symbiotic container in the development platform resources through the development platform daemon component in the target computing node; The state of the development platform resources is set to a running state through the development platform daemon component in the target computing node.
3. The method according to claim 1, characterized in that: The method further comprises: By means of the development platform control component, when it is monitored that the development platform resource has annotation information, the placeholder container group corresponding to the development platform resource is deleted, wherein the annotation information is used to indicate that the development environment is suspended; Through the development platform daemon component in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, the state of the symbiotic container is changed from a running state to a stopped state, and the state of the development platform resources is set to a paused state.
4. The method according to claim 3, characterized in that The computing node also has a node manager; After deleting the placeholder container group corresponding to the development platform resource, the method further includes: By means of the node manager in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, the container runtime of the target computing node is called to delete the placeholder container and the pause container of the placeholder container group.
5. The method according to claim 3, characterized in that: The method further comprises: By means of the development platform control component, when it is monitored that the annotation information of the development platform resource is deleted, a placeholder container group corresponding to the development platform resource is created in the database component, and the placeholder container group is specified to run on the target computing node, wherein the name of the target computing node and the identifier of the symbiotic container are recorded in the development platform resource; By means of the resource management component, when a creation event of the placeholder container group is monitored in the database component and the placeholder container group is designated to run on the target computing node, determining whether the resources of the target computing node meet a preset condition, and when it is determined that the resources of the target computing node meet the preset condition, allocating the placeholder container group to the target computing node; Through the development platform daemon component in the target computing node, when it is monitored that the state of the placeholder container group in the database component is in the running state, the state of the symbiotic container recorded in the development platform resources is changed from the stopped state to the running state, and the state of the development platform resources is set to the running state.
6. The method according to claim 5, characterized in that The computing node also has a node manager; After the placeholder container group is assigned to the target computing node, the method further includes: when determining that the placeholder container group is assigned to the target computing node, calling the container runtime of the target computing node according to the configuration information of the placeholder container group, creating a corresponding placeholder container and a pause container for the placeholder container group; and modifying the state of the placeholder container group to a running state through the node manager in the target computing node; Before modifying the state of the symbiotic container recorded in the development platform resource from a stopped state to a running state, the method further includes: updating the configuration information of the symbiotic container according to the configuration information of the placeholder container; The method further comprises: in the case where a creation event of a development platform resource is monitored in the database component, creating a traffic forwarding resource corresponding to the development platform resource in the database component; After changing the state of the symbiotic container recorded in the development platform resources from a stopped state to a running state, the method further includes: performing network configuration for the symbiotic container corresponding to the development platform resources through the development platform daemon component in the target computing node to allow access to the symbiotic container through the address of the traffic forwarding resource.
7. The method according to claim 5, characterized in that After determining whether the resources of the target computing node meet the preset conditions, the method further includes: When it is determined that the resources of the target computing node do not meet the preset condition, a prompt message is sent through the resource management component, wherein the prompt message is used to indicate that the placeholder container group cannot allocate a computing node.
8. The method according to claim 1, characterized in that The method further comprises: When the development platform resource is detected to be deleted in the database component by the development platform control component, the placeholder container group and the traffic forwarding resource corresponding to the development platform resource are deleted in the database component; Through the development platform daemon component in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, the container runtime of the target computing node is called to delete the symbiotic container corresponding to the development platform resources.
9. The method according to claim 8, characterized in that The computing node also has a node manager; After deleting the placeholder container group and the traffic forwarding resource corresponding to the development platform resource in the database component, the method further includes: By means of the node manager in the target computing node, when it is monitored that the placeholder container group in the database component is deleted, the container runtime of the target computing node is called to delete the placeholder container and the pause container of the placeholder container group.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 9 when executed by a processor.
11. An electronic device comprising a second memory, a second processor, and a computer program stored in the second memory and executable on the second processor, characterized in that: When the second processor executes the computer program, the steps of the method described in any one of claims 1 to 9 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
