Containerized system updating method, apparatus and device, and storage medium
By parsing container image files and configuration files, generating target resource files and tasks to be run, storing and executing tasks, the problem of insufficient automation and coordination during the containerized system update process is solved, and the update efficiency and user experience are improved.
Patent Information
- Application Number
- CN202411885987.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-20
AI Technical Summary
The lack of automation and coordination in the update process of existing containerized systems has led to operation and maintenance personnel needing to manually generate templates and upload images, which is inefficient and has increased technical thresholds.
By receiving the deployment path and configuration file of the container image file, parsing the image metadata information and configuration information, generating the target resource file and tasks to be run, storing it in a preset task pool, and obtaining tasks from the pool for parsing and execution, realizing automated updates of the containerized system.
It improves the update efficiency of containerized systems, reduces the error rate of manual operations, lowers the technical threshold, and improves the user experience.
Smart Images

Figure CN119718381A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a containerized system update method, device, equipment and storage medium. Background Art
[0002] At present, the technical solutions for realizing automatic deployment and resource configuration in containerized systems usually adopt template configuration combined with container orchestration tools for resource management and distribution. The core idea of this kind of solution is to use template engines to generate standardized resource files for applications and middleware, and then use container orchestration tools to deploy, expand and manage the running status of containers.
[0003] The operation and maintenance personnel or system administrator first defines the template configuration file according to the application and middleware requirements. The template configuration file contains the basic configuration information of the container resources, such as image path, resource restrictions, environment variables, and port mapping. During actual deployment, the template engine generates a specific container resource configuration file based on the template file and environment parameters. In addition, for multi-node cluster environments, existing solutions usually rely on manual operations or custom scripts to upload container images to local private image repositories.
[0004] However, in many existing solutions, the generation of template files and the actual deployment of container images are not an integrated automated process, resulting in a lack of coordination in the entire process. For example, operations and maintenance personnel may need to manually generate configuration templates before updating or uploading new container images. This manual process is prone to errors and is inefficient when rapid deployment is required. In addition, users often need to understand the details of resource files in container orchestration platforms such as Kubernetes (K8S, an open source container orchestration platform) in order to implement some customized operations, which greatly increases the threshold for using technical solutions and introduces additional learning costs.
[0005] As can be seen from the above, how to improve the update efficiency of the containerized system during the containerized system update process is a problem that needs to be solved urgently. Summary of the invention
[0006] In view of this, the purpose of the present invention is to provide a containerized system update method, device, equipment and storage medium, which can improve the update efficiency of the containerized system. The specific scheme is as follows:
[0007] In a first aspect, the present application provides a containerized system update method, comprising:
[0008] Receive a container image file deployment path and a configuration file, determine the container image file based on the container image file deployment path, parse the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information;
[0009] Generate a target resource file based on the target template file information and the image metadata information, then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool;
[0010] Obtain tasks to be run from the preset task pool, parse the tasks to be run, and obtain task information, so as to obtain task resource files from the preset task warehouse based on the task information, and send the task resource files and the task information to the task executor to perform containerized system update operations.
[0011] Optionally, the receiving a container image file deployment path and a configuration file, determining the container image file based on the container image file deployment path, and parsing the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determining the target template file information based on the image metadata information includes:
[0012] Receive a container image file deployment path and a configuration file through a preset user interaction interface on the front trigger, and determine whether the container image file deployment path and the configuration file meet preset conditions;
[0013] If the container image file deployment path and the configuration file meet the preset conditions, the configuration file is parsed to obtain corresponding configuration information, and then a number of container image files are determined based on the container image file deployment path, and each of the container image files is parsed to obtain corresponding image metadata information; the image metadata information includes the type, version number, build time and programming language corresponding to the image;
[0014] The target template file information is obtained from a preset template repository based on the image metadata information.
[0015] Optionally, generating a target resource file based on the target template file information and the image metadata information, then generating a task to be run based on the target resource file and the configuration information, and storing the task to be run in a preset task pool includes:
[0016] Acquire the template file content from the preset template repository based on the target template file information, and integrate the template file content with the image metadata information to obtain the target resource file content;
[0017] A target resource file is generated based on the target resource file content and the image metadata information, and a task to be run is generated based on the target resource file and the configuration information, and then the task to be run is stored in a preset task pool.
[0018] Optionally, the step of obtaining the to-be-run tasks from the preset task pool, parsing the to-be-run tasks to obtain task information, obtaining task resource files from a preset task repository based on the task information, and sending the task resource files and the task information to the task executor for a containerized system update operation includes:
[0019] Obtaining an image upload task from the preset task pool, parsing the image upload task to obtain an image repository address, user information, and an image group corresponding to the container image file, and determining a target image repository based on the image repository address;
[0020] Determine whether the target image warehouse needs to authenticate the user identity, and if the target image warehouse needs to authenticate the user identity, log in to the target image warehouse based on the user information;
[0021] After successfully logging into the target image warehouse based on the user information, judging whether the target image warehouse meets the preset container image file upload condition based on the image group, and if the target image warehouse meets the preset container image file upload condition, obtaining each container image file from the preset task warehouse, and uploading each container image file to the target image warehouse;
[0022] After uploading the container image file to the target image repository, it is determined whether the container image file is successfully uploaded, and the upload status is returned to the task manager; wherein the task manager is used to schedule and maintain tasks.
[0023] Optionally, the step of obtaining the to-be-run tasks from the preset task pool, parsing the to-be-run tasks to obtain task information, obtaining task resource files from a preset task repository based on the task information, and sending the task resource files and the task information to the task executor for a containerized system update operation includes:
[0024] Obtaining a resource deployment task from the preset task pool, and parsing the resource deployment task to obtain resource deployment task information; the resource deployment task information includes a cluster component address and authentication information;
[0025] Determine whether the resource deployment task information satisfies a preset grammatical condition, and if the resource deployment task information satisfies the preset grammatical condition, establish a communication connection with the target cluster based on the cluster component address and the authentication information;
[0026] The resource files in the resource deployment task are transmitted to the target cluster based on the communication connection, so that the target cluster performs a resource deployment operation based on the resource files.
[0027] Optionally, after the resource file in the resource deployment task is transmitted to the target cluster based on the communication connection so that the target cluster performs a resource deployment operation based on the resource file, the method further includes:
[0028] Determine whether the deployed resources meet the preset health status. If the deployed resources do not meet the preset health status, automatically call the task scheduler to perform a rollback operation.
[0029] In a second aspect, the present application provides a containerized system update device, including:
[0030] A template file information determination module is used to receive a container image file deployment path and a configuration file, determine the container image file based on the container image file deployment path, and parse the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information;
[0031] A task generation module, used to generate a target resource file based on the target template file information and the image metadata information, then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool;
[0032] The system update module is used to obtain the tasks to be run from the preset task pool, and parse the tasks to be run to obtain task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform containerized system update operations.
[0033] Optionally, the task generation module includes:
[0034] An information integration unit, configured to obtain the template file content from a preset template repository based on the target template file information, and integrate the template file content with the image metadata information to obtain the target resource file content;
[0035] The task generation unit is used to generate a target resource file based on the target resource file content and the image metadata information, and to generate a task to be run based on the target resource file and the configuration information, and then store the task to be run in a preset task pool.
[0036] In a third aspect, the present application provides an electronic device, including:
[0037] Memory, used to store computer programs;
[0038] The processor is used to execute the computer program to implement the aforementioned containerized system update method.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned containerized system update method when executed by a processor.
[0040] As can be seen from the above, before performing a containerized system update, the present application needs to receive an image file deployment path and a configuration file, and determine the image file based on the image file deployment path, and parse the image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information; generate a target resource file based on the target template file information and the image metadata information, and then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool; obtain the task to be run from the preset task pool, and parse the task to be run to obtain task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform the containerized system update operation.
[0041] It can be seen that this application first needs to determine the image file based on the image file deployment path, and parse the image file and configuration file respectively to obtain the image metadata information and configuration information, and then determine the target template file information based on the image metadata information; generate the target resource file based on the target template file information and the image metadata information, and then generate the task to be run based on the target resource file and the configuration information, and store the task to be run in the preset task pool; finally, obtain the task to be run from the preset task pool, and parse the task to be run to obtain the task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and task information to the task executor to perform the containerized system update operation. In this way, the efficiency of updating the containerized system is improved, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A flow chart of a containerized system update method disclosed in this application;
[0044] Figure 2 A flowchart of a specific containerized system update method disclosed in this application;
[0045] Figure 3 A schematic diagram of the component structure of a containerized system update device disclosed in the present application;
[0046] Figure 4 A schematic diagram of the components of a pre-trigger disclosed in the present application;
[0047] Figure 5 A schematic diagram of the component structure of a template parser disclosed in this application;
[0048] Figure 6 A schematic diagram of the component structure of a task manager disclosed in this application;
[0049] Figure 7 A schematic diagram of the component structure of an image upload task center disclosed in this application;
[0050] Figure 8 A schematic diagram of the component structure of a resource file upload task center disclosed in this application;
[0051] Fig. 9 This is a schematic diagram of the structure of a containerized system update device disclosed in this application;
[0052] Fig.10 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] At present, the technical solution for realizing automatic deployment and resource configuration in containerized systems usually uses a template engine to generate standardized resource files for applications and middleware, and then uses container orchestration tools to deploy, expand and manage the operation status of containers. Among them, in the existing solutions, the operation and maintenance personnel or system administrators first define the template configuration file according to the application and middleware requirements. During actual deployment, the template engine generates a specific container resource configuration file based on the template file and environmental parameters. In addition, for multi-node cluster environments, existing solutions usually rely on manual operations or custom scripts to upload container images to local private image repositories. However, in many existing solutions, the generation of template files and the actual deployment of container images are not an integrated automated process, resulting in a lack of coordination in the entire process. To this end, the present application provides a containerized system update method that can improve the update efficiency of the containerized system.
[0055] See also Figure 1 As shown, an embodiment of the present invention discloses a containerized system update method, including:
[0056] Step S11, receiving a container image file deployment path and a configuration file, and determining the container image file based on the container image file deployment path, and parsing the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determining the target template file information based on the image metadata information.
[0057] In this embodiment, the nodes involved in the process of updating the containerized system are as follows: Figure 2 As shown. Among them, the above-mentioned nodes are respectively a containerized system update device P100 and a Kubernetes Master node P200. In a specific implementation, the number of Kubernetes Master nodes is three nodes, namely P300, P301 and P302. It is worth mentioning that the number of Kubernetes Master nodes is set based on user needs and will not be elaborated on here. Among them, the containerized system update device is responsible for communicating with the container cluster and completing the update operation of the containerized system through the communication interface.
[0058] In this embodiment, the containerized system update device P100 includes a pre-trigger P110 that directly interacts with the user, a template parser P120 that dynamically generates resource files, and a task manager P130 that is responsible for task maintenance and task scheduling. It is worth mentioning that the sequence of processes between the pre-trigger, the template parser, and the task manager is as follows: Figure 3As shown. After receiving the user's container image file deployment path and configuration file, the pre-trigger will try to parse the image file and configuration file, and determine the target template file information based on the parsing result, then call the template parser and obtain the template file content from the template repository based on the target template file information. Then, the template parser will generate the target resource file according to the parsing result of the pre-trigger, and generate the task to be run based on the target resource file and configuration information. Then, the pre-trigger will call the task manager to use the task manager to manage the task to be run.
[0059] Among them, the pre-trigger P110 includes an input module P111 for receiving user input, an image metadata parsing module P112 for completing image file parsing, a template matching module P113 for completing template selection according to image metadata, a configuration parsing module P114 responsible for parsing the configuration file passed in by the user, and a task delivery module P115 responsible for communicating with the task manager P130. It is worth mentioning that the sequence of the input module, the image metadata parsing module, the template matching module, the configuration parsing module, and the task delivery module is as follows: Figure 4 shown.
[0060] In this embodiment, first, the input module receives the container image file deployment path and configuration file input by the user, and verifies the legitimacy of the information. Subsequently, the pre-trigger traverses all image files under the container image file deployment path, and calls the image metadata parsing module to parse each image file to obtain the image type, version number, build time, programming language, that is, image metadata information. Then, the pre-trigger calls the template matching module to use the template matching module and find the adapted target template file information from the template repository based on the image metadata information. Specifically, receiving a container image file deployment path and a configuration file, determining the container image file based on the container image file deployment path, and parsing the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determining the target template file information based on the image metadata information, can include: receiving the container image file deployment path and the configuration file through a preset user interaction interface on a pre-trigger, and judging whether the container image file deployment path and the configuration file meet preset conditions; if the container image file deployment path and the configuration file meet the preset conditions, parsing the configuration file to obtain corresponding configuration information, and then determining a number of container image files based on the container image file deployment path, and parsing each container image file to obtain corresponding image metadata information; the image metadata information includes the type, version number, build time and programming language corresponding to the image; and obtaining the target template file information from a preset template repository based on the image metadata information.
[0061] Step S12: Generate a target resource file based on the target template file information and the image metadata information, then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool.
[0062] In this embodiment, after finding the adapted template resource file, the pre-trigger will call the configuration parsing module to parse the configuration file input by the user and obtain the configuration information, and then generate the target resource file based on the target template file information and the configuration information, and then generate the task to be run based on the target resource file and the configuration information. Subsequently, the pre-trigger will call the task dispatching module to schedule the task to be run to the task manager, so as to use the task manager to manage the task to be run. It is worth mentioning that the pre-trigger will determine the health of the computer resources according to the response value of each task, and try to automatically roll back in abnormal situations.
[0063] The template parser P120 includes a template parsing engine P121 for parsing incoming template files, a template repository P122 for managing all template files, a template rendering module P123 responsible for filling resource configuration, and a resource file generation module P124 for integrating the templates that have been filled with content into resource files. It is worth mentioning that the sequence of processes between the template parsing engine, template repository, template rendering module, and resource file generation module is as follows: Figure 5 As shown. Among them, the template parsing engine will receive the incoming target template file information and image metadata information from the upstream, and try to pull the corresponding template file content from the template warehouse. The template rendering module will integrate the template content and template data to generate a final resource file content. The resource file generation module generates a target resource file on the file system according to the image metadata information and the resource file content, and then generates tasks to be run based on the target resource file and the configuration information, and stores the tasks to be run in the preset task pool. Specifically, generating a target resource file based on the target template file information and the image metadata information, and then generating tasks to be run based on the target resource file and the configuration information, and storing the tasks to be run in the preset task pool, can include: obtaining the template file content from the preset template warehouse based on the target template file information, and integrating the template file content with the image metadata information to obtain the target resource file content; generating a target resource file based on the target resource file content and the image metadata information, and generating tasks to be run based on the target resource file and the configuration information, and then storing the tasks to be run in the preset task pool.
[0064] Step S13: obtain the tasks to be run from the preset task pool, and parse the tasks to be run to obtain task information, obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform the containerized system update operation.
[0065] In this embodiment, after the tasks to be run are stored in the preset task pool, the embodiment of the present application needs to call the task manager to obtain the tasks to be run from the preset task pool. Among them, the task manager includes a task scheduler P131 responsible for coordinating the tasks to be run, a task pool P132 for temporarily storing the tasks to be run, a task warehouse P133 for managing all task resource files, a task executor P134 for actually executing the tasks to be run, an image upload task center P135 responsible for completing the image upload work, and a resource deployment task center P136 responsible for completing the distribution of resource files. It is worth mentioning that the sequential processes between the task scheduler, the task pool, the task warehouse, the task executor, the image upload task center, and the resource deployment task center are as follows: Figure 6 shown.
[0066] The task scheduler will first scan the task pool to see if there are any tasks to be run in the task pool. If a task to be run is found, it will parse the task to be executed and obtain the task information. Then, based on the task information, it will obtain the corresponding task resource file from the task warehouse and send the obtained task information and task resource file to the task executor so that the task executor can integrate the task information and the content of the task resource file and perform the task execution operation according to the step sequence in the task.
[0067] In this embodiment, the image upload task center P135 includes an image loading component P135-1 responsible for reading the image file, an image warehouse authentication component P135-2 responsible for authenticating the encrypted image warehouse, and an image push component P135-3 for uploading the image. It is worth mentioning that the sequential processes between the image loading component, the image warehouse authentication component, and the image push component are as follows: Figure 7As shown. Among them, the image loading component reads the image file and loads it into the local file system. Subsequently, it is determined whether the target image warehouse needs to authenticate the user information. If the target image warehouse needs to authenticate the user information, the image warehouse authentication component is called, and the target image warehouse is logged in based on the image warehouse address and username and password parsed by the configuration parsing module. Subsequently, the image push component needs to determine whether the target image warehouse has the conditions for uploading the image file based on the image group configured by the configuration parsing module. If the target image warehouse has the conditions for uploading the image file, the image upload process is started. It is worth mentioning that after the image upload process is completed, the embodiment of the present application needs to call the image push component to check whether the image is uploaded successfully in the image warehouse, and return the upload status to the task manager.
[0068] Specifically, tasks to be run are obtained from a preset task pool, and the tasks to be run are parsed to obtain task information, and task resource files are obtained from a preset task repository based on the task information, and the task resource files and task information are sent to a task executor to perform a containerized system update operation, which may include: obtaining an image upload task from a preset task pool, and parsing the image upload task using a configuration parsing module to obtain an image repository address, user information, and an image group corresponding to the container image file, and determining a target image repository based on the image repository address; then, determining whether the target image repository needs to authenticate the user identity, and if the target image repository needs to authenticate the user identity, logging in to the target image repository based on the user information. It is worth mentioning that after successfully logging in to the target image warehouse based on the user information, it is determined whether the target image warehouse meets the preset container image file upload conditions based on the image group. If the target image warehouse meets the preset container image file upload conditions, each container image file is obtained from the preset task warehouse and uploaded to the target image warehouse; after uploading the container image file to the target image warehouse, the embodiment of the present application needs to determine whether the container image file is uploaded successfully, and return the upload status to the task manager; wherein, the task manager is used to schedule and maintain tasks.
[0069] In this embodiment, the resource file upload task center P136 includes a resource file verification component P136-1 responsible for loading resource files, a kubernetes api (i.e., Kubernetes application programming interface) authentication component P136-2 responsible for establishing communication with the Kubernetes ApiServer (i.e., Kubernetes application programming interface server), a resource deployment component P136-3 for issuing resource files, a health check component P136-4 for checking resource status, and an automatic rollback component P136-5 responsible for abnormal loading processing. It is worth mentioning that the sequence of processes between the resource file verification component, the kubernetes api authentication component, the resource deployment component, the health check component, and the automatic rollback component is as follows: Figure 8 As shown in the figure, the resource file verification component first reads and parses the resource file content to eliminate syntax errors in the resource file content, and then calls the kubernetes api authentication component to establish a connection with the Kubernetes ApiServer using the Kubernetes ApiServer address and user authentication information parsed by the configuration parsing module. Subsequently, the resource deployment component is called and the resource file is sent to the Kubernetes ApiServer through the above connection, so that the Kubernetes ApiServer can use the resource file for deployment.
[0070] Specifically, tasks to be run are obtained from a preset task pool, and the tasks to be run are parsed to obtain task information, and task resource files are obtained from a preset task warehouse based on the task information, and the task resource files and task information are sent to the task executor to perform containerized system update operations, which may include: obtaining resource deployment tasks from a preset task pool, and parsing the resource deployment tasks to obtain resource deployment task information; the resource deployment task information includes a cluster component address and authentication information; determining whether the resource deployment task information meets the preset grammatical conditions, and if the resource deployment task information meets the preset grammatical conditions, establishing a communication connection with the target cluster based on the cluster component address and authentication information; transmitting the resource files in the resource deployment task to the target cluster based on the communication connection, so that the target cluster performs resource deployment operations based on the resource files.
[0071] It is worth mentioning that after the resource file is sent, the health check component will periodically check the status of the computer resources. In a specific implementation, after a preset timeout period, if the computer resources are not in a healthy state, the embodiment of the present application will call the rollback component to roll back the issued computer resources, so that the application will roll back to the last available version, and call the resource file upload task center to return the rollback status to the task manager. Specifically, after the resource files in the resource deployment task are transmitted to the target cluster based on the communication connection, so that the target cluster performs resource deployment operations based on the resource files, it can also include: determining whether the deployed resources meet the preset health status, and if the deployed resources do not meet the preset health status, automatically calling the task scheduler to perform a rollback operation.
[0072] In a specific implementation, if the application scenario of the embodiment of the present application is in a company that provides enterprise-oriented products, there is a lot of customization work because the customer groups are diverse. Therefore, the embodiment of the present application needs to dispatch operators to various sites, but this operation will cause the operators to have uneven mastery of container field technology, so that operators who are not so familiar with the details of container technology will encounter various problems when performing containerized system update operations. The template warehouse and task warehouse in this embodiment can circumvent this problem. By utilizing the various templates and tasks preset by technicians in the template warehouse and task warehouse, the operator only needs to carry the image file prepared in advance, and the subsequent containerized system update process can be automatically executed based on the image file.
[0073] In this embodiment, in order to explain the embodiment of the present application in detail, the specific process of executing the containerized system update is as follows:
[0074] First, the operator needs to upload the image file and configuration file to be deployed to the preset server, and store the uploaded image files and configuration files in the same directory.
[0075] Secondly, the pre-trigger receives the container image file deployment path and configuration file input by the operator. After the input module performs a rationality check on the input container image file deployment path and configuration file, if the container image file deployment path and configuration file are reasonable, the pre-trigger is called to traverse the container image file deployment path to obtain all image files. Subsequently, the image metadata parsing module is called to parse each image file in turn to obtain the corresponding image metadata information.
[0076] Subsequently, the template matching module is called and the target template file information is searched from the template repository based on the image metadata information. Once the matching target template file information is found, the pre-trigger will call the configuration parsing module to parse the configuration file passed in by the operator. It can be understood that if the configuration file is parsed, the pre-trigger is called and the template parser is called based on the target template file information and the image metadata information.
[0077] Then, the template parsing engine is called and the template file content is searched and downloaded from the template repository based on the target template file information. Subsequently, based on the image metadata information, the template rendering module is called to integrate the template file content and the image metadata information to obtain the target resource file content. Then, the target resource file is generated based on the target resource file content and the image metadata information.
[0078] Furthermore, after generating the target resource file, the embodiment of the present application needs to call the pre-trigger to generate the task to be run based on the target resource file and the configuration information, so as to send the task to be run to the task pool through the task sending module.
[0079] Subsequently, the embodiment of the present application needs to call the task scheduler to scan the tasks to be run in the task pool. If there are tasks to be run, the tasks to be run are parsed to obtain the corresponding task information, and the task resource files are obtained in the task warehouse based on the task information. Then, the task scheduler is called to send the task resource files and task information to the task executor, so as to call the task executor to execute the tasks to be run.
[0080] It is worth mentioning that in the process of updating the containerized system, the pre-trigger will first call the image upload task center to execute the uploaded image upload task to load the local image file, upload the image file to the target image repository, and finally check the upload status of the image file uploaded to the target image repository.
[0081] Furthermore, after the image file is successfully uploaded, the embodiment of the present application will call the resource deployment task center in the pre-trigger to use the resource deployment task center to verify the syntax of the target resource file, and after the verification is passed, the target resource file will be sent to the Kubernetes cluster, so that after the target resource file is successfully sent, the deployment operation of the computer resources will be automatically started. Among them, after the computer resources are deployed, the embodiment of the present application needs to cyclically check the health status of the computer resources. If the health status of the computer resources is abnormal, the resource deployment task will be actively rolled back by the task scheduler; if the health status of the computer resources is normal, the containerized system update process ends normally.
[0082] As can be seen from the above, before the containerized system is updated, the embodiment of the present application needs to receive the image file deployment path and configuration file, and determine the image file based on the image file deployment path, and parse the image file and configuration file respectively to obtain the corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information; generate the target resource file based on the target template file information and the image metadata information, and then generate the task to be run based on the target resource file and the configuration information, and store the task to be run in the preset task pool; obtain the task to be run from the preset task pool, and parse the task to be run to obtain the task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform the containerized system update operation. In this way, the update efficiency of the containerized system is improved.
[0083] Accordingly, see Fig. 9 As shown, the present application also provides a containerized system update device, including:
[0084] The template file information determination module 11 is used to receive the container image file deployment path and the configuration file, determine the container image file based on the container image file deployment path, and parse the container image file and the configuration file respectively to obtain the corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information;
[0085] A task generation module 12 is used to generate a target resource file based on the target template file information and the image metadata information, and then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool;
[0086] The system update module 13 is used to obtain the tasks to be run from the preset task pool, and parse the tasks to be run to obtain task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform a containerized system update operation.
[0087] As can be seen from the above, before the containerized system is updated, the embodiment of the present application first needs to receive the image file deployment path and configuration file, and determine the image file based on the image file deployment path, and parse the image file and configuration file respectively to obtain the corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information; generate the target resource file based on the target template file information and the image metadata information, and then generate the task to be run based on the target resource file and the configuration information, and store the task to be run in the preset task pool; further, obtain the task to be run from the preset task pool, and parse the task to be run to obtain the task information, so as to obtain the task resource file from the preset task warehouse based on the task information; finally, send the task resource file and the task information to the task executor to perform the containerized system update operation. In this way, the update efficiency of the containerized system is improved.
[0088] In some specific implementations, the template file information determination module 11 may specifically include:
[0089] An information receiving unit, used to receive a container image file deployment path and a configuration file through a preset user interaction interface on a pre-trigger, and determine whether the container image file deployment path and the configuration file meet a preset condition;
[0090] A file parsing unit, configured to parse the configuration file to obtain corresponding configuration information if the container image file deployment path and the configuration file meet the preset condition, and then determine a number of container image files based on the container image file deployment path, and parse each of the container image files to obtain corresponding image metadata information; the image metadata information includes the type, version number, build time and programming language corresponding to the image;
[0091] The file information acquisition unit is used to acquire target template file information from a preset template repository based on the image metadata information.
[0092] In some specific implementations, the task generation module 12 may specifically include:
[0093] A resource file content acquisition unit, configured to acquire template file content from a preset template repository based on the target template file information, and integrate the template file content with the image metadata information to obtain target resource file content;
[0094] The resource file generating unit is used to generate a target resource file based on the target resource file content and the image metadata information, and to generate a task to be run based on the target resource file and the configuration information, and then store the task to be run in a preset task pool.
[0095] In some specific implementations, the system update module 13 may specifically include:
[0096] A task parsing unit, configured to obtain an image upload task from the preset task pool, and parse the image upload task to obtain an image repository address, user information, and an image group corresponding to the container image file, and determine a target image repository based on the image repository address;
[0097] An image warehouse login unit, used to determine whether the target image warehouse needs to authenticate the user identity, and if the target image warehouse needs to authenticate the user identity, log in to the target image warehouse based on the user information;
[0098] An image file uploading unit, configured to, after successfully logging into the target image warehouse based on the user information, determine whether the target image warehouse meets a preset container image file uploading condition based on the image group; if the target image warehouse meets the preset container image file uploading condition, obtain each of the container image files from the preset task warehouse, and upload each of the container image files to the target image warehouse;
[0099] The upload status returning unit is used to determine whether the container image file is successfully uploaded after uploading the container image file to the target image repository, and return the upload status to the task manager; wherein the task manager is used to schedule and maintain tasks.
[0100] In some specific implementations, the system update module 13 may specifically include:
[0101] A deployment task parsing unit, used to obtain resource deployment tasks from the preset task pool, and parse the resource deployment tasks to obtain resource deployment task information; the resource deployment task information includes cluster component addresses and authentication information;
[0102] a communication connection establishing unit, configured to determine whether the resource deployment task information satisfies a preset grammatical condition, and if the resource deployment task information satisfies the preset grammatical condition, establish a communication connection with the target cluster based on the cluster component address and the authentication information;
[0103] The file transmission unit is used to transmit the resource file in the resource deployment task to the target cluster based on the communication connection, so that the target cluster performs a resource deployment operation based on the resource file.
[0104] In some specific implementations, the containerized system update device may further include:
[0105] The rollback operation execution unit is used to determine whether the deployed resources meet the preset health status. If the deployed resources do not meet the preset health status, the task scheduler is automatically called to perform a rollback operation.
[0106] Furthermore, the present application also discloses an electronic device. Fig.10 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input and output interface 25 and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the containerized system update method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0107] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0108] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0109] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the containerized system update method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0110] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the containerized system update method disclosed above is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0111] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0112] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.
[0113] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0114] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0115] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A containerized system update method, characterized in that: include: Receive a container image file deployment path and a configuration file, determine the container image file based on the container image file deployment path, parse the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information; Generate a target resource file based on the target template file information and the image metadata information, then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool; Obtain tasks to be run from the preset task pool, parse the tasks to be run, and obtain task information, so as to obtain task resource files from the preset task warehouse based on the task information, and send the task resource files and the task information to the task executor to perform containerized system update operations.
2. The containerized system update method according to claim 1, characterized in that: The receiving a container image file deployment path and a configuration file, determining a container image file based on the container image file deployment path, and parsing the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determining target template file information based on the image metadata information, includes: Receive a container image file deployment path and a configuration file through a preset user interaction interface on the front trigger, and determine whether the container image file deployment path and the configuration file meet preset conditions; If the container image file deployment path and the configuration file meet the preset conditions, the configuration file is parsed to obtain corresponding configuration information, and then a number of container image files are determined based on the container image file deployment path, and each of the container image files is parsed to obtain corresponding image metadata information; the image metadata information includes the type, version number, build time and programming language corresponding to the image; The target template file information is obtained from a preset template repository based on the image metadata information.
3. The containerized system update method according to claim 1, characterized in that: The generating a target resource file based on the target template file information and the image metadata information, then generating a task to be run based on the target resource file and the configuration information, and storing the task to be run in a preset task pool, includes: Acquire the template file content from the preset template repository based on the target template file information, and integrate the template file content with the image metadata information to obtain the target resource file content; A target resource file is generated based on the target resource file content and the image metadata information, and a task to be run is generated based on the target resource file and the configuration information, and then the task to be run is stored in a preset task pool.
4. The containerized system update method according to claim 1, characterized in that: The step of obtaining the to-be-run tasks from the preset task pool, parsing the to-be-run tasks to obtain task information, obtaining task resource files from the preset task warehouse based on the task information, and sending the task resource files and the task information to the task executor for containerized system update operation includes: Obtaining an image upload task from the preset task pool, parsing the image upload task to obtain an image repository address, user information, and an image group corresponding to the container image file, and determining a target image repository based on the image repository address; Determine whether the target image warehouse needs to authenticate the user identity, and if the target image warehouse needs to authenticate the user identity, log in to the target image warehouse based on the user information; After successfully logging into the target image warehouse based on the user information, judging whether the target image warehouse meets the preset container image file upload condition based on the image group, and if the target image warehouse meets the preset container image file upload condition, obtaining each container image file from the preset task warehouse, and uploading each container image file to the target image warehouse; After uploading the container image file to the target image repository, it is determined whether the container image file is successfully uploaded, and the upload status is returned to the task manager; wherein the task manager is used to schedule and maintain tasks.
5. The containerized system update method according to any one of claims 1 to 4, characterized in that: The step of obtaining the to-be-run tasks from the preset task pool, parsing the to-be-run tasks to obtain task information, obtaining task resource files from the preset task warehouse based on the task information, and sending the task resource files and the task information to the task executor for containerized system update operation includes: Obtaining a resource deployment task from the preset task pool, and parsing the resource deployment task to obtain resource deployment task information; the resource deployment task information includes a cluster component address and authentication information; Determining whether the resource deployment task information satisfies a preset grammatical condition, and if the resource deployment task information satisfies the preset grammatical condition, establishing a communication connection with the target cluster based on the cluster component address and the authentication information; The resource files in the resource deployment task are transmitted to the target cluster based on the communication connection, so that the target cluster performs a resource deployment operation based on the resource files.
6. The containerized system update method according to claim 5, characterized in that: After the resource file in the resource deployment task is transmitted to the target cluster based on the communication connection so that the target cluster performs a resource deployment operation based on the resource file, the method further includes: Determine whether the deployed resources meet the preset health status. If the deployed resources do not meet the preset health status, automatically call the task scheduler to perform a rollback operation.
7. A containerized system update device, characterized in that: include: A template file information determination module is used to receive a container image file deployment path and a configuration file, determine the container image file based on the container image file deployment path, and parse the container image file and the configuration file respectively to obtain corresponding image metadata information and configuration information, and then determine the target template file information based on the image metadata information; A task generation module, used to generate a target resource file based on the target template file information and the image metadata information, then generate a task to be run based on the target resource file and the configuration information, and store the task to be run in a preset task pool; The system update module is used to obtain the tasks to be run from the preset task pool, and parse the tasks to be run to obtain task information, so as to obtain the task resource file from the preset task warehouse based on the task information, and send the task resource file and the task information to the task executor to perform containerized system update operations.
8. The containerized system update device according to claim 7, characterized in that: The task generation module comprises: An information integration unit, configured to obtain template file content from a preset template repository based on the target template file information, and integrate the template file content with the image metadata information to obtain target resource file content; The task generation unit is used to generate a target resource file based on the target resource file content and the image metadata information, and to generate a task to be run based on the target resource file and the configuration information, and then store the task to be run in a preset task pool.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the containerized system update method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the steps of the containerized system update method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Safety service platform and safety service deployment method
CN106330575A
Container mirror image deployment method and device
CN116257323A
Software system automatic deployment system, method and device supporting incremental deployment and storage medium
CN117149216A
Industrial APP full life cycle management method based on container
CN117290048A
Environment deployment method and device, electronic equipment and storage medium
CN117667109A
Cited By
Mirror image file configuration method and device and electronic equipment
CN121349480A