Application configuration update comparison method and comparison device based on Helm

By adopting the Helm-based application configuration update comparison method in a multi-person collaboration environment, combining hybrid operation and maintenance matching and field filtering, the problem of Helm Chart application configuration is solved, and efficient and accurate configuration comparison and synchronous update are achieved.

CN119829161AActive Publication Date: 2025-04-15广州市玄瞳科技有限公司
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411798681.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-15
Estimated Expiration
2044-12-09

AI Technical Summary

Technical Problem

In a multi-person collaboration environment, the application configuration maintenance of Helm Chart is easily out of synchronized by the actual application configuration of the cluster and the application configuration of Helm Chart because the team and tool operations are out of the management scope of Helm Chart, making it difficult to accurately track application configuration changes and integrate and synchronize the actual modified application configurations.

Method used

Using Helm-based application configuration update comparison method, Helm renders the target configuration list of Chart in the current multi-person collaboration environment, combines the resource configuration list managed by Release in the cluster and the resource configuration for real-time query, performs mixed operation and maintenance matching, filters out resource configurations that may be affected by the update, and generates refined resource configuration files to display the differences through field filtering and difference comparison.

Benefits of technology

It significantly improves the efficiency and accuracy of configuration comparison, ensures that the real-time configuration in the cluster is synchronized with the configuration of Helm rendering, maximizes the order consistency of API objects, and reduces configuration check omissions or misjudgments caused by name changes or other interference items.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829161A_ABST
    Figure CN119829161A_ABST
Patent Text Reader

Abstract

The invention relates to a Helm-based application configuration updating and comparing method, which specifically comprises the following steps of: rendering an application in a current multi-user collaboration environment by adopting Helm to obtain a rendered resource configuration list; meanwhile, a resource configuration list managed by Release in the cluster is screened out through labels and annotations; performing hybrid operation and maintenance matching based on rendered resource configuration lists managed by Release in the cluster and resource configuration queried by the cluster in real time to obtain a target resource configuration list to be influenced by the to-be-filtered cluster, performing field filtering on the target resource configuration list and the rendered resource configuration lists, and performing file generation respectively to obtain a to-be-filtered target resource configuration list; and obtaining a refined rendered resource configuration file and a target resource configuration list file of which the refined cluster is to be influenced, performing difference comparison, and displaying a difference item of the rendered resource configuration file. According to the application configuration updating comparison method based on the Helm, the configuration management efficiency of the Helm in a multi-user cooperation environment is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of operation and maintenance and resource configuration management of Kubernetes and Helm in a multi-person collaborative environment, and in particular to an application configuration update comparison method, a comparison device, an electronic device and a computer storage medium based on Helm. Background Art

[0002] In the development and operation of large-scale distributed applications, the application configuration environment needs to be constantly adjusted with the development, testing and deployment stages. Especially in a collaborative environment with multiple people, the development and operation teams usually need to make frequent configuration changes in different modules, such as automatically updating the image version through the CI / CD platform, or directly modifying configuration files such as ConfigMap and Deployment in Kubernetes (K8s). Then, the modified configuration will be centrally managed, synchronously updated and uniformly deployed through Helm Chart.

[0003] Among them, the CI / CD platform is used for automated integration and continuous delivery to ensure rapid application of images and configuration updates at various stages of the development process; the K8s is used to manage resources and services of distributed applications to provide efficient container orchestration; the Helm Chart is a package management tool for Kubernetes, which is used to version configuration files and provide one-click deployment functions to improve the efficiency of configuration management.

[0004] However, in a hybrid management environment with multiple teams and multiple tools, the application configuration maintenance of Helm Chart is prone to the problem of the actual application configuration of the cluster and the application configuration of Helm Chart being out of sync because the team and tool operations are out of the management scope of Helm Chart. For example, team members may directly modify the application configuration through the CI / CD process or K8s tools, but these changes are not actually synchronized to Helm Chart, resulting in the actual configuration in the cluster being out of sync with the application configuration recorded in Helm Chart.

[0005] In addition, although Helm Chart provides a difference detection command (helm diff) to detect application configuration differences, this command can only detect the difference between the application configuration rendered by Helm Release and Helm Chart, and cannot perceive changes made by manual operations or other tools. Therefore, Helm has the defect of being difficult to accurately track application configuration changes and integrate and synchronize the actual modified application configuration in a multi-person collaborative environment, making Helm unusable for safe continuous iteration and maintenance of applications after initial deployment. Summary of the invention

[0006] Based on this, the purpose of the present invention is to provide an application configuration update comparison method based on Helm.

[0007] A Helm-based application configuration update comparison method includes the following steps:

[0008] S1A, use Helm to render the application of the current multi-person collaborative environment and obtain the rendering resource configuration list;

