Mirror image determination method and device, equipment and storage medium
By compressing the mirror layer and removing redundant information in the Kubernetes cluster, the problem of excessive redundant resources of the mirror layer is solved, the multiplexing and efficient pulling of the mirror layer is realized, and the utilization and efficiency of the mirror is improved. .
Patent Information
- Application Number
- CN202411856679.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-12-17
AI Technical Summary
On the AI model training platform of Kubernetes cluster, excessive redundant resources in the mirror layer lead to low pulling mirror efficiency. The existing technology is difficult to simultaneously reduce redundant resources and meet the multiplexing requirements of the mirror layer, resulting in mirror utilization and pulling efficiency. Lower.
By obtaining the image layer processing instructions, multiple pending mirror layers are obtained, file information not included in the last built image layer, compression processing is performed, and the compressed file information is updated to the mirror layer to form a new image layer, thereby reducing redundant resources and enabling multiplexing of the mirror layer.
Effectively reduce the size of the mirror, improve the image pulling efficiency, meet the multiplexing requirements of the mirror layer, and improve the utilization and pulling efficiency of the mirror.
Smart Images

Figure CN119311653A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information processing technology, and in particular, relates to a mirror determination method, device, equipment and storage medium. Background Art
[0002] In the prior art, on an AI model training platform based on a Kubernetes cluster, in some scenarios, users need to debug the environment for running tasks and perform model training based on the debugged environment. Specifically, debugging the environment for running tasks mainly involves installing the resources (dependencies and installation packages) required for running tasks, and building an environment with the resources required for running tasks installed into an image. When training a model, directly pull the image built by the environment debugged by the user, and train the model in the environment provided by the image. However, the user cannot debug the environment for running tasks to the best environment in one go, and often needs to debug the environment multiple times. Each time the environment is debugged, the number of layers of the built image will increase by one layer, and each debugging only partially adjusts the environment for running tasks, so there are many repeated and redundant files in each layer of the image. As the number of times the user debugs the environment for running tasks increases, the number of image layers of the built image gradually increases, and there are more and more redundant files in the image. As a result, it takes a lot of time to pull images from a central database outside the Kubernetes cluster, which reduces the efficiency of pulling images.
[0003] In the prior art, the purpose of reducing redundant resources in the image is generally achieved by deduplicating the resources corresponding to all image layers in the image and merging them into resources corresponding to one image layer. However, if all image layer resources are directly merged into one image layer resource, the original image layer in the image before the merge will be lost. When the Kubernetes cluster needs to use the resources corresponding to the original image layer, the original image layer and the files corresponding to the original image layer cannot be extracted from the merged image layer. At this time, the image before the merge needs to be re-pulled from the central database outside the Kubernetes cluster. It is impossible to reuse the files of the original image layer, and it takes a lot of time to pull the image, resulting in low utilization of the image. The deduplication and merging methods of the image in the prior art are difficult to achieve while reducing the redundant resources in the image layer and meeting the requirements of reusing the image layer, and the utilization rate and pulling efficiency of the image are low. Summary of the invention
[0004] The embodiment of the present application provides an implementation scheme different from the prior art to solve the technical problem that it is difficult to meet the demand for multiplexing image layers while reducing redundant resources of image layers, and the utilization rate and pulling efficiency of images are low.
[0005] In a first aspect, the present application provides an image determination method, applicable to a Kubernetes cluster, comprising: in response to obtaining an image layer processing instruction for a first image, obtaining multiple first image layers to be processed corresponding to the image layer processing instruction in the first image; obtaining the first file information included in the first image layer most recently built among the multiple first image layers to be processed; selecting the second file information not included in the first file information from the file information included in the first remaining image layers other than the first image layer in the multiple first image layers to be processed; compressing the second file information and the first file information to obtain compressed file information; using the compressed file information as the file information included in the first image layer, updating the first image layer to obtain the second image layer; and determining the first target image based on the second image layer.
[0006] In a second aspect, the present application provides an image determination device, which is applicable to a Kubernetes cluster, comprising: a first acquisition unit, for obtaining, in response to obtaining an image layer processing instruction for a first image, a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; a second acquisition unit, for obtaining the first file information included in the first image layer most recently built among the plurality of first image layers to be processed; a third acquisition unit, for selecting, from the file information included in the first remaining image layers other than the first image layer in the plurality of first image layers to be processed, the second file information not included in the first file information; a compression unit, for compressing the second file information and the first file information to obtain compressed file information; an updating unit, for using the compressed file information as the file information included in the first image layer, to update the first image layer to obtain a second image layer; a determination unit, for determining the first target image based on the second image layer.
[0007] In a third aspect, the present application provides an electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any method in the first aspect or any possible implementation manner of the first aspect by executing the executable instructions.
[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements any method in the first aspect or any possible implementation manner of the first aspect.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in the first aspect or any possible implementation manner of the first aspect.
[0010] The solution provided by the present application is to obtain, in response to obtaining an image layer processing instruction for a first image, a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; obtain the first file information included in the first image layer that was most recently constructed in the plurality of first image layers to be processed; select the second file information not included in the first file information from the file information included in the first remaining image layers other than the first image layer in the plurality of first image layers to be processed; compress the second file information and the first file information to obtain compressed file information; update the first image layer using the compressed file information as the file information included in the first image layer to obtain the second image layer; and determine the solution of the first target image based on the second image layer. The plurality of first image layers to be processed in the first image are compressed to reduce redundant resources, reduce the size of the image, and make the image pulling efficiency higher. At the same time, the image layers in the first image that are not included in the image layer processing instruction can be retained to realize the reuse of the image layers that do not need to be compressed in the first image. That is, when reducing the redundant resources of the image layer, the demand for multiplexing the image layer is met, and the utilization rate and pulling efficiency of the image are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings: Figure 1 A schematic diagram of a flow chart of a mirror image determination method provided in one embodiment of the present application; Figure 2 A schematic diagram of a process flow of image compression optimization processing is provided for an embodiment of the present application; Figure 3 A schematic diagram of the structure of a mirror image determination device provided in one embodiment of the present application; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, but cannot be understood as limiting the present application.
[0013] The terms "first" and "second" etc. in the specification, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0014] First, some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0015] Kubernetes cluster: (often referred to as K8s cluster) is an open source container orchestration platform used to automate the deployment, expansion, and management of computer containerized applications. Kubernetes can provide highly available service deployment, automated operations, and elastic scaling.
[0016] Kubernetes CronJob: An API object in a Kubernetes cluster that manages tasks that are run once or periodically based on a time schedule.
[0017] Mirror: It is a form of file storage and a type of redundancy. The data on one disk has an identical copy on another disk, which is called a mirror.
[0018] CRD (Custom Resource Definition): used to define custom resources. Through CRD, new resource types can be registered in the Kubernetes cluster, making it easier for the Kubernetes cluster to identify and process custom resource types.
[0019] In the prior art, on an AI model training platform based on a Kubernetes cluster, in some scenarios, users need to debug the environment for running tasks and perform model training based on the debugged environment. Specifically, debugging the environment for running tasks mainly involves installing the resources (dependencies and installation packages) required for running tasks, and building an environment with the resources required for running tasks installed into an image. When training a model, directly pull the image built by the environment debugged by the user, and train the model in the environment provided by the image. However, the user cannot debug the environment for running tasks to the best environment in one go, and often needs to debug the environment multiple times. Each time the environment is debugged, the number of layers of the built image will increase by one layer, and each debugging only partially adjusts the environment for running tasks, so there are many repeated and redundant files in each layer of the image. As the number of times the user debugs the environment for running tasks increases, the number of image layers of the built image gradually increases, and there are more and more redundant files in the image. As a result, it takes a lot of time to pull images from a central database outside the Kubernetes cluster, which reduces the efficiency of pulling images.
[0020] In the prior art, the purpose of reducing redundant resources in the image is generally achieved by deduplicating the resources corresponding to all image layers in the image and merging them into resources corresponding to one image layer. However, if all image layer resources are directly merged into one image layer resource, the original image layer in the image before the merge will be lost. When the Kubernetes cluster needs to use the resources corresponding to the original image layer, the original image layer and the files corresponding to the original image layer cannot be extracted from the merged image layer. At this time, the image before the merge needs to be re-pulled from the central database outside the Kubernetes cluster. It is impossible to reuse the files of the original image layer, and it takes a lot of time to pull the image, resulting in low utilization of the image. The deduplication and merging methods of the image in the prior art are difficult to achieve while reducing the redundant resources in the image layer and meeting the requirements of reusing the image layer, and the utilization rate and pulling efficiency of the image are low.
[0021] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0022] Figure 1 A flowchart of an image determination method provided for an exemplary embodiment of the present application is provided. The execution subject of the method may be a Kubernetes cluster. The method at least includes the following steps S101-S106: S101. In response to obtaining an image layer processing instruction for a first image, obtaining a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image.
[0023] Optionally, the first image is an image in the Kubernetes cluster and / or an image in a central server. The central server is a server outside the Kubernetes cluster and corresponding to the Kubernetes cluster.
[0024] Optionally, the first image is an image of environmental resources of the task environment for executing the task stored when relevant personnel debug the task environment.
[0025] Optionally, the image layer processing instruction refers to an instruction for triggering the Kubernetes cluster to perform compression processing on the image layers to be processed in the first image, so that the image layers to be processed in the first image are merged into an image layer that does not contain duplicate file information.
[0026] Optionally, the image layer processing instruction includes the first image name of the first image, the first image version of the first image, and the number of the multiple first image layers to be processed, the multiple first image layers to be processed are the image layers most recently debugged in the first image, or the multiple first image layers to be processed are the image layers most recently debugged in the first image and the image layers most recently debugged, and the number is a positive integer not less than 2.
[0027] Optionally, the image layer processing instruction may be represented as a custom image compression task CRD, wherein the image compression task CRD includes the first image name, the first image version, and the number of the plurality of first image layers to be processed.
[0028] Optionally, the plurality of first image layers to be processed are some or all of the image layers in the first image.
[0029] Optionally, each first image layer to be processed includes at least one file information, that is, each first image layer to be processed corresponds to at least one file.
[0030] Optionally, the image compression task CRD is a new resource type registered in the Kubernetes cluster, so as to enable the Kubernetes cluster to recognize the image compression task CRD and execute the image compression task CRD.
[0031] Specifically, the construction time of the multiple first image layers to be processed is later than the construction time of any image layer in the first image except the multiple first image layers to be processed, wherein the construction time is the time when the corresponding image layer is generated.
[0032] S102: Obtain first file information included in the most recently constructed first image layer among the multiple first image layers to be processed.
[0033] Optionally, the construction time of the first image layer is later than the construction time of other image layers in the first image except the first image layer.
[0034] Optionally, the first file information may be the file name, wherein the file name is a unique identifier of the file, and the file is a collection of multiple data.
[0035] Optionally, the first file information includes at least one file name.
[0036] S103: Select second file information that is not included in the first file information from the file information included in the first remaining image layers except the first image layer in the plurality of first image layers to be processed.
[0037] Optionally, the explanation of the second file may refer to the explanation of the first file, which will not be elaborated here.
[0038] S104: compress the second file information and the first file information to obtain compressed file information.
[0039] Optionally, the compressed file information does not contain identical file information.
[0040] Optionally, in the aforementioned S104, compressing the second file information and the first file information to obtain compressed file information includes the following steps S1041-S1042: S1041. Select fifth file information that is not marked with a deletion mark from the first file information, where the deletion mark is used to mark that the corresponding file information needs to be deleted.
[0041] Optionally, the file information marked with a deletion indicator means that the file information needs to be deleted but has not been deleted.
[0042] S1042: Use the fifth file information and the second file information as compressed file information.
[0043] S105: Use the compressed file information as the file information included in the first image layer, update the first image layer, and obtain a second image layer.
[0044] S106: Determine a first target image based on the second image layer.
[0045] In the aforementioned S106, the determining of the first target image based on the second image layer includes the following steps S01-S02: S01. Obtain a second remaining image layer in the first image except the plurality of first image layers to be processed.
[0046] Optionally, the second remaining image layer is an image layer in the first image that does not need to be optimized. For example, the second remaining image layer is an image layer that is frequently used in the Kubernetes cluster, or an image layer with less redundant information in the Kubernetes cluster.
[0047] Specifically, when the Kubernetes cluster needs to use the file resources in the second remaining image layer, and the original image corresponding to the second remaining image layer has been deleted locally, there is no need to pull the original image again, and the second remaining image layer in the first target image can be directly reused.
[0048] In summary, by compressing the local image layer in the first image and deleting the redundant information, it is possible to reduce the redundant resources in the first image, reuse the frequently used image layers, reduce the time of pulling the first image, and improve the utilization of the image layers in the first image. This improves the efficiency of pulling images and the utilization of images.
[0049] S02: Combine the second image layer and the second remaining image layer to obtain a first target image.
[0050] Optionally, the number of image layers in the first target image is less than the number of image layers in the first image.
[0051] Optionally, in the aforementioned S106, after determining the first target image based on the second image layer, the method further includes the following steps S001-S002: S001. Obtain the Kubernetes server with the largest free storage space in the Kubernetes cluster.
[0052] Optionally, there are multiple Kubernetes servers in the Kubernetes cluster, and the multiple Kubernetes servers are all local servers of the Kubernetes cluster.
[0053] S002. Store the first target image in the Kubernetes server with the largest free storage space.
[0054] Optionally, when storing the first target image in the Kubernetes server with the largest free storage space, the first target image is synchronized to the central server to ensure that the first target image can be obtained from the central server, to achieve synchronization of the first target image, and to avoid pulling the wrong image.
[0055] In summary, storing the first target image in the Kubernetes server can save time and resources for the Kubernetes cluster to pull the first target image, and the first target image in the Kubernetes server can be directly used to achieve fast access to the first target image.
[0056] Optionally, in order to save storage space of the local server, the method further includes: if after determining the first target image based on the second image layer, it is detected that the first target image has not been pulled for more than a preset time, deleting the first target image.
[0057] Optionally, in order to save storage space of the local server and improve utilization of the storage space of the local server, the method further includes: if after determining the first target image based on the second image layer, it is detected that the usage frequency of the first target image within a preset time period is lower than a preset frequency threshold, then deleting the first target image.
[0058] Specifically, the above deletion task can be periodically executed based on Kubernetes CronJob in the Kubernetes cluster or a tool similar to Kubernetes CronJob.
[0059] Optionally, in order to save storage resources of a local server, the method further includes: uploading the first target image to a central server, and deleting the first target image stored locally.
[0060] In summary, when the first target image is not used for more than a preset time, it means that the first target image has not been used for a long time. In order to save the storage space of the local server and store the image with high current utilization, the effective utilization of the storage space of the local server is ensured, and the utilization rate of the storage space of the local server is improved. The frequently used image is stored in the local server, which saves the time of pulling the image and saves the pulling resources required for pulling the image.
[0061] Optionally, in order to save resources and time for pulling the image, the method further includes the following steps S0001-S0002: S0001. In response to an image pull request including a second image name and a second image version, pull a fourth image from a local server based on the image pull request.
[0062] S0002: If the pulling fails, pull the fourth image from the central server.
[0063] In summary, by pulling images from the local server first, if the local image does not exist, it is pulled from the central server, saving resources and time for pulling images, reducing network bandwidth usage and the overhead of repeatedly pulling images.
[0064] Optionally, when relevant personnel fail to timely discover that there is an image that needs to be compressed to remove redundant file information in the image layer, the redundant resources in the image can be automatically reduced to save resources for storing the image. The method further includes the following steps S00001-S00006: S00001. When it is detected that the debuggers of the second image and the third image are different, and the second image and the third image are different images obtained by debugging the image layer in the same original image, the second image and the third image are respectively used as images to be processed, and the following processing is performed: S00002. Obtain the third file information included in the third image layer that was most recently constructed among the multiple second image layers to be processed included in the image to be processed; S00003. Select fourth file information that is not included in the third file information from the file information included in the third remaining image layers except the third image layer in the plurality of second image layers to be processed; S00004. Compress the fourth file information and the third file information to obtain initial compressed file information; S00005. Use the initially compressed file information as the file information corresponding to the third image layer, update the third image layer, and obtain a fourth image layer; S00006. Determine a second target image based on the fourth image layer.
[0065] For example, to more clearly understand how this solution compresses and optimizes the image, see Figure 2 , Figure 2 A schematic diagram of a process flow of image compression optimization processing provided for an exemplary embodiment of the present application: When the relevant personnel are debugging the task environment for executing the task, the task environment information after each debugging is constructed as a layer of image, and a new version of the image is generated, and the image is stored in the central server or cached in the central server and the local server. When it is necessary to perform image compression optimization on the image to be compressed and optimized, the image compression optimization unit is used to perform image compression optimization on the image to be compressed and optimized, and the optimized image is obtained and stored in the central server or the central server and the local server.
[0066] Specifically, the image compression optimization unit is used to execute, in response to obtaining an image layer processing instruction for a first image, obtaining a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; obtaining the first file information included in the first image layer that was most recently constructed among the plurality of first image layers to be processed; selecting the second file information that is not included in the first file information from the file information included in the first remaining image layers other than the first image layer among the plurality of first image layers to be processed; compressing the second file information and the first file information to obtain compressed file information; using the compressed file information as the file information included in the first image layer, updating the first image layer to obtain the second image layer; and determining the first target image based on the second image layer. The first target image is the image after compression optimization.
[0067] The image compression optimization unit is also used to, when it is detected that the debuggers of the second image and the third image are different, and the second image and the third image are different images obtained by debugging the image layer in the same original image, use the second image and the third image as images to be processed respectively, and perform the following processing: obtain the third file information included in the third image layer that was most recently built among the multiple second image layers to be processed included in the image to be processed; select the fourth file information that is not included in the third file information from the file information included in the third remaining image layers other than the third image layer among the multiple second image layers to be processed; compress the fourth file information and the third file information to obtain initial compressed file information; use the initial compressed file information as the file information corresponding to the third image layer, update the third image layer to obtain the fourth image layer; and determine the second target image based on the fourth image layer.
[0068] In summary, the solution provided by the present application is to obtain, in response to obtaining an image layer processing instruction for a first image, a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; obtain the first file information included in the first image layer that was most recently constructed in the plurality of first image layers to be processed; select the second file information not included in the first file information from the file information included in the first remaining image layers other than the first image layer in the plurality of first image layers to be processed; compress the second file information and the first file information to obtain compressed file information; update the first image layer using the compressed file information as the file information included in the first image layer to obtain the second image layer; and determine the solution of the first target image based on the second image layer. The plurality of first image layers to be processed in the first image are compressed to reduce redundant resources, reduce the size of the image, and make the image pulling efficiency higher. At the same time, the image layers in the first image that are not included in the image layer processing instruction can be retained to realize the reuse of the image layers that do not need to be compressed in the first image. That is, when reducing the redundant resources of the image layer, the demand for multiplexing the image layer is met, and the utilization rate and pulling efficiency of the image are improved.
[0069] In addition, the redundant resources of the image layer are reduced, making the size of the corresponding image smaller, reducing the time for the Kubernetes cluster using the image to obtain the image, and reducing the resource overhead caused by image transmission and storage in the AI training platform environment. By giving priority to obtaining images in the local server, the resources required to pull the image are saved. And by regularly clearing unused images and low-utilization images in the local server, the resources for storing images on the local server are saved. The utilization rate of the storage space of the local server is improved, the storage resources of the local server are prevented from being ineffectively occupied, and the long-term stable operation of the AI training platform is ensured. It can also automatically identify the image that needs to be compressed, compress the image, and optimize the removal of redundant file information, so as to achieve effective utilization of the storage space for storing images and avoid unnecessary storage waste.
[0070] Figure 3 A schematic diagram of a structure of an image determination device provided for an exemplary embodiment of the present application; wherein the device is applicable to a Kubernetes cluster, and the device includes: A first acquisition unit 31 is used for acquiring, in response to acquiring an image layer processing instruction for a first image, a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; A second acquisition unit 32 is used to acquire first file information included in the most recently constructed first image layer among the multiple first image layers to be processed; A third obtaining unit 33 is used to select second file information that is not included in the first file information from the file information included in the first remaining image layers except the first image layer in the plurality of first image layers to be processed; A compression unit 34, configured to compress the second file information and the first file information to obtain compressed file information; An updating unit 35 is configured to use the compressed file information as the file information included in the first image layer, update the first image layer, and obtain a second image layer; The determining unit 36 is configured to determine a first target image based on the second image layer.
[0071] Optionally, the device is used to determine the first target image based on the second image layer, specifically to: obtain the second remaining image layer in the first image except the multiple first image layers to be processed; combine the second image layer with the second remaining image layer to obtain the first target image.
[0072] Optionally, in the device, the image layer processing instruction includes the first image name of the first image, the first image version of the first image, and the number of the multiple first image layers to be processed, the multiple first image layers to be processed are the image layers most recently debugged in the first image, or the multiple first image layers to be processed are the image layers most recently debugged in the first image and the image layers most recently debugged, and the number is a positive integer not less than 2.
[0073] Optionally, the device is also used for: when it is detected that the debuggers of the second image and the third image are different, and the second image and the third image are different images obtained by debugging the image layer in the same original image, taking the second image and the third image as images to be processed respectively, and performing the following processing: obtaining the third file information included in the third image layer that was most recently built among the multiple second image layers to be processed included in the image to be processed; selecting the fourth file information that is not included in the third file information from the file information included in the third remaining image layers other than the third image layer among the multiple second image layers to be processed; compressing the fourth file information and the third file information to obtain initial compressed file information; taking the initial compressed file information as the file information corresponding to the third image layer, updating the third image layer to obtain the fourth image layer; and determining the second target image based on the fourth image layer.
[0074] Optionally, the device is used to compress the second file information and the first file information to obtain compressed file information, and is specifically used to: select the fifth file information that is not marked with a deletion marker from the first file information, wherein the deletion marker is used to mark that the corresponding file information needs to be deleted; and use the fifth file information and the second file information as compressed file information.
[0075] Optionally, the device is further configured to: delete the first target image if it is detected that the first target image has not been pulled for more than a preset time after the first target image is determined based on the second image layer.
[0076] Optionally, after the device is used to determine the first target image based on the second image layer, the device is also used to: obtain the Kubernetes server with the largest free storage space in the Kubernetes cluster; and store the first target image in the Kubernetes server with the largest free storage space.
[0077] Optionally, the device is further used to: upload the first target image to a central server, and delete the first target image stored locally.
[0078] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the device may perform the above method embodiment, and the above and other operations and / or functions of each module in the device are the corresponding processes in each method in the above method embodiment, respectively, and no further description is given here for the sake of brevity.
[0079] The above describes the device of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0080] Figure 4 is a schematic block diagram of an electronic device provided in an embodiment of the present application, and the electronic device may include: The memory 301 and the processor 302, the memory 301 is used to store the computer program and transmit the program code to the processor 302. In other words, the processor 302 can call and run the computer program from the memory 301 to implement the method in the embodiment of the present application.
[0081] For example, the processor 302 may be configured to execute the above method embodiments according to instructions in the computer program.
[0082] In some embodiments of the present application, the processor 302 may include but is not limited to: General-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0083] In some embodiments of the present application, the memory 301 includes but is not limited to: Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0084] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 301 and executed by the processor 302 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0085] like Figure 4 As shown, the electronic device may also include: The transceiver 303 may be connected to the processor 302 or the memory 301 .
[0086] The processor 302 may control the transceiver 303 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 303 may include a transmitter and a receiver. The transceiver 303 may further include an antenna, and the number of antennas may be one or more.
[0087] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0088] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0089] When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0090] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0091] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0092] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0093] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A mirror image determination method, characterized in that: Applicable to Kubernetes clusters, including: In response to obtaining an image layer processing instruction for a first image, obtaining a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; Obtain first file information included in the most recently built first image layer among the multiple first image layers to be processed; Selecting second file information that is not included in the first file information from the file information included in the first remaining image layers other than the first image layer in the plurality of first image layers to be processed; compressing the second file information and the first file information to obtain compressed file information; Using the compressed file information as the file information included in the first image layer, updating the first image layer to obtain a second image layer; A first target image is determined based on the second image layer.
2. The method according to claim 1, characterized in that: The determining the first target image based on the second image layer includes: Obtaining a second remaining image layer in the first image except the plurality of first image layers to be processed; The second image layer and the second remaining image layer are combined to obtain a first target image.
3. The method according to claim 1, characterized in that The image layer processing instruction includes a first image name of the first image, a first image version of the first image, and the number of the multiple first image layers to be processed, where the multiple first image layers to be processed are the image layers most recently debugged in the first image, or the multiple first image layers to be processed are the image layers most recently debugged in the first image and the image layers most recently debugged, and the number is a positive integer not less than 2.
4. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the debuggers of the second image and the third image are different, and the second image and the third image are different images obtained by debugging the image layer in the same original image, the second image and the third image are respectively used as images to be processed, and the following processing is performed: Obtaining third file information included in the third image layer that was most recently constructed among the multiple second image layers to be processed included in the image to be processed; Selecting fourth file information that is not included in the third file information from the file information included in the third remaining image layers except the third image layer in the plurality of second image layers to be processed; compressing the fourth file information and the third file information to obtain initial compressed file information; Using the initially compressed file information as the file information corresponding to the third image layer, updating the third image layer to obtain a fourth image layer; A second target image is determined based on the fourth image layer.
5. The method according to claim 1, characterized in that The compressing the second file information and the first file information to obtain compressed file information includes: Selecting fifth file information that is not marked with a deletion mark from the first file information, wherein the deletion mark is used to mark that the corresponding file information needs to be deleted; The fifth file information and the second file information are used as compressed file information.
6. The method according to claim 1, characterized in that The method further comprises: If, after determining the first target image based on the second image layer, it is detected that the first target image has not been pulled for more than a preset time period, the first target image is deleted.
7. The method according to claim 1, characterized in that After determining the first target image based on the second image layer, the method further includes: Obtain the Kubernetes server with the largest free storage space in the Kubernetes cluster; The first target image is stored in the Kubernetes server with the largest free storage space.
8. The method according to claim 1, characterized in that The method further comprises: The first target image is uploaded to the central server, and the first target image stored locally is deleted.
9. A mirror image determination device, characterized in that: Applicable to Kubernetes clusters, including: A first acquisition unit, configured to, in response to acquiring an image layer processing instruction for a first image, acquire a plurality of first image layers to be processed corresponding to the image layer processing instruction in the first image; A second acquisition unit is used to acquire first file information included in the most recently constructed first image layer among the multiple first image layers to be processed; A third acquisition unit is used to select second file information that is not included in the first file information from the file information included in the first remaining image layers other than the first image layer in the plurality of first image layers to be processed; A compression unit, used for compressing the second file information and the first file information to obtain compressed file information; an updating unit, configured to use the compressed file information as the file information included in the first image layer, update the first image layer, and obtain a second image layer; A determining unit is configured to determine a first target image based on the second image layer.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Import method and device of mirror image files
CN105094924A
Mirror image processing method and device, electronic equipment and readable storage medium
CN113209633A
Mirror image processing method and device, electronic equipment and computer readable storage medium
CN113934510A
Mirror image upgrading method and device, electronic equipment and storage medium
CN114721699A
Mirror image stacking method and device, equipment, medium and program product
CN114936066A