Configuration file processing method, control terminal and management terminal

By using the control terminal to respond to the setting instructions and replacing the configuration file template in the K8S system, the problem of complex and error-prone multi-service configuration item settings is solved, and the efficiency and success rate of configuration file deployment is improved.

CN113821267BActive Publication Date: 2025-04-29HISENSE GROUP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010548046.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-16
Publication Date
2025-04-29
Estimated Expiration
2040-06-16

AI Technical Summary

Technical Problem

In K8S systems, configuration items for multiple services are complex and error-prone, resulting in a long time-consuming and low success rate of configuration file deployment.

Method used

By controlling the terminal to respond to the setting instructions of the application item or its superior node, the configuration items corresponding to the application item are set based on the parameter values ​​in the setting instructions, and the placeholders in the configuration file template are replaced based on the parameter values ​​of the configuration item, and the configuration files of each service to be deployed are generated and deployed.

Benefits of technology

Improves the efficiency and accuracy of setting configuration items, shortens the time to obtain accurate configuration files, and improves the success rate of deploying configuration files for work nodes in K8S systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113821267B_ABST
    Figure CN113821267B_ABST
Patent Text Reader

Abstract

The present application provides a configuration file processing method, a control terminal, and a management terminal, and relates to the field of computer technology. The configuration file processing method provided in this embodiment is applied to a control terminal, including: responding to a setting instruction for an upper node of an application item or a setting instruction for the application item, and setting the configuration item corresponding to the application item based on the parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing the configuration file template of the service to be deployed; replacing the placeholder in the configuration file template based on the parameter value of the configuration item in each service to be deployed, obtaining the configuration file of each service to be deployed, and sending the configuration file to the management node in the K8S cluster, so that the working node in the K8S cluster deploys the configuration file through the management node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a configuration file processing method, a control terminal and a management terminal. Background Art

[0002] With the rapid development of computer technology, the application of open source container orchestration systems (such as Kubernetes system, referred to as K8S system) is becoming more and more widespread. K8S system is a powerful container orchestration system. In K8S system, each container is isolated from each other, each container has its own file system, and the processes between containers will not affect each other. Therefore, K8S system is widely used for service deployment. In service deployment, the service configuration file needs to be deployed.

[0003] In the related technology, configuration values ​​are set for configuration items corresponding to each application item of all services in the K8S system. After the settings are completed, a configuration file is obtained, and the configuration file is distributed through network commands such as secure copy (scp for short), and the configuration file is deployed by the mirror of each service.

[0004] However, the above solution requires setting configuration values ​​for the configuration items corresponding to each application item of all services in order to obtain the configuration file. For application scenarios with more services, such as microservice architecture scenarios, the configuration item setting process is complicated and error-prone, resulting in a long process for obtaining the configuration file and a low success rate for deploying the configuration file. Summary of the invention

[0005] The present invention provides a configuration file processing method, a control terminal and a management terminal, which are used to improve the efficiency and accuracy of setting configuration items, thereby improving the efficiency of obtaining accurate configuration files and improving the success rate of deploying configuration files on working nodes in a K8S system.

[0006] In a first aspect, an embodiment of the present application provides a configuration file processing method, which is applied to a control terminal, and the method includes:

[0007] In response to a setting instruction for an upper node of an application item or a setting instruction for the application item, a configuration item corresponding to the application item is set based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed;

[0008] The placeholders in the configuration file template are replaced based on the parameter values ​​of the configuration items in each service to be deployed to obtain the configuration file of each service to be deployed, and the configuration file is sent to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node.

[0009] In the above scheme, the control terminal responds to the setting instructions for the application item or its parent node, and will set the configuration items corresponding to the application item based on the parameter values ​​in the setting instructions. That is, in response to the setting instructions for the parent node of the application item, the configuration items corresponding to all application items under the parent node are uniformly set, thereby improving the efficiency of setting the configuration items. In addition, in response to the setting instructions for the application item, the configuration items corresponding to one or more application items are personalized, thereby avoiding the problem of inaccurate parameter value settings of the configuration items caused by only unified settings through the parent node, thereby improving the accuracy of setting the configuration items, and then replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so that an accurate configuration file can be obtained in a shorter time. After sending the configuration file to the management node in the K8S cluster, the success rate of the working nodes in the K8S cluster deploying the above configuration file is improved.

[0010] In a possible implementation, the method further includes: using the same configuration item in all services to be deployed as the parent node of the corresponding application item; or using the same configuration item in each service to be deployed as the parent node of the corresponding application item.

[0011] The above scheme, by using the same configuration items in all services to be deployed as the parent nodes of the corresponding application items, can further improve the efficiency of setting configuration items, and is more suitable for scenarios where the proportion of identical configuration values ​​of the same configuration items among services to be deployed is relatively high; or using the same configuration items in each service to be deployed as the parent nodes of the corresponding application items can balance the efficiency and accuracy of setting configuration items, and is more suitable for scenarios where the configuration values ​​of the same configuration items among services to be deployed vary greatly, but the proportion of identical configuration values ​​of the same configuration items of the same service to be deployed is relatively high. The above two methods of setting the parent nodes of application items can meet the needs of different application scenarios.