[0009] S1B. Extract all resource configuration lists managed by Helm from the cluster through label filtering, and filter all resource configuration lists managed by Helm according to annotations to obtain the resource configuration list managed by Release in the cluster;

[0010] S2. Based on the resource configuration list of the rendering and Release management in the cluster, and combined with the resource configuration of the cluster real-time query, a mixed operation and maintenance matching is performed to obtain the target resource configuration list that will be affected by the cluster to be filtered;

[0011] S3. Perform field filtering on the target resource configuration list that will be affected by the cluster to be filtered and the rendered resource configuration list to obtain the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list;

[0012] S4. Generate files for the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list respectively, and obtain the resource configuration file rendered after refinement and the target resource configuration list file that will be affected by the cluster after refinement; and compare the differences between the rendered resource configuration file and the target resource configuration list file that will be affected by the cluster, and display the difference items of the rendered resource configuration file.

[0013] Compared with the prior art, the Helm-based application configuration update comparison method described in the present invention uses hybrid operation and maintenance matching to screen the resource configuration managed by Helm in the cluster, and ensures that the real-time configuration in the cluster is synchronized with the currently rendered resource configuration to maximize the sequential consistency of the API object, thereby significantly improving the efficiency of configuration comparison in a multi-person collaborative environment due to manual modifications by different teams or configuration asynchronization in a multi-source configuration environment. At the same time, the present invention uses field filtering to eliminate non-essential fields in Helm to simplify the configuration comparison content, significantly improving the configuration management efficiency and the configuration comparison efficiency in a multi-source configuration environment.

[0014] Furthermore, before performing the hybrid operation and maintenance matching, the following steps are also included:

[0015] Filter the resource configuration items in the resource configuration list Cluster managed by Release in the cluster that do not match the resource configuration list Render for rendering to form a dynamic list NameEffect, which is specifically expressed as follows:

[0016]

[0017] In the formula, key(x)∈list is used to represent the resource configuration item corresponding to the unique identifier x in a resource configuration list list; Render is the resource configuration list of the rendering, which is specifically expressed as:

[0018] Render = {a i |i∈[1,n]}

[0019] In the formula, a i represents the i-th rendered resource configuration item; n represents the total number of rendered resource configuration items; Cluster is the resource configuration list managed by Release in the cluster, which is specifically expressed as:

[0020] Cluster = {release j |j∈[1,m]}

[0021] In the formula, release j Indicates the jth resource configuration item managed by Release in the cluster; m indicates the total number of resource configuration items managed by the current Release.

[0022] Furthermore, the hybrid operation and maintenance matching is specifically represented as follows:

[0023]

[0024] In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Match with the resource configuration items of the Cluster, if they match, include them in the Target; Key (a i )∈Global represents the current resource configuration item a i Match the resource configuration items in the Global resource configuration list of the cluster real-time query, and include them in the Target if they match.

[0025] Accordingly, the present invention outputs all the configurations managed by Helm Release and the configurations rendered by the current Helm, that is, presents all the configuration items that may be affected, providing a basis for comparative analysis for operation and maintenance personnel, so that operation and maintenance personnel can analyze these configurations to quickly identify inconsistent parts, thereby avoiding missing potential changes, and significantly improving the reliability of configuration updates during Helm Release management and continuous integration.

[0026] Furthermore, the hybrid operation and maintenance matching is specifically represented as follows:

[0027]

[0028] In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Resource configuration item release of Cluster j Match, if match, release j Include Target;Key(a i )∈Global represents the current resource configuration item a i Resource configuration items of Global in real-time query of cluster resources k Match, if match, Global k Included in Target; similar(a i ,NameEffect) represents the current resource configuration item a i Similar matching operation with the resource configuration items of NameEffect. If a match is found, the resource configuration items of NameEffect are included in Target, and the resource configuration items of NameEffect are removed from NameEffect. i Similar resource configuration items.

[0029] Accordingly, the present invention inserts similarity matching or fuzzy matching steps with the dynamic list in the layer-by-layer matching process to identify resource configuration items that cannot be directly matched due to name changes, such as changes in suffix hash values, and thus incorporates them into the Target, effectively eliminating the interference caused by resource configuration items with inconsistent names but consistent essence.

[0030] At the same time, for dynamic list items that fail to pass similarity matching, the present invention merges their order to the end of the final Target. Since the unmatched items are not included in the Chart rendering result, the order of the unmatched items does not affect the comparison logic. Accordingly, by placing the unmatched items at the end of the Target, the operation and maintenance team can clearly identify that all unmatched items will be deleted after the Helm upgrade. If there is a problem with the Chart configuration, the operation and maintenance can confirm and check it, thereby effectively improving the reliability of configuration updates and comparison efficiency.

[0031] Based on this, the present invention effectively reduces configuration check omissions or misjudgments caused by name changes or other interference items, and further improves the efficiency and accuracy of resource configuration management in a multi-person collaborative environment.

[0032] Furthermore, the specific steps of the field filtering are as follows:

[0033] Obtain a preset field configuration file; wherein the field configuration file is provided with a hierarchical structure organization, and the hierarchical structure organization has a level with non-essential field keywords that need to be deleted;

[0034] The target resource configuration list and the rendered resource configuration list that will be affected by the cluster to be filtered are deeply recursed, and the fields corresponding to the first level of the resource configuration items in the resource configuration list are matched with the keywords of the non-essential fields in the preset field configuration file:

[0035] If the field corresponding to the level of the resource configuration item in the resource configuration list matches successfully, delete the field and all subfields;

[0036] If the field corresponding to the level of the resource configuration item in the resource configuration list is a list or array type, delete the matching field element in the list or array;

[0037] After deep recursion is completed, a target resource configuration list that will be affected by the cluster and a currently refined resource configuration list are formed.

[0038] The present invention presets a field configuration file consistent with the hierarchical structure of the resource configuration items in the resource configuration list, identifies and deletes non-essential fields, thereby achieving accurate filtering of all resource configuration items in the resource configuration list, thereby effectively reducing the interference of dynamic attributes or metadata in the comparison, so that the development team or operation and maintenance team can focus on the core part of the resource configuration. Accordingly, the present invention significantly improves the efficiency and accuracy of configuration comparison by ensuring the simplicity and consistency of resource configuration items.

[0039] A Helm-based application configuration update comparison device includes an application configuration rendering unit, a Release configuration acquisition unit, a hybrid operation and maintenance matching unit, a field filtering unit, and a difference file generation unit;

[0040] The application configuration rendering unit is used to render the application of the current multi-person collaboration environment using Helm to obtain a rendering resource configuration list;

[0041] The Release configuration acquisition unit is used to extract all resource configuration lists managed by Helm from the cluster through label filtering, and filter all resource configuration lists managed by Helm according to annotations to obtain the resource configuration list managed by Release in the cluster;

[0042] The hybrid operation and maintenance matching unit is used to perform hybrid operation and maintenance matching based on the resource configuration list of the rendering and Release management in the cluster and in combination with the resource configuration of the cluster real-time query to obtain a target resource configuration list that will be affected by the cluster to be filtered;

[0043] The field filtering unit is used to perform field filtering on the target resource configuration list that will be affected by the cluster to be filtered and the rendered resource configuration list, and obtain the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list;

[0044] The difference file generation unit is used to generate files for the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list respectively, to obtain the refined rendered resource configuration file and the refined target resource configuration list file that will be affected by the cluster; and to compare the differences between the rendered resource configuration file and the target resource configuration list file that will be affected by the cluster, to display the difference items of the rendered resource configuration file.

[0045] Furthermore, before performing the hybrid operation and maintenance matching, the following steps are also included:

[0046] Filter the resource configuration items in the resource configuration list Cluster managed by Release in the cluster that do not match the resource configuration list Render for rendering to form a dynamic list NameEffect, which is specifically expressed as follows:

[0047]

[0048] In the formula, Key(x)∈list is used to represent the resource configuration item corresponding to the unique identifier x in a resource configuration list list; Render is the resource configuration list of the rendering, which is specifically expressed as:

[0049] Render = {a i |i∈[1,n]}

[0050] In the formula, a i represents the i-th rendered resource configuration item; n represents the total number of rendered resource configuration items; Cluster is the resource configuration list managed by Release in the cluster, which is specifically expressed as:

[0051] Cluster = {release j |j∈[1,m]}

[0052] In the formula, release j Indicates the jth resource configuration item managed by Release in the cluster; m indicates the total number of resource configuration items managed by the current Release;

[0053] The hybrid operation and maintenance matching is specifically represented as follows:

[0054]

[0055] In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Resource configuration item release of Cluster j Match, if match, release j Include Target;Key(a i )∈Global represents the current resource configuration item a i Resource configuration items of Global in real-time query of cluster resources k Match, if match, Global k Included in Target; similar(a i ,NameEffect) represents the current resource configuration item a i Similar matching operation with the resource configuration items of NameEffect. If a match is found, the resource configuration items of NameEffect are included in Target, and the resource configuration items of NameEffect are removed from NameEffect. i Similar resource configuration items.

[0056] Furthermore, the specific steps of the field filtering are as follows:

[0057] Obtain a preset field configuration file; wherein the field configuration file is provided with a hierarchical structure organization, and the hierarchical structure organization has a level with non-essential field keywords that need to be deleted;