[0012] In a possible implementation, after obtaining the configuration files of the services to be deployed, the process further includes:

[0013] Sending a first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares a second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node;

[0014] If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

[0015] In the above scheme, the control terminal obtains a first verification code by performing hash calculation on each configuration file and sends it to the management node. The management node performs hash calculation on each configuration file to obtain a second verification code and compares it with the corresponding first verification code. The management node can accurately determine whether there is a transmission error in each configuration file based on the comparison result, and sends a retransmission request for the configuration file with transmission error to the control terminal. The control terminal retransmits the configuration file with transmission error to the management node based on the request, thereby avoiding the situation where the working node deploys an erroneous configuration file due to the management node receiving the configuration file with transmission error.

[0016] In a second aspect, an embodiment of the present application provides another configuration file processing method, which is applied to a management node in a K8S cluster, and the method includes:

[0017] Receive a configuration file sent by a control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by the control terminal replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the upper node of the application item or the setting instructions for the application item.

[0018] In the above scheme, the control terminal uniformly sets the configuration items corresponding to all application items under the upper-level node based on the setting instructions for the application item, thereby improving the efficiency of setting the configuration items. In addition, based on the setting instructions for the application items, the configuration items corresponding to one or more application items are personalized, thereby avoiding the problem of inaccurate parameter value settings of the configuration items caused by only unified settings through the upper-level node, thereby improving the accuracy of setting the configuration items, and then replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so that an accurate configuration file can be obtained in a shorter time. After the management node receives the configuration file sent by the control terminal, the working node deploys the above configuration file, and the success rate of deployment is improved.

[0019] In a possible implementation manner, after receiving the configuration file sent by the control terminal, the method further includes:

[0020] Performing hash calculation on the configuration files of the services to be deployed to obtain a second verification code of the configuration files, and comparing the second verification code of the configuration files with the corresponding first verification code, wherein the first verification code is obtained by performing hash calculation on the configuration files of the services to be deployed by the control terminal;

[0021] If there is a configuration file whose second verification code is different from the first verification code, the different configuration file is re-requested from the control terminal, and re-verification is performed after receiving the different configuration file sent by the control terminal.

[0022] In the above scheme, the control terminal obtains a first verification code by performing hash calculation on each configuration file and sends it to the management node. The management node obtains a second verification code by performing hash calculation on each configuration file and compares it with the first verification code. According to the comparison result, it can accurately determine whether there is a transmission error in each configuration file, and re-request the configuration file with transmission error to the control terminal. Based on the request, the control terminal resends the configuration file with transmission error to the management node, thereby avoiding the situation where the working node deploys an erroneous configuration file due to the management node receiving the configuration file with transmission error.

[0023] In a possible implementation manner, after comparing the second verification code with the corresponding first verification code, the method further includes:

[0024] If the second verification codes of all configuration files are the same as the corresponding first verification codes, a request for obtaining a deployment script is sent to the control terminal;

[0025] Receive the deployment script of each service to be deployed sent by the control terminal, so that the working node deploys the configuration file based on the deployment script.

[0026] In the above scheme, if there is no transmission error in the configuration file, a request for obtaining the deployment script will be sent to the control terminal. After receiving the deployment script of each service to be deployed sent by the control terminal, each service image in the working node will deploy the corresponding configuration file based on the corresponding deployment script, thereby completing the configuration file deployment.

[0027] In a third aspect, an embodiment of the present application provides a control terminal, including a processor and a memory;

[0028] The memory stores a program code, and when the program code is executed by the processor, the processor executes:

[0029] In response to a setting instruction for an upper node of an application item or a setting instruction for the application item, a configuration item corresponding to the application item is set based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed;

[0030] The placeholders in the configuration file template are replaced based on the parameter values ​​of the configuration items in each service to be deployed to obtain the configuration file of each service to be deployed, and the configuration file is sent to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node.

[0031] In a possible implementation, the processor further executes:

[0032] The same configuration items in all services to be deployed are used as the parent nodes of the corresponding application items; or the same configuration items in each service to be deployed are used as the parent nodes of the corresponding application items.

[0033] In a possible implementation, the processor further executes:

[0034] After obtaining the configuration files of the services to be deployed, sending the first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares the second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node;

[0035] If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

[0036] In a fourth aspect, an embodiment of the present application provides a management terminal, which is a management node in a K8S cluster, and includes a processor and a memory;

[0037] The memory stores a program code, and when the program code is executed by the processor, the processor executes:

[0038] Receive a configuration file sent by a control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by the control terminal replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the upper node of the application item or the setting instructions for the application item.

[0039] In a possible implementation, the processor further executes:

[0040] After receiving the configuration file sent by the control terminal, performing hash calculation on the configuration files of the services to be deployed to obtain a second verification code of the configuration files, and comparing the second verification code of the configuration files with the corresponding first verification code, wherein the first verification code is obtained by performing hash calculation on the configuration files of the services to be deployed by the control terminal;

[0041] If there is a configuration file whose second verification code is different from the first verification code, the different configuration file is re-requested from the control terminal, and re-verification is performed after receiving the different configuration file sent by the control terminal.

[0042] In a possible implementation, the processor further executes:

[0043] After comparing the second verification code with the corresponding first verification code, if the second verification codes of all configuration files are the same as the corresponding first verification codes, a request for obtaining a deployment script is sent to the control terminal;

[0044] Receive the deployment script of each to-be-deployed service sent by the control terminal, so that the working node deploys the configuration file based on the first deployment script.

[0045] In a fifth aspect, an embodiment of the present application provides a configuration file processing device, the device comprising:

[0046] A setting module, configured to respond to a setting instruction for an upper node of an application item or a setting instruction for the application item, and to set a configuration item corresponding to the application item based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed;

[0047] The configuration file processing module is used to replace the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, obtain the configuration file of each service to be deployed, and send the configuration file to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node.

[0048] In a sixth aspect, an embodiment of the present application provides another configuration file processing device, the device comprising:

[0049] A transceiver module is used to receive a configuration file sent by a control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by the control terminal replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the upper node of the application item or the setting instructions for the application item.

[0050] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the configuration file processing method described in the first aspect or the second aspect is implemented.

[0051] In addition, the technical effects brought about by any implementation method in the third to seventh aspects can refer to the technical effects brought about by different implementation methods in the first or second aspects, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:

[0053] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0054] Figure 2 An interactive flow chart of a configuration file processing method provided in an embodiment of the present application;

[0055] Figure 3 A schematic diagram of the correspondence between application items and configuration items in the service to be deployed provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of the relationship between an application item and an upper-level node provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the relationship between another application item and a parent node provided in an embodiment of the present application;

[0058] Figure 6 An interactive flow chart of another configuration file processing method provided in an embodiment of the present application;

[0059] Figure 7 A schematic diagram of a configuration file processing device provided in an embodiment of the present application;

[0060] Figure 8 A schematic diagram of another configuration file processing device provided in an embodiment of the present application;

[0061] Fig. 9 A schematic diagram of a control terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all 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.

[0063] The following are explanations of some of the terms that appear in the text:

[0064] In the embodiments of the present invention, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0065] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0066] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be directly connected, or indirectly connected through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0067] The K8S system is a powerful container orchestration system. In the K8S system, each container is isolated from each other, each container has its own file system, and the processes between containers do not affect each other. Therefore, the K8S system is widely used for service deployment. In service deployment, the service configuration file needs to be deployed. In the related technology, the configuration value is set for the configuration item corresponding to each application item of all services in the K8S system. After the setting is completed, the configuration file is obtained, and the configuration file is distributed through network commands such as scp, and the image of each service deploys the configuration file.

[0068] However, the above solution requires setting configuration values ​​for the configuration items corresponding to each application item of all services in order to obtain the configuration file. For application scenarios with more services, such as microservice architecture scenarios, the configuration item setting process is complicated and error-prone, resulting in a long process for obtaining the configuration file and a low success rate for deploying the configuration file.

[0069] In view of this, an embodiment of the present invention proposes a configuration file processing method, a control terminal and a management terminal. In the configuration file processing method, the control terminal responds to the setting instruction for the application item or its parent node, and sets the configuration item corresponding to the application item based on the parameter value in the setting instruction. That is, in response to the setting instruction for the parent node of the application item, the configuration items corresponding to all application items under the parent node are uniformly set, thereby improving the efficiency of setting the configuration items. In addition, in response to the setting instruction for the application item, the configuration items corresponding to one or more application items are personalized, thereby avoiding the problem of inaccurate parameter value setting of the configuration item caused by only unified setting through the parent node, thereby improving the accuracy of setting the configuration items, and then replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so that an accurate configuration file can be obtained in a shorter time. After the configuration file is sent to the management node in the K8S cluster, the success rate of the working nodes in the K8S cluster in deploying the above configuration file is improved.

[0070] The present application is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0071] See also Figure 1 The figure shows a schematic diagram of an application scenario provided in some embodiments of the present application.

[0072] In this application scenario, the control terminal 101 may receive a setting instruction for a parent node of an application item or a setting instruction for the application item;

[0073] The configuration file template of the service to be deployed may also be parsed to obtain the application item and the corresponding configuration item of the service to be deployed, and the configuration item corresponding to the application item may be set based on the parameter value in the setting instruction;

[0074] The placeholders in the configuration file template may also be replaced based on the parameter values ​​of the configuration items in each service to be deployed to obtain the configuration files of each service to be deployed.

[0075] The control terminal 101 can also interact with the management node 102 in the K8S cluster through various communication methods. For example, the control terminal 101 can be allowed to send the configuration file to the management node 102 through a local area network (LAN), a wireless local area network (WLAN) and other networks.