[0058] The target resource configuration list and the rendered resource configuration list that will be affected by the cluster to be filtered are deeply recursed, and the fields corresponding to the first level of the resource configuration items in the resource configuration list are matched with the keywords of the non-essential fields in the preset field configuration file:

[0059] If the field corresponding to the level of the resource configuration item in the resource configuration list matches successfully, delete the field and all subfields;

[0060] If the field corresponding to the level of the resource configuration item in the resource configuration list is a list or array type, delete the matching field element in the list or array;

[0061] After deep recursion is completed, a target resource configuration list that will be affected by the cluster and a currently refined resource configuration list are formed.

[0062] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 It is a simplified structural diagram of the Helm-based application configuration update comparison device of the present invention;

[0064] Figure 2 The figure is a simplified flowchart of the Helm-based application configuration update comparison method described in the present invention. DETAILED DESCRIPTION

[0065] In order to solve the problem that Helm cannot be used for safe continuous iteration and maintenance of applications after the initial deployment in a multi-person collaborative environment, the present invention uses Helm to render the target configuration list of the Chart in the current multi-person collaborative environment and generate a rendered resource configuration list; at the same time, all resource configuration lists managed by Helm are extracted from the cluster through label filtering, and the resource configuration list managed by Helm Release is further filtered out according to the annotations, and combined with real-time query of other cluster resources, the current actual configuration list of the cluster is constructed. Then, a hybrid operation and maintenance matching mechanism is used to match the rendered configuration, the configuration managed by Release, and the actual configuration of the cluster to filter out the resource configuration that may be affected by the update, and form a target resource configuration list to be processed. By filtering the rendered resource configuration list and the target resource configuration list by field, and comparing the differences, the corresponding difference items are displayed, so that the operation and maintenance personnel can intuitively filter out the configuration that needs to be updated and incorporate it into the Helm Chart, so as to achieve synchronous update of the cluster configuration. Accordingly, the present invention generates files corresponding to the resource configuration list to provide clear difference items, helping operation and maintenance personnel to quickly locate key configuration changes and achieve consistency between cluster configuration and Helm rendered configuration status, significantly improving the configuration management efficiency and accuracy of Helm in a multi-person collaborative environment, thereby ensuring the security and stability of application updates.

[0066] Based on the above design, the present invention proposes an application configuration update comparison method based on Helm, and based on this method proposes an application configuration update comparison device based on Helm.

[0067] See also Figure 1 and Figure 2 , Figure 1 This is a simplified structural diagram of the Helm-based application configuration update comparison device of the present invention. Figure 2 The figure is a simplified flowchart of the Helm-based application configuration update comparison method described in the present invention.

[0068] The Helm-based application configuration update comparison device includes an application configuration rendering unit 1A, a Release configuration acquisition unit 1B, a hybrid operation and maintenance matching unit 2, a field filtering unit 3 and a difference file generating unit 4.

[0069] The application configuration rendering unit 1A is used to execute step S1A: using Helm to render the application in the current multi-person collaboration environment to obtain a rendered resource configuration list.

[0070] Specifically, the helm template command is used to parse the template of the current multi-person collaborative environment to obtain all YAML files of the current template; and the parameter values ​​in a parameter file are replaced with the placeholders in all YAML files of the current template; at the same time, the corresponding conditional statements in all YAML files are logically converted to generate a rendered resource configuration list.

[0071] The resource configuration list Render for rendering is represented as follows:

[0072] Render = {a i |i∈[1,n]}

[0073] In the formula, a i Represents the resource configuration items rendered by the i-th Kubernetes API, that is, the configuration of the API object, which specifically includes the object type, the object's metadata, and the object's desired state. For example, the object type can be Deployment, Service, or ConfigMap, etc.; the object's metadata can be name, namespace, or label, etc.; the object's desired state can be container image or port mapping, etc.; n represents the total number of resource configuration items rendered.

[0074] Based on this, the API objects in the application corresponding to the current multi-person collaborative environment are rendered through helm template to generate a structured and clear resource configuration list, providing accurate benchmark data for subsequent configuration comparison and synchronization, so as to ensure that the rendered configuration and the actual cluster configuration can be accurately matched and analyzed item by item in subsequent steps, thereby helping the development and operation and maintenance teams to quickly identify key configuration changes in a multi-person collaborative environment, verify the correctness of the cluster configuration, and then assist in the iterative update of Helm Chart, and finally achieve efficient and secure management of application configuration.

[0075] The Release configuration acquisition unit 1B is used to execute step S1B: extract all Helm-managed resource configuration lists from the cluster by label filtering, and filter all Helm-managed resource configuration lists according to annotations to obtain the Release-managed resource configuration list in the cluster.