[0076] The management node 102 can communicate with the working nodes in the K8S cluster ( Figure 1 Taking working node 1, working node 2, and working node 3 as an example for explanation, in actual applications, the number of working nodes can be more or less) for interaction, the working nodes can be allowed to deploy the configuration file through the management node 102.

[0077] The above-mentioned application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. A person of ordinary skill in the art can appreciate that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.

[0078] In some embodiments, Figure 2 As shown, the configuration file processing method provided in the embodiment of the present application includes the following steps:

[0079] Step S201: the control terminal responds to a setting instruction for an upper node of an application item or a setting instruction for the application item, and sets a configuration item corresponding to the application item based on a parameter value in the setting instruction.

[0080] The application items and corresponding configuration items are obtained by parsing a configuration file template of the service to be deployed.

[0081] In this embodiment, it is necessary to set the configuration items corresponding to the application items, and then obtain the configuration file based on the set parameter values.

[0082] Exemplarily, the control terminal performs unified settings on configuration items corresponding to all application items under the upper node based on the received setting instruction for the upper node of the application item;

[0083] Alternatively, based on the received setting instruction for the application item, the configuration item directly corresponding to the application item is personalized.

[0084] The above configuration items are the parts that require parameter value settings. For example, if the configuration item is a cycle, a specific value of the cycle needs to be set; if the setting item is a date, a specific date needs to be set.

[0085] The above application items are where the corresponding configuration items need to be applied to the services to be deployed after the parameter values ​​are set.

[0086] The above configuration items and application items are merely examples and are not limited in this embodiment.

[0087] Figure 3 A schematic diagram of the correspondence between application items and configuration items in the service to be deployed provided in some embodiments of the present application, such as Figure 3 As shown:

[0088] Application item 11 in service 1 to be deployed corresponds to configuration item A, application item 12 in service 1 to be deployed corresponds to configuration item B, and application item 13 in service 1 to be deployed also corresponds to configuration item B; application item 21 in service 2 to be deployed corresponds to configuration item A, application item 22 in service 2 to be deployed corresponds to configuration item C, and application item 23 in service 2 to be deployed corresponds to configuration item B; application item 31 in service 3 to be deployed corresponds to configuration item C, application item 32 in service 3 to be deployed corresponds to configuration item B, application item 33 in service 3 to be deployed corresponds to configuration item C, and application item 34 in service 3 to be deployed corresponds to configuration item A. Each application item in each service to be deployed has its corresponding configuration item, and the configuration items corresponding to each application item in the same service to be deployed may be the same or different, and the configuration items corresponding to application items in different services to be deployed may be the same or different.

[0089] It can be understood that the correspondence between the above application items and configuration items is only an example and is not intended to limit the embodiments of the present application.

[0090] Optionally, in some embodiments, the same configuration items in all services to be deployed can be used as parent nodes of corresponding application items. Figure 3 The corresponding relationship between application items and configuration items in Figure 4 As shown:

[0091] The same configuration items in the three services to be deployed are used as the parent nodes of the corresponding application items, that is, configuration item A is used as the parent node of application item 11, application item 21 and application item 34; configuration item B is used as the parent node of application item 12, application item 13, application item 23 and application item 32; configuration item C is used as the parent node of application item 22, application item 31 and application item 33.

[0092] For these three services to be deployed, the unified setting of configuration items corresponding to all application items under each upper-level node can be completed only by setting the three upper-level nodes, which can further improve the efficiency of setting configuration items and is more suitable for scenarios where the proportion of configuration values ​​of the same configuration items between the services to be deployed is relatively high.

[0093] Optionally, in some embodiments, the same configuration items in each service to be deployed may be used as the parent node of the corresponding application item. Figure 3 The corresponding relationship between application items and configuration items in Figure 5 As shown:

[0094] The same configuration items in each service to be deployed are used as the parent node of the corresponding application item, that is, configuration item A in service to be deployed 1 is used as the parent node of application item 11, and configuration item B is used as the parent node of application item 12 and application item 13; configuration item A in service to be deployed 2 is used as the parent node of application item 21, configuration item B is used as the parent node of application item 23, and configuration item C is used as the parent node of application item 22; configuration item A in service to be deployed 3 is used as the parent node of application item 34, configuration item B is used as the parent node of application item 32, and configuration item C is used as the parent node of application item 31 and application item 33.

[0095] For these three services to be deployed, by setting the eight upper-level nodes, the unified setting of configuration items corresponding to all application items under each upper-level node can be completed, which can balance the efficiency and accuracy of setting configuration items. It is more suitable for scenarios where the configuration values ​​of the same configuration items among the services to be deployed are quite different, but the configuration values ​​of the same configuration items of the same service to be deployed have a higher proportion of the same configuration values.

[0096] Other ways of setting the upper-level node of the application item are also applicable to the embodiment of the present invention and will not be described in detail here.

[0097] This embodiment does not limit the specific type of the configuration file template, for example, it can be an Extensible Markup Language (XML) type configuration file template and / or a YAML (Yet Another Markup Language) type configuration file. Regardless of the type of configuration file template, after parsing it, application items and corresponding configuration items will be obtained.

[0098] This embodiment does not limit the specific method of parsing the configuration file template of the service to be deployed to obtain the application items and the corresponding configuration items. A suitable class library can be selected according to the actual application scenario to parse different types of configuration file templates.

[0099] Step S202: The control terminal replaces the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so as to obtain the configuration files of each service to be deployed.

[0100] In this embodiment, after setting parameter values ​​for configuration items corresponding to all application items, it is necessary to obtain a configuration file based on the configuration values, for example:

[0101] Freemarker (a template engine) was used when writing the configuration file template. Freemarker can also be used for unified rendering when replacing the placeholders in the configuration file template based on parameter values, so that the configuration files of each service to be deployed can be obtained quickly and easily.

[0102] Alternatively, you can use regular expressions to replace the parameter values ​​with placeholders in the configuration file template.

[0103] The above two replacement methods are only examples, and other replacement methods are also applicable to this embodiment and will not be described in detail here.

[0104] Step S203: The control terminal sends the configuration file to the management node.

[0105] Exemplarily, the control terminal sends the configuration file to the management node through the Transmission Control Protocol / Internet Protocol (TCP / IP protocol) using LAN, WLAN and / or other networks according to actual application scenarios. Taking the use of a LAN network to send the configuration file to the management node as an example:

[0106] In this embodiment, after the management node receives the above configuration file, the working nodes in the K8S cluster deploy the above configuration file through the management node.

[0107] In the above scheme, the control terminal responds to the setting instructions for the application item or its parent node, and will set the configuration items corresponding to the application item based on the parameter values ​​in the setting instructions. That is, in response to the setting instructions for the parent node of the application item, the configuration items corresponding to all application items under the parent node are uniformly set, thereby improving the efficiency of setting the configuration items. In addition, in response to the setting instructions for the application item, the configuration items corresponding to one or more application items are personalized, thereby avoiding the problem of inaccurate parameter value settings of the configuration items caused by only unified settings through the parent node, thereby improving the accuracy of setting the configuration items, and then replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so that an accurate configuration file can be obtained in a shorter time. After sending the configuration file to the management node in the K8S cluster, the success rate of the working nodes in the K8S cluster deploying the above configuration file is improved.

[0108] In addition, in the related art, the configuration files are distributed through network commands such as scp, which has poor reliability. When the management node receives the configuration file with incorrect transmission, it will cause the working node to deploy the wrong configuration file. In order to solve this problem, Figure 6 An interactive flow chart of another configuration file processing method provided by an embodiment of the present invention, such as Figure 6 As shown, this embodiment Figure 2 Based on the embodiment, the following steps are specifically included:

[0109] Step S601: the control terminal responds to a setting instruction for an upper node of an application item or a setting instruction for the application item, and sets a configuration item corresponding to the application item based on a parameter value in the setting instruction.

[0110] Step S602: The control terminal replaces the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, so as to obtain the configuration files of each service to be deployed.

[0111] Step S603: The control terminal sends the configuration file to the management node.

[0112] The implementation of steps S601-S603 is the same as that of the above steps S201-S203, and will not be repeated here.

[0113] Step S604: the control terminal sends the first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node.

[0114] In this embodiment, the control terminal calculates the first verification code of each configuration file through a hash function, for example:

[0115] The first check code is calculated by the message digest algorithm (MD5), and the function calculates the MD5 value of each configuration file as the first check code;

[0116] The first check code is obtained by using Secure Hash Algorithm 1 (SHA-1 for short), and the function calculates the SHA-1 value of each configuration file as the first check code.

[0117] The above two hash calculation methods are only specific descriptions, and other hash calculation methods are also applicable to this embodiment.

[0118] This embodiment does not limit the order of step S603 and step S604, that is, step S603 may be performed first, or step S604 may be performed first, or they may be combined into one step, for example:

[0119] 1) After the control terminal obtains each configuration file, it first performs hash calculation on each configuration file to obtain a first verification code, sends the first verification code to the management node, and then sends the configuration file to the management node;

[0120] 2) After the control terminal obtains each configuration file, it first sends the configuration file to the management node, then performs hash calculation on each configuration file to obtain a first verification code, and then sends the first verification code to the management node uniformly;

[0121] 3) After the control terminal obtains each configuration file, it first performs hash calculation on each configuration file to obtain a first verification code, places the first verification code in a preset position in the configuration file, and sends it to the management node together.

[0122] The above-mentioned methods are only for illustrating that the order of step S603 and step S604 is not limited in this embodiment, but this embodiment is not limited to the above-mentioned three sending methods.

[0123] Step S605: The management node performs hash calculation on the configuration files of the services to be deployed to obtain the second verification code of the configuration files, and compares the second verification code of the configuration files with the corresponding first verification code. If all the second verification codes are the same as the corresponding first verification codes, execute step S609; if there is a configuration file whose second verification code is different from the first verification code, execute step S606.