[0076] Specifically, kubectl get is used to filter out all resource configurations managed by HelmRelease in the current cluster by combining labels and annotations, and a list of resource configurations managed by Release in the cluster is generated. The specific expression is:

[0077] Cluster = {release j |j∈[1,m]}

[0078] In the formula, release j Indicates the jth resource configuration item managed by Helm Release in the cluster, which is used to describe the actual resource configuration managed by Helm Release in the cluster; m indicates the total number of resource configuration items managed by the current Helm Release.

[0079] The labels and annotations are specific labels and annotations related to Release management, which are used to identify whether the resource object is managed by the current Helm Release. You can refer to the following conditions for filtering, for example:

[0080] Use label matching: "app.kubernets.io / managed-by=Helm" to initially filter resources managed by Helm;

[0081] Annotation matching is further adopted: "meta.helm.sh / release-name" and "meta.helm.sh / release-namespace" to ensure that only resource configuration items corresponding to the current Release are extracted.

[0082] In a multi-person collaborative environment, a cluster may contain a large number of resource configurations, and the resource configurations in the cluster may be manually created by Helm management, development, or operation and maintenance personnel, or dynamically generated through other tools such as CI / CD platforms. Therefore, in order to ensure the accuracy and pertinence of the comparison, the resource configurations managed by Helm Release in the cluster need to be screened to ensure the consistency of Helm Release changes and avoid external interference.

[0083] The hybrid operation and maintenance matching unit 2 is used to execute step S2: based on the rendered and Release managed resource configuration lists in the cluster, and combined with the cluster real-time query resource configuration, hybrid operation and maintenance matching is performed to obtain a target resource configuration list that will be affected by the cluster to be filtered.

[0084] Specifically, resource configuration items that do not match the rendered resource configuration list Render are filtered out from the resource configuration list Cluster managed by Release in the cluster to form a dynamic list NameEffect, which is used to remove name and comparison interference. The specific expression is as follows:

[0085]

[0086] Wherein, Key(x)∈list is used to represent the resource configuration item corresponding to the unique identifier x in a resource configuration list list;

[0087] Next, the mixed operation and maintenance matching is performed on the rendering resource configuration list Render, which specifically includes the following steps:

[0088] Set the resource configuration item a in the rendered resource configuration list Render i The resource configuration list managed by Release in the cluster. The resource configuration item release in Cluster j To match:

[0089] If the match is successful, the resource configuration item in the resource configuration list Cluster managed by Release in the cluster is released j Include the target resource configuration list Target that will be affected by the cluster to be filtered;

[0090] If the match fails, the current resource configuration item a i Global resource configuration item for real-time query of cluster k Matching: If the match is successful, the resource configuration item Global of the cluster real-time query k Include the target resource configuration list Target that will be affected by the cluster to be filtered;

[0091] If the match fails, the current resource configuration item a i Perform similar matching with the dynamic list NameEffect: If the match is successful, the corresponding resource configuration item of NameEffect is included in the target resource configuration list Target that will be affected by the cluster to be filtered, and the corresponding resource configuration item of the dynamic list NameEffect is removed, and the next resource configuration item a is traversed. i+1 ;

[0092] If the match fails, continue to traverse the next resource configuration item a i+1 .

[0093] After the traversal of the rendered resource configuration list Render is completed, the dynamic list NameEffect is merged to the end of the target resource configuration list Target that will be affected by the cluster to be filtered.

[0094] Accordingly, the target resource configuration list Target that will be affected by the cluster to be filtered is specifically expressed as follows:

[0095] Target=

[0096]

[0097] In the formula, Key(a i )∈CDluster represents the current resource configuration item a iResource configuration item release of Cluster j Match, if match, release j Include Target;Key(a i )∈Global represents the current resource configuration item a i Resource configuration list of Clobal for real-time query of clusters Global resource configuration item k Match, if match, Global k Included in Target; similar(a i ,NameEffect) represents the current resource configuration item a i Similar matching operation with the resource configuration items of NameEffect. If a match is found, the resource configuration items of NameEffect are included in Target, and the resource configuration items of NameEffect are removed from NameEffect. i Similar resource configuration items.

[0098] In a multi-person collaborative environment, different teams or operation and maintenance personnel may operate the cluster in different ways, such as using kubectl, kuboard, lens and other k8s management tools to make configuration changes. Therefore, resource configuration items that are inconsistent with the current rendering resource configuration list (Render) may appear in the current cluster. Therefore, it is necessary to further filter out resource configuration items that are inconsistent with the current rendering resource configuration items from the cluster, that is, the resource configuration items (Global) of the cluster real-time query of the present invention. k ) and dynamic lists (NameEffect).