[0124] It can be understood that the management node needs to use the same hash calculation method as the above control terminal to obtain the second check code, for example:

[0125] The control terminal calculates the MD5 value of each configuration file by using the MD5 function as the first verification code, and the management node also needs to use the MD5 function to calculate the MD5 value of each configuration file as the second verification code;

[0126] The control terminal calculates the SHA-1 value of each configuration file using the SHA-1 function as the first verification code, and the management node also needs to use the SHA-1 function to calculate the SHA-1 value of each configuration file as the second verification code.

[0127] The above example is only for illustrating that the management node needs to adopt the same hash calculation method as the above control terminal, and is not intended to limit this embodiment.

[0128] If the second verification code of each configuration file is the same as the corresponding first verification code, it means that the configuration files received by the management node are all correctly transmitted files; if there is a configuration file whose second verification code is different from the corresponding first verification code, it means that the configuration file received by the management node is a wrongly transmitted file.

[0129] Step S606: The management node sends a request to the control terminal to resend the different configuration file.

[0130] As described above, if there is a configuration file whose second verification code is different from the corresponding first verification code, it means that the configuration file received by the management node is a file with a transmission error. After receiving the configuration file with a transmission error, the management node needs to re-acquire the configuration file to avoid the working node deploying the wrong configuration file.

[0131] Exemplarily, the management node sends a request for resending a different configuration file to the control terminal through the TCP / IP protocol and using a LAN, a WLAN and / or other networks according to actual application scenarios.

[0132] Step S607: the control terminal sends the different configuration file to the management node based on the request for resending the different configuration file.

[0133] Exemplarily, after receiving a request to resend a different configuration file, the control terminal determines the configuration file to be resent based on the identifier of the different configuration file carried in the request, and then sends the configuration file to be resent to the management node again through the TCP / IP protocol and using LAN, WLAN and / or other networks according to the actual application scenario.

[0134] Step S608: After receiving the different configuration files sent by the control terminal, the management node re-checks.

[0135] In this embodiment, after receiving a different configuration file resent by the control terminal, the management node can use the same method as the above embodiment to perform hash calculation on the different configuration file to obtain a new second verification code, and re-compare the second verification code with the corresponding first verification code. If all the second verification codes are the same as the corresponding first verification codes, it means that the resent configuration files received by the management node are all correctly transmitted files; if there is a configuration file with a second verification code that is different from the corresponding first verification code, it means that the configuration file received by the management node is still a wrongly transmitted file, and it is necessary to request the control terminal to resend it again. The specific request method can be found in the above embodiment and will not be repeated here.

[0136] Exemplarily, in this embodiment, the management node receives the configuration file sent by the control terminal, and confirms that the configuration files of each service to be deployed are correctly transmitted files. The configuration files of each service to be deployed can be submitted to the ConfigMap (configuration map) of K8S, so that each service image in the working node can obtain the corresponding configuration file of the service to be deployed.

[0137] Step S609: the management node sends a request for obtaining a deployment script to the control terminal.

[0138] Step S610: the control terminal sends the deployment script of each to-be-deployed service to the management terminal based on the request for obtaining the deployment script.

[0139] In this embodiment, each service image in the working node needs to deploy the configuration file based on the corresponding deployment script. Based on this, it is necessary to send a request for obtaining the deployment script to the control terminal through the management node, so that the control terminal sends the deployment script of each service to be deployed to the management node based on the request, so that each service image can obtain the corresponding deployment script.

[0140] The interactive manner in which the management node sends a request to the control terminal for obtaining a deployment script, and the control terminal sends the deployment script of each service to be deployed to the management node can be seen in the above embodiment and will not be described again here.

[0141] Exemplarily, after receiving the deployment scripts of each service to be deployed sent by the control terminal, the management node calls the local shell (computer shell) deployment script, which is the deployment sequence script of each service to be deployed. Each service image in the working node obtains the corresponding configuration file from ConfigMap in sequence according to the deployment order in the shell deployment script, and obtains the corresponding deployment script from the local, and deploys the configuration file based on the deployment script.

[0142] In the above scheme, the control terminal performs hash calculation on each configuration file to obtain a first check code and sends it to the management node. The management node performs hash calculation on each configuration file to obtain a second check code and compares it with the first check code. The management node can accurately determine whether there is a transmission error in each configuration file based on the comparison result, and re-request the configuration file with transmission error from the control terminal. The control terminal resends the configuration file with transmission error to the management node based on the request, thereby avoiding the configuration file with transmission error received by the management node, which causes the working node to deploy the wrong configuration file. In addition, if there is no transmission error in the configuration file, a request for obtaining the deployment script will be sent to the control terminal. After receiving the deployment script of each service to be deployed sent by the control terminal, each service image in the working node deploys the corresponding service configuration file based on the deployment script of the corresponding service, thereby completing the configuration file deployment.