[0099] Among them, there are some dynamic hash value (HASH) expressions in the dynamic list because the operation and maintenance personnel add the name suffix of the configuration objects such as Configmap, so that the hash value is automatically added to the name suffix of the configuration object when the Chart is rendered. The suffix hash value is likely to interfere with the comparison process. Therefore, the present invention further adopts a similar matching method to match the dynamic list (NameEffect), and matches it in sequence and includes it in the target resource configuration list (Target) that will be affected by the cluster to be filtered, so as to prevent the resource configuration items from causing significant differences only due to inconsistent name suffixes, thereby avoiding interference with the judgment of the development team or the operation and maintenance team in the process of comparing and troubleshooting the difference items.

[0100] Based on the above analysis, when traversing and matching the rendering resource configuration list (Render), the present invention needs to follow the resource configuration list (Cluster) managed by Release in the cluster, the resource configuration items (Global) managed by real-time query in the cluster, and the resource configuration items (Global) managed by the cluster. k) and the order of the dynamic list (NameEffect) are matched item by item to ensure that the rendered resource configuration item a i Corresponding to the matching release j 、Global k The process of including the target resource configuration list (Tar get) that will be affected by the cluster to be filtered maintains sequential consistency, so that when the subsequently generated files are compared, the difference items can be displayed more accurately, allowing the development team or operation and maintenance team to quickly identify the resource items that really need attention and update, thereby significantly improving the efficiency of resource configuration item screening.

[0101] The field filtering unit 3 is used to execute step S3: perform field filtering on the target resource configuration list that will be affected by the cluster to be filtered and the rendered resource configuration list to obtain the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list.

[0102] Specifically, the specific steps of field filtering are as follows:

[0103] Get a preset field configuration file;

[0104] The field configuration file is provided with a hierarchical structure organization, and each level of the hierarchical structure organization is provided with non-essential field keywords that need to be deleted; the hierarchical structure organization is consistent with the hierarchical structure organization of the resource configuration list, and is used to accurately locate and remove corresponding non-essential fields in different levels in the resource configuration; for example:

[0105]

[0106] In the above preset configuration file example, when reading to the level _fields, its content, such as resourceVersion and creationTimestamp, is the keyword of the non-essential field that needs to be deleted.

[0107] Next, the target resource configuration list and the rendered resource configuration list that will be affected by the filtered cluster are deeply recursed, and the fields corresponding to one level of the resource configuration items in the resource configuration list are matched with the keywords of the non-essential fields in the preset field configuration file:

[0108] If the field corresponding to the level of the resource configuration item in the resource configuration list matches successfully, delete the field and all subfields;

[0109] If the field corresponding to the level of the resource configuration item in the resource configuration list is a list or array type, the matching field elements are deleted from the list or array.

[0110] After deep recursion is completed, a target resource configuration list that will be affected by the cluster and a currently refined resource configuration list are formed.

[0111] Since different types of resource configuration items in Kubernetes generally do not mix the same fields except for common fields, the present invention adopts field configuration files as preset rules. By setting a structure consistent with the hierarchy of resource configuration items and combining deep recursion, non-essential fields are effectively deleted and the accuracy of subsequent resource configuration comparison is ensured, thereby significantly improving the efficiency and accuracy of configuration management.

[0112] It should be noted that non-essential fields refer to fields that have no meaning in the comparison, such as metadata.annotations."kubectl.kubernetes.io / last-applied-configuration"; such fields are easy to confuse the development team or operation and maintenance team during the comparison; at the same time, the corresponding non-essential fields are different according to the actual situation. For example, the present invention is provided with:

[0113] At the annotations level: -deployment.kubernetes.io / revision, -meta.helm.sh / release-name;

[0114] Label level: k8slens-edit-resource-version, -k8s.kuboard.cn / name;

[0115] At the spec level: -claimRef, -persistentVolumeReclaimPolicy, -volumeMode.

[0116] Accordingly, according to actual needs, the field configuration file can flexibly define non-essential fields that need to be deleted, and the present invention does not limit its specific setting method.

[0117] The difference file generating unit 4 is used to execute step S4: generating files for the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list respectively, and obtaining the resource configuration file rendered after refinement and the target resource configuration list file that will be affected by the cluster after refinement.

[0118] Specifically, the file is generated by combining resource configuration items in sequence according to the YAML structure to generate an independent resource configuration file.

[0119] Accordingly, the rendered resource configuration file is compared with the target resource configuration list file that will be affected by the cluster, and the difference items of the rendered resource configuration file are displayed, so that the development team or operation and maintenance team can screen out the key difference items of the resource configuration that really need to be adjusted or updated, and perform configuration synchronization update.