[0143] Based on the same inventive concept, Figure 7 A schematic diagram of a configuration file processing device provided in an embodiment of the present application, such as Figure 7 As shown, the configuration file processing device 700 includes: a setting module 701 and a configuration file processing module 702 , and optionally further includes a node determination module 703 .

[0144] A setting module 701 is used to respond to a setting instruction for an upper node of an application item or a setting instruction for the application item, and to set a configuration item corresponding to the application item based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed;

[0145] The configuration file processing module 702 is used to replace the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, obtain the configuration file of each service to be deployed, and send the configuration file to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node.

[0146] In a possible implementation, the node determination module 703 is used to use the same configuration items in all services to be deployed as the parent node of the corresponding application item; or use the same configuration items in each service to be deployed as the parent node of the corresponding application item.

[0147] In a possible implementation, the configuration file processing module 702 is further configured to:

[0148] Sending a first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares a second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node;

[0149] If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

[0150] Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0151] Based on the same inventive concept, Figure 8 A schematic diagram of another configuration file processing device provided in an embodiment of the present application, such as Figure 8 As shown, the configuration file processing device 800 includes: a transceiver module 801 , and optionally also a verification module 802 .

[0152] The transceiver module 801 is used to receive the configuration file sent by the control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by the control terminal replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the upper node of the application item or the setting instructions for the application item.

[0153] In a possible implementation, the verification module 802 is used to perform hash calculation on the configuration files of the services to be deployed to obtain a second verification code of the configuration files after the transceiver module 801 receives the configuration files sent by the control terminal, and compare the second verification code of the configuration files with the corresponding first verification code, wherein the first verification code is obtained by the control terminal performing hash calculation on the configuration files of the services to be deployed;

[0154] If there is a configuration file whose second verification code is different from the first verification code, the different configuration file is re-requested from the control terminal through the transceiver module 801, and re-verification is performed after the different configuration file sent by the control terminal is received through the transceiver module 801.

[0155] In a possible implementation, the transceiver module 801 is further configured to send a request for obtaining a deployment script to the control terminal if the second verification codes of all configuration files are the same as the corresponding first verification codes;

[0156] Receive the deployment script of each to-be-deployed service sent by the control terminal, so that the working node deploys the configuration file based on the first deployment script.

[0157] Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0158] Based on the same inventive concept, Fig. 9 A schematic diagram of a control terminal provided in an embodiment of the present application, such as Fig. 9 As shown, the control terminal 900 includes: a processor 901 and a memory 902;

[0159] The memory 902 is used to store the computer program executed by the processor 901. The memory 902 can be a volatile memory, such as a random-access memory (RAM); the memory 902 can also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 902 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 902 can be a combination of the above memories.

[0160] The processor 901 may include one or more central processing units (CPU), graphics processing units (GPU) or digital processing units, etc.

[0161] The specific connection medium between the memory 902 and the processor 901 is not limited in the embodiment of the present application. Fig. 9 In the embodiment, the memory 902 and the processor 901 are connected via a bus 903. The bus 903 is connected to the processor 901 via a bus 903. Fig. 9 The connection between other components is shown by bold lines, and is not intended to be limiting. The bus 903 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0162] The memory 902 stores a program code. When the program code is executed by the processor 901, the processor 901 executes:

[0163] In response to a setting instruction for an upper node of an application item or a setting instruction for the application item, a configuration item corresponding to the application item is set based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed;

[0164] The placeholders in the configuration file template are replaced based on the parameter values ​​of the configuration items in each service to be deployed to obtain the configuration file of each service to be deployed, and the configuration file is sent to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node.

[0165] In a possible implementation manner, the processor 901 further executes:

[0166] The same configuration items in all services to be deployed are used as the parent nodes of the corresponding application items; or the same configuration items in each service to be deployed are used as the parent nodes of the corresponding application items.

[0167] In a possible implementation manner, the processor 901 further executes:

[0168] After obtaining the configuration files of the services to be deployed, sending the first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares the second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node;

[0169] If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

[0170] Since the control terminal is the control terminal in the method in the embodiment of the present invention, and the principle of solving the problem by the control terminal is similar to that of the method, the implementation of the control terminal can refer to the implementation of the method, and the repeated parts will not be repeated.

[0171] Based on the same inventive concept, an embodiment of the present application provides a management terminal, which is a management node in a K8S cluster. The management terminal includes: a processor and a memory;

[0172] The memory stores a program code, and when the program code is executed by the processor, the processor executes:

[0173] Receive a configuration file sent by a control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by the control terminal replacing the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the upper node of the application item or the setting instructions for the application item.

[0174] In a possible implementation, the processor further executes:

[0175] After receiving the configuration file sent by the control terminal, performing hash calculation on the configuration files of the services to be deployed to obtain a second verification code of the configuration files, and comparing the second verification code of the configuration files with the corresponding first verification code, wherein the first verification code is obtained by performing hash calculation on the configuration files of the services to be deployed by the control terminal;

[0176] If there is a configuration file whose second verification code is different from the first verification code, the control terminal is re-requested for the different configuration file, and the verification is re-performed after receiving the different configuration file sent by the control terminal.

[0177] In a possible implementation, the processor further executes:

[0178] After comparing the second verification code with the corresponding first verification code, if the second verification codes of all configuration files are the same as the corresponding first verification codes, a request for obtaining a deployment script is sent to the control terminal;

[0179] Receive the deployment script of each to-be-deployed service sent by the control terminal, so that the working node deploys the configuration file based on the first deployment script.

[0180] An embodiment of the present invention further provides a computer-readable non-volatile storage medium, comprising a program code. When the program code is executed on a computing terminal, the program code is used to enable the computing terminal to execute the steps of any one of the configuration file processing methods in the above embodiments of the present invention.

[0181] The present application is described above with reference to the block diagrams and / or flow charts showing the methods, devices (systems) and / or computer program products according to the embodiments of the present application. It should be understood that a block of the block diagram and / or flow chart diagram and a combination of blocks of the block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine, so that the instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.

[0182] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.

[0183] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A configuration file processing method, characterized in that: Applied to a control terminal, the method comprises: In response to a setting instruction for an upper node of an application item, a configuration item corresponding to the application item is set based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed; Replace the placeholders in the configuration file template based on the parameter values ​​of the configuration items in each service to be deployed, obtain the configuration file of each service to be deployed, and send the configuration file to the management node in the K8S cluster, so that the working nodes in the K8S cluster deploy the configuration file through the management node; It also includes: using the same configuration items in all services to be deployed as the parent node of the corresponding application item; or using the same configuration items in each service to be deployed as the parent node of the corresponding application item; After obtaining the configuration files of each service to be deployed, the following steps are also included: Sending a first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares a second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node; If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

2. A configuration file processing method, characterized in that: The method is applied to a management node in a K8S cluster, and the method includes: Receive a configuration file sent by a control terminal so that the working nodes in the K8S cluster deploy the configuration file, wherein the configuration file is obtained by replacing the placeholders in the configuration file template by the control terminal based on the parameter values ​​of the configuration items in each service to be deployed, and the parameter values ​​of the configuration items are set based on the setting instructions for the parent node of the application item; the same configuration items in all services to be deployed are the parent nodes of the corresponding application items; or, the same configuration items in each service to be deployed are the parent nodes of the corresponding application items; After receiving the configuration file sent by the control terminal, it also includes: Performing hash calculation on the configuration files of the services to be deployed to obtain a second verification code of the configuration files, and comparing the second verification code of the configuration files with the corresponding first verification code, wherein the first verification code is obtained by performing hash calculation on the configuration files of the services to be deployed by the control terminal; If there is a configuration file whose second verification code is different from the first verification code, the control terminal is re-requested for the different configuration file, and the verification is re-performed after receiving the different configuration file sent by the control terminal.

3. The method according to claim 2, characterized in that After comparing the second check code with the corresponding first check code, the method further includes: If the second verification codes of all configuration files are the same as the corresponding first verification codes, a request for obtaining a deployment script is sent to the control terminal; Receive the deployment script of each service to be deployed sent by the control terminal, so that the working node deploys the configuration file based on the deployment script.

4. A control terminal, characterized in that: including a processor and a memory; The memory stores a program code, and when the program code is executed by the processor, the processor executes: In response to a setting instruction for an upper node of an application item, a configuration item corresponding to the application item is set based on a parameter value in the setting instruction, wherein the application item and the corresponding configuration item are obtained by parsing a configuration file template of a service to be deployed; The placeholders in the configuration file template are replaced based on the parameter values ​​of the configuration items in each service to be deployed to obtain the configuration file of each service to be deployed, and the configuration file is sent to the management node in the K8S cluster so that the working nodes in the K8S cluster deploy the configuration file through the management node; The processor also executes: Use the same configuration items in all services to be deployed as the parent node of the corresponding application item; or use the same configuration items in each service to be deployed as the parent node of the corresponding application item; The processor also executes: After obtaining the configuration files of the services to be deployed, sending the first verification code of each configuration file obtained by performing hash calculation on the configuration files of the services to be deployed to the management node, so that the management node compares the second verification code of the configuration file with the first verification code of the configuration file, wherein the second verification code is obtained by performing hash calculation on the configuration files by the management node; If a retransmission request sent by the management node is received, a configuration file corresponding to the identifier included in the retransmission request is sent to the control terminal, wherein the retransmission request carries an identifier of a configuration file in which the first verification code and the second verification code are different.

5. A management terminal, characterized in that: The management terminal is a management node in the K8S cluster, and the management terminal includes a processor and a memory; The memory stores program codes, and when the program codes are executed by the processor, the processor executes the configuration file processing method according to claim 2 or 3.

Citation Information

Patent Citations

  • Deployment method and deployment system for multiple systems

    CN107959579A

  • Network file system replacement method and device and cluster configuration file sharing method and device

    CN110944026A

  • PAAS cloud cluster construction method and device, electronic device and storage medium

    CN111193782A