[0120] Compared with the prior art, the present invention designs a hybrid operation and maintenance matching mechanism to optimize the order of resource configuration comparison to the greatest extent, thereby helping operators to more effectively identify and process the differences between the configuration rendered by Helm and the cluster configuration, thereby effectively improving the ability to identify potential impact configurations and ensuring the accuracy of configuration comparison. In addition, the present invention uses a preset field configuration file to perform deep recursive matching according to the hierarchical structure, delete non-essential fields, ensure the consistency and simplicity of the resource configuration list, reduce unnecessary interference in dynamic attribute or metadata comparison, and enable development and operation teams to focus on the management of core resource configuration, significantly improving the efficiency and accuracy of configuration comparison.

[0121] At the same time, the present invention combines similarity matching of dynamic lists to eliminate the interference of changes in the suffix hash value of the configuration name and ensures the order consistency during difference comparison, further improving the intuitiveness of the comparison results and reducing configuration problems caused by misjudgment or omissions.

[0122] Based on the same inventive concept, the present application also provides an electronic device, which may be a terminal device such as a server, a desktop computing device or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the application configuration update comparison method based on Helm in an embodiment of the present invention; and the memory is used to store a computer program executable by the processor.

[0123] Based on the same inventive concept, the present application also provides a computer-readable storage medium, corresponding to the aforementioned embodiment of the Helm-based application configuration update comparison method, wherein the computer-readable storage medium stores a computer program thereon, and when the program is executed by the processor, the steps of the Helm-based application configuration update comparison method recorded in any of the above embodiments are implemented.

[0124] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0125] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, and the present invention is also intended to include these modifications and modifications.

Claims

1. A Helm-based application configuration update comparison method, characterized in that: The following steps are involved: S1A, use Helm to render the application of the current multi-person collaborative environment and obtain the rendering resource configuration list; S1B. Extract all resource configuration lists managed by Helm from the cluster through label filtering, and filter all resource configuration lists managed by Helm according to annotations to obtain the resource configuration list managed by Release in the cluster; S2. Based on the resource configuration list of the rendering and Release management in the cluster, and combined with the resource configuration of the cluster real-time query, a mixed operation and maintenance matching is performed to obtain the target resource configuration list that will be affected by the cluster to be filtered; S3. Perform field filtering on the target resource configuration list that will be affected by the cluster to be filtered and the rendered resource configuration list to obtain the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list; S4. Generate files for the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list respectively, and obtain the resource configuration file rendered after refinement and the target resource configuration list file that will be affected by the cluster after refinement; and compare the differences between the rendered resource configuration file and the target resource configuration list file that will be affected by the cluster, and display the difference items of the rendered resource configuration file.

2. The Helm-based application configuration update comparison method according to claim 1, characterized in that: Before performing the hybrid operation and maintenance matching, the following steps are also included: Filter the resource configuration items in the resource configuration list Cluster managed by Release in the cluster that do not match the resource configuration list Render for rendering to form a dynamic list NameEffect, which is specifically expressed as follows: In the formula, Key(x)∈list is used to represent the resource configuration item corresponding to the unique identifier x in a resource configuration list list; Render is the resource configuration list of the rendering, which is specifically expressed as: Render={a i |i∈[1,n]} In the formula, a i represents the i-th rendered resource configuration item; n represents the total number of rendered resource configuration items; Cluster is the resource configuration list managed by Release in the cluster, which is specifically expressed as: Cluster={release j |j∈[1,m]} In the formula, release j Indicates the jth resource configuration item managed by Release in the cluster; m indicates the total number of resource configuration items managed by the current Release.

3. The Helm-based application configuration update comparison method according to claim 2, characterized in that: The specific representation of the hybrid operation and maintenance matching is as follows: In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Match with the resource configuration items of the Cluster, if they match, include them in the Target; Key (a i )∈Global represents the current resource configuration item a i Match the resource configuration items in the Global resource configuration list of the cluster real-time query, and include them in the Target if they match.

4. The Helm-based application configuration update comparison method according to claim 2, characterized in that: The specific representation of the hybrid operation and maintenance matching is as follows: In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Resource configuration item release of Cluster j Match, if match, release j Include Target;Key(a i )∈Global represents the current resource configuration item a i Resource configuration items of Global in real-time query of cluster resources k Match, if match, Global k Included in Target; similar(a i ,NameEffect) represents the current resource configuration item a i Similar matching operation with the resource configuration items of NameEffect. If a match is found, the resource configuration items of NameEffect are included in Target, and the resource configuration items of NameEffect are removed from NameEffect. i Similar resource configuration items.

5. The Helm-based application configuration update comparison method according to claim 3 or 4, characterized in that: The specific steps of field filtering are as follows: Obtain a preset field configuration file; wherein the field configuration file is provided with a hierarchical structure organization, and the hierarchical structure organization has a level with non-essential field keywords that need to be deleted; The target resource configuration list and the rendered resource configuration list that will be affected by the cluster to be filtered are deeply recursed, and the fields corresponding to the first level of the resource configuration items in the resource configuration list are matched with the keywords of the non-essential fields in the preset field configuration file: If the field corresponding to the level of the resource configuration item in the resource configuration list matches successfully, delete the field and all subfields; If the field corresponding to the level of the resource configuration item in the resource configuration list is a list or array type, delete the matching field element in the list or array; After deep recursion is completed, a target resource configuration list that will be affected by the cluster and a currently refined resource configuration list are formed.

6. A Helm-based application configuration update comparison device, characterized in that: It includes application configuration rendering unit, Release configuration acquisition unit, hybrid operation and maintenance matching unit, field filtering unit and difference file generation unit; The application configuration rendering unit is used to render the application of the current multi-person collaboration environment using Helm to obtain a rendering resource configuration list; The Release configuration acquisition unit is used to extract all resource configuration lists managed by Helm from the cluster through label filtering, and filter all resource configuration lists managed by Helm according to annotations to obtain the resource configuration list managed by Release in the cluster; The hybrid operation and maintenance matching unit is used to perform hybrid operation and maintenance matching based on the resource configuration list of the rendering and Release management in the cluster and in combination with the resource configuration of the cluster real-time query to obtain a target resource configuration list that will be affected by the cluster to be filtered; The field filtering unit is used to perform field filtering on the target resource configuration list that will be affected by the cluster to be filtered and the rendered resource configuration list, and obtain the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list; The difference file generation unit is used to generate files for the target resource configuration list that will be affected by the cluster and the currently refined resource configuration list respectively, to obtain the refined rendered resource configuration file and the refined target resource configuration list file that will be affected by the cluster; and to compare the differences between the rendered resource configuration file and the target resource configuration list file that will be affected by the cluster, to display the difference items of the rendered resource configuration file.

7. The Helm-based application configuration update comparison device according to claim 6, characterized in that: Before performing the hybrid operation and maintenance matching, the following steps are also included: Filter the resource configuration items in the resource configuration list Cluster managed by Release in the cluster that do not match the resource configuration list Render for rendering to form a dynamic list NameEffect, which is specifically expressed as follows: In the formula, Key(x)∈list is used to represent the resource configuration item corresponding to the unique identifier X in a resource configuration list list; Render is the resource configuration list of the rendering, which is specifically expressed as: Render={a i |i∈[1,n]} In the formula, a i represents the i-th rendered resource configuration item; n represents the total number of rendered resource configuration items; Cluster is the resource configuration list managed by Release in the cluster, which is specifically expressed as: Cluster={release j |j∈[1,m]} In the formula, release j Indicates the jth resource configuration item managed by Release in the cluster; m indicates the total number of resource configuration items managed by the current Release; The hybrid operation and maintenance matching is specifically represented as follows: In the formula, Key(a i )∈Cluster represents the current resource configuration item a i Resource configuration item release of Cluster j Match, if match, release j Include Target;Key(a i )∈Global represents the current resource configuration item a i Resource configuration items of Global in real-time query of cluster resources k Match, if match, Global k Included in Target; similar(a i ,NameEffect) represents the current resource configuration item a i Similar matching operation with the resource configuration items of NameEffect. If a match is found, the resource configuration items of NameEffect are included in Target, and the resource configuration items of NameEffect are removed from NameEffect. i Similar resource configuration items.

8. The Helm-based application configuration update comparison device according to claim 7, characterized in that: The specific steps of field filtering are as follows: Obtain a preset field configuration file; wherein the field configuration file is provided with a hierarchical structure organization, and the hierarchical structure organization has a level with non-essential field keywords that need to be deleted; The target resource configuration list and the rendered resource configuration list that will be affected by the cluster to be filtered are deeply recursed, and the fields corresponding to the first level of the resource configuration items in the resource configuration list are matched with the keywords of the non-essential fields in the preset field configuration file: If the field corresponding to the level of the resource configuration item in the resource configuration list matches successfully, delete the field and all subfields; If the field corresponding to the level of the resource configuration item in the resource configuration list is a list or array type, delete the matching field element in the list or array; After deep recursion is completed, a target resource configuration list that will be affected by the cluster and a currently refined resource configuration list are formed.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the Helm-based application configuration update comparison method as described in any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by the processor, a Helm-based application configuration update comparison method as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Page rendering method and device based on mixed mode, equipment and medium

    CN110727478A

  • K8s resource creation system based on voice guidance

    CN112099872A

  • Software configuration collection and difference comparison method and system applied to cloud desktop virtualization

    CN116610528A

  • Rapid code generation method and system for Helm Chart

    CN117215549A

  • Image rendering processing method and related equipment thereof

    CN117475052A