A method, system, device and medium for configuring parameters of application services
By uniformly extracting multiple initial configuration files of Kubernetes services to generate target configuration files, the problem of configuration complexity and error risk in containerized deployment is solved, the configuration management process is simplified, and the threshold for beginners is lowered.
Patent Information
- Application Number
- CN202411155284.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-22
AI Technical Summary
Due to the complex configuration of Kubernetes in service container deployment, it is difficult for beginners to get started, and the need to write multiple YAML files increases the complexity of configuration management and the risk of errors.
By uniformly extracting the configuration parameters from multiple initial configuration files of the application service to generate a target configuration file, users only need to enter the target configuration parameters, and the tool automatically updates and synchronizes the initial configuration files, simplifying the configuration management process and reducing the risk of errors.
It realizes centralized management and modification of configuration parameters, reduces the number of initial configuration files that need to be processed, reduces the risk of configuration errors, and greatly lowers the threshold for beginners to get started.
Smart Images

Figure CN118689529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of application design, and in particular to a parameter configuration method, system, device and medium for application services. Background Art
[0002] With the rapid development of container technology, more and more services choose to use container technology for deployment. Among them, Kubernetes, as a leader in the field of container orchestration, provides strong support for the automated deployment and management of services. Kubernetes is widely popular for its robustness and manageability of containers. Many users choose to use Kubernetes to containerize services. However, despite the powerful functions of Kubernetes, it also brings complex and diverse configuration items and resource types. Resource creation and configuration are usually performed through YAML (YAML Ain't Markup Language, another markup language) files, and each resource corresponds to a separate YAML file. In order to fully deploy a service, you may need to write multiple YAML files, which not only increases the number of files, but also makes it difficult for beginners to get started because of the complex format of YAML files. Summary of the invention
[0003] The purpose of the present invention is to provide a parameter configuration method, system, device and medium for application services, which can realize centralized management and modification of configuration parameters by uniformly extracting all configuration parameters from multiple initial configuration files of application services and generating a target configuration file. The user only needs to input the target configuration parameters, and the tool will automatically update the target configuration file and the initial configuration file synchronously, thus simplifying the complex configuration management process, reducing the number of initial configuration files that need to be processed, reducing the risk of configuration errors, and greatly lowering the entry threshold for beginners.
[0004] To solve the above technical problems, the present invention provides a parameter configuration method for an application service, comprising: determining configuration parameters in all initial configuration files according to multiple initial configuration files of the application service; generating a target configuration file according to all the configuration parameters, wherein the configuration parameters in the target configuration file have a one-to-one correspondence with the configuration parameters in each of the initial configuration files; obtaining the target configuration parameters input by a user, and updating the target configuration file according to the target configuration parameters; and updating the configuration parameters in multiple initial configuration files of the application service according to the configuration parameters in the updated target configuration file, so that the application service is started based on the updated initial configuration file.
[0005] In one embodiment, after a target configuration file is generated according to all the configuration parameters, it also includes: when the application service is started, determining whether the target configuration parameters input by the user are received; if the target configuration parameters input by the user are received, entering the step of updating the target configuration file according to the target configuration parameters; if the target configuration parameters input by the user are not received, setting the configuration parameters in the initial configuration file using the default values of each configuration parameter, so that the application service is started based on the initial configuration file set according to the default values.
[0006] In one embodiment, the initial configuration file includes at least deployment resources for running the application service, file resources, task resources for processing preprocessing operations required for the application service, container permission resources when the application service is running, and files corresponding to the port resources on which the application service runs; the configuration parameters include at least: the image version used by the application service, the port provided by the application service to the outside, the namespace of the application service, and the configurable startup parameters of the application service.
[0007] In one embodiment, it also includes: reading an application cluster file, and determining cluster authentication information based on the application cluster file; applying for connection with the application cluster based on the cluster authentication information; after connecting with the application cluster, calling the interface of the application cluster to obtain the number of nodes of the application cluster; setting a target number of nodes required for starting the application service through the interface of the application cluster, the target number being used to represent the number of nodes running the application service; and setting node labels corresponding to the start of the application service for the target number of nodes.
[0008] In one embodiment, after applying for connection with the application cluster according to the cluster authentication information, it also includes: determining whether the connection with the application cluster is successful; if the connection with the application cluster is successful, entering the step of calling the interface of the application cluster to obtain the number of nodes of the application cluster.
[0009] In one embodiment, after determining whether the application cluster is successfully connected, the method further includes: if the application cluster is not successfully connected, recording connection failure information and generating a connection failure notification.
[0010] In one embodiment, before obtaining the target configuration parameters input by the user and updating the target configuration file according to the target configuration parameters, it also includes: constructing a user interaction interface and generating a preset configuration interface, the user interaction interface at least including an input box, so that the user can input the target configuration parameters through the input box; obtaining the target configuration parameters input by the user, and updating the target configuration file according to the target configuration parameters, including: when receiving the target configuration parameters input through the user interaction interface, updating the target configuration file according to the target configuration parameters.
[0011] In one embodiment, after receiving the target configuration parameters input through the user interaction interface, it also includes: verifying the format and validity of the target configuration parameters; when the format of the target configuration parameters is correct and the target configuration parameters are valid, triggering the running of a preset script to transfer the target configuration parameters to the preset configuration interface; and updating the target configuration file according to the target configuration parameters of the preset configuration interface.
[0012] In one embodiment, after transmitting the target configuration parameters to the preset configuration interface, it also includes: verifying the integrity of the target configuration parameters transmitted by the preset configuration interface; after the integrity verification of the target configuration parameters is passed, entering the step of updating the target configuration file according to the target configuration parameters of the preset configuration interface.
[0013] In one embodiment, updating the target configuration file according to the target configuration parameter of the preset configuration interface includes: parsing the target configuration parameter to obtain a value of at least one configuration item;
[0014] The target configuration file is updated according to the value of the configuration item; the process of updating the target configuration file is recorded to obtain an update log; the update log at least includes the target configuration parameters input by the user and the input time, and the time of updating the target configuration file.
[0015] In one embodiment, after the application service is started based on the updated initial configuration file, it also includes: during the operation of the application service, determining whether modified configuration parameters input by the user through a preset configuration interface are received; upon receiving the modified configuration parameters, obtaining the initial configuration file corresponding to the modified configuration parameters; unsealing the initial configuration file, modifying the unsealed initial configuration file according to the modified configuration parameters, and encapsulating the modified initial configuration file; and restarting the application service according to the modified initial configuration file.
[0016] To solve the above technical problems, the present application provides a parameter configuration system for an application service, comprising: a first determination unit, used to determine the configuration parameters in all the initial configuration files according to multiple initial configuration files of the application service; a first generation unit, used to generate a target configuration file according to all the configuration parameters, and there is a one-to-one correspondence between the configuration parameters in the target configuration file and the configuration parameters in each of the initial configuration files; a first update unit, used to obtain the target configuration parameters input by the user, and update the target configuration file according to the target configuration parameters; a second update unit, used to update the configuration parameters in the multiple initial configuration files of the application service according to the configuration parameters in the updated target configuration file, so that the application service is started based on the updated initial configuration file.
[0017] To solve the above technical problems, the present application provides a parameter configuration device for an application service, comprising: a memory for storing a computer program; and a processor for implementing the steps of the parameter configuration method for the application service as described above when executing the computer program.
[0018] To solve the above technical problem, the present application provides a non-volatile storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the parameter configuration method of the application service as described above are implemented.
[0019] To solve the above technical problems, the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the parameter configuration method for the application service described in any of the above items.
[0020] The present application provides a parameter configuration method, system, device and medium for an application service, which relates to the field of application design. The method determines configuration parameters according to an initial configuration file of the application service, and generates a target configuration file; obtains target configuration parameters and updates the target configuration file; updates configuration parameters in multiple initial configuration files according to configuration parameters in the updated target configuration file, so that the application service starts based on the updated initial configuration file. By uniformly extracting all configuration parameters from multiple initial configuration files of the application service and generating a target configuration file, centralized management and modification of configuration parameters are achieved. The user only needs to enter the target configuration parameters, and the tool will automatically update the target configuration file and synchronously update the initial configuration file, which simplifies the complex configuration management process, reduces the number of initial configuration files that need to be processed, reduces the risk of configuration errors, and greatly reduces the threshold for beginners to get started. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in 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 paying creative work.
[0022] Figure 1 A flow chart of a method for configuring parameters of an application service provided by the present invention;
[0023] Figure 2 A schematic diagram of a parameter configuration system for an application service provided by the present invention;
[0024] Figure 3 A schematic diagram of a parameter configuration device for an application service provided by the present invention;
[0025] Figure 4 A schematic diagram of a non-volatile storage medium provided by the present invention. DETAILED DESCRIPTION
[0026] The core of the present invention is to provide a parameter configuration method, system, device and medium for application services. By uniformly extracting all configuration parameters from multiple initial configuration files of the application service and generating a target configuration file, centralized management and modification of configuration parameters are achieved. The user only needs to input the target configuration parameters, and the tool will automatically update the target configuration file and the initial configuration file synchronously, which simplifies the complex configuration management process, reduces the number of initial configuration files that need to be processed, reduces the risk of configuration errors, and greatly reduces the entry threshold for beginners.
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] To solve the above technical problems, Figure 1 As shown, the present invention provides a parameter configuration method for an application service, comprising: S11: determining configuration parameters in all initial configuration files according to multiple initial configuration files of the application service.
[0029] The principle of this step is to collect and analyze multiple initial configuration files of the application service to determine and extract all configuration parameters. In software development and operation and maintenance, application services often need to rely on multiple configuration files to set their behaviors and properties. These configuration files may include but are not limited to JSON (JavaScript Object Notation), YAML, INI (Initialization File) and other formats, distributed in different directories or systems. The key to this step is how the system accurately identifies and extracts parameter information in these configuration files, whether it is key settings such as database connection strings, service port numbers, or more subtle settings such as log levels, debug flags, etc. Among them, the application service can be the Neutron service in Kubernetes. Through this process, a comprehensive list of configuration parameters is built to accurately reflect the current configuration status of the application service. This centralized management and analysis method not only simplifies the search and modification of configurations, but also effectively reduces the risk of errors caused by scattered or missing configuration files, making configuration management more efficient and reliable.
[0030] S12: Generate a target configuration file according to all configuration parameters, and there is a one-to-one correspondence between the configuration parameters in the target configuration file and the configuration parameters in each initial configuration file.
[0031] The principle of this step involves generating a target configuration file based on multiple initial configuration files of the application service. For example, in a Kubernetes cluster, applications are usually defined by multiple configuration files, such as Deployment, Service, ConfigMap and other resource files, each of which contains specific configuration information such as container images, port mappings, environment variables, etc. This step automatically analyzes and integrates these configuration files through tools, and merges their configuration parameters into a unified target configuration file in a one-to-one correspondence. This process ensures that no matter which resource file the configuration information of the application service is stored in, the system can integrate and display them in an orderly manner. The target configuration file combines the configuration parameters in all resource files, reflects the complete configuration status of the application service in the Kubernetes cluster, including all required settings and their actual values and relationships. This centralized management method not only simplifies the search and comparison of configurations, but also ensures the consistency and integrity of all configurations, making it more efficient and reliable when processing and modifying application service configurations.
[0032] S13: Obtain target configuration parameters input by the user, and update the target configuration file according to the target configuration parameters.
[0033] The principle of this step involves the process of obtaining the target configuration parameters input by the user and updating the target configuration file accordingly. In Kubernetes (K8s), users may need to adjust the configuration parameters of application services according to specific needs or environmental changes, such as adjusting the resource limits of containers, updating environment variables, or modifying the access policy of services. The key to this step is how the system designs a user-friendly interactive interface, such as a command line tool or a graphical user interface, so that users can easily enter and specify these target configuration parameters. Users may provide these parameters by specifying command line parameters, configuration files, or interactive input boxes, such as specifying a new container image version, updating port numbers, or configuring new environment variables. After receiving user input, the target configuration file will be updated according to the target configuration parameters provided by the user. For example, users may specify new environment variable values or update the access port of the service through the command line. After these parameters are correctly entered and verified, these changes will be reflected in the target configuration file, ready for the next application service update or deployment. This approach makes configuration updates intuitive and controllable, helping users quickly adjust and optimize the configuration of application services to better adapt to different business needs or operating environments.
[0034] S14: updating the configuration parameters in the multiple initial configuration files of the application service according to the configuration parameters in the updated target configuration file, so that the application service is started based on the updated initial configuration file.
[0035] This step involves the process of updating multiple initial configuration files of application services in Kubernetes (K8s) according to the configuration parameters in the updated target configuration file. In a Kubernetes environment, an application service is usually defined by multiple resource objects, such as Deployment, Service, ConfigMap, etc., each of which has its corresponding configuration file. The key to this step is how the system automatically identifies and applies updates in the target configuration file to ensure that all related configuration files are correctly modified and synchronized.
[0036] First, the updated target configuration file is read, which contains new configuration parameters entered by the user or generated by the system, such as the updated container image version, modified environment variable settings, etc. Next, each initial configuration file of the application service, such as Deployment.yaml, Service.yaml, etc., is checked one by one, and the corresponding configuration items in each configuration file are located and updated according to the correspondence and update information in the target configuration file. For example, if a user updates the container image version of a Deployment, the image field in the Deployment.yaml file will be automatically modified to the new version number. Similarly, if the user adjusts the port mapping settings of the Service, the port configuration in Service.yaml will be updated accordingly.
[0037] This process not only includes simple text replacement, but may also involve complex data structure operations and file parsing to ensure the accuracy and completeness of the update operation. Once all initial configuration files have been updated, the system will be ready to apply these changes, usually through the Kubernetes kubectl command line tool or API (Application Programming Interface) interface to perform the update operation, so that the application service can start and run based on the updated initial configuration file. This automated configuration management and update mechanism greatly simplifies the configuration maintenance process of complex applications, reduces the possibility of human error, and improves the stability and operating efficiency of the system.
[0038] Based on the above embodiments: In one embodiment, after a target configuration file is generated according to all configuration parameters, it also includes: when the application service is started, determining whether the target configuration parameters input by the user are received; if the target configuration parameters input by the user are received, entering the step of updating the target configuration file according to the target configuration parameters; if the target configuration parameters input by the user are not received, setting the configuration parameters in the initial configuration file using the default values of each configuration parameter, so that the application service is started based on the initial configuration file set according to the default values.
[0039] In this embodiment, a target configuration file is first generated based on all configuration parameters. This process ensures that the system can centrally manage and integrate all configuration information required for application service startup. Subsequently, when the application service is started, the following judgment and processing flow is performed:
[0040] First, it checks whether it has received target configuration parameters entered by the user. These parameters may be provided through the command line, configuration files, or interactive interfaces to specify specific configuration requirements, such as updating container images, adjusting resource limits, or configuring environment variables. If it detects target configuration parameters entered by the user, it will proceed to the next step, which is to update the target configuration file based on these target configuration parameters.
[0041] When updating the target configuration file, the corresponding configuration items in the target configuration file will be replaced or modified according to the parameter values provided by the user. For example, if the user specifies a new container image version, the corresponding image field in the target configuration file will be updated. This ensures that the application service can be set up according to the user's expected configuration requirements when it is started, so as to meet specific business or environmental needs to the greatest extent possible.
[0042] However, if the target configuration parameters are not received from the user when the application service is started, it will use the preset default values to configure the parameters in the initial configuration file. These default values are usually pre-defined by the system or specified in the deployment file of the application service to ensure that the application can start and run normally in the absence of specific user input. By using default values, the basic functionality of the application service can be guaranteed, and a stable operating environment can still be provided when there is no explicit configuration requirement.
[0043] This processing method not only ensures the flexibility and adaptability of application services in different scenarios, but also simplifies user operations and reduces the complexity and error risk of configuration management. The processing strategy of user input and default configuration values is integrated, so that the system can efficiently respond to different configuration requirements and ensure the reliability and maintainability of application services.
[0044] In one embodiment, the initial configuration file includes at least deployment resources for running the application service, file resources, task resources for processing preprocessing operations required for the application service, container permission resources when the application service is running, and files corresponding to the port resources on which the application service runs; the configuration parameters include at least: the image version used by the application service, the port provided by the application service to the outside world, the namespace of the application service, and the configurable startup parameters of the application service.
[0045] In this embodiment, the initial configuration file contains multiple key resources and configuration parameters, such as in a Kubernetes (K8s) environment, which are the core settings and environment preparations required to run the application service. First, the deployment resource file defines how to configure and manage the deployment of the application service, including specifying the number of copies of the application, the required computing resources (CPU and memory), and the deployment strategy (such as rolling updates). File resources specify static files that the application service may need to access or process, such as configuration files, certificate files, or log files generated by the application. Task resources are used to define pre-processing operations before the application service is started or during operation, such as initializing the database, performing data migration, or loading configuration files. Container permission resources specify the operating permissions required by the application service at runtime to ensure that it performs necessary operations in a secure and controlled environment. Finally, the file corresponding to the port resource defines the port numbers exposed to the outside world by the application service in the Kubernetes cluster. These ports are used to accept external requests and service discovery.
[0046] In terms of configuration parameters, at least the image version used by the application service is included, which determines the specific image based on which the application service will be built and deployed. The port parameters provided by the application service determine the entry point that external users or other services can access and interact with. The namespace of the application service is used to isolate and manage the resources and permissions of the application service in the Kubernetes cluster to ensure that it can run and collaborate securely. Finally, the configurable startup parameters of the application service allow administrators or operation and maintenance teams to dynamically adjust the behavior and configuration of the application service as needed, such as adjusting memory limits, setting environment variables, specifying log levels, etc.
[0047] The combination of these initial configuration files and configuration parameters provides a complete infrastructure and settings for the deployment and operation of application services in Kubernetes. By accurately defining and managing these resources and parameters, it is possible to ensure that application services run stably in different deployment scenarios and provide flexible configuration options to meet diverse business needs and changes in the operating environment.
[0048] In one embodiment, it also includes: reading the application cluster file, and determining the cluster authentication information according to the application cluster file; applying for connection with the application cluster according to the cluster authentication information; after connecting with the application cluster, calling the interface of the application cluster to obtain the number of nodes of the application cluster; setting the target number of nodes required for application service startup through the interface of the application cluster, the target number is used to represent the number of nodes running the application service; setting the node label corresponding to the application service startup for the target number of nodes.
[0049] In this embodiment, the application cluster file is first read. This file contains information that configures and describes the entire Kubernetes cluster, such as the cluster's API address, authentication credentials, certificate information, etc. The system establishes a secure connection with the Kubernetes cluster based on this information, especially the cluster authentication information. This connection is authenticated using the API credentials to ensure that the system has the right to access and manage cluster resources.
[0050] Once the connection to the application cluster is successful, the Kubernetes cluster API interface will be called to obtain the number of nodes in the current cluster. This step is very important for the system because it ensures that the tool can understand the size of the cluster and available resources in real time. Next, the tool sets the target number of nodes required to start the application service based on specific policies or requirements. This target number reflects the number of nodes the system wants to run the application service in the cluster, and may be dynamically adjusted based on load, performance requirements, or other factors.
[0051] Finally, set the corresponding node labels for the target number of nodes, which will be used to run the application service. Node labels are key metadata used to identify and organize nodes in Kubernetes. Different labels can be set according to different needs, such as specifying specific hardware configurations, geographic locations, or application service types. By setting node labels correctly, you can ensure that the application service can be started and run on nodes that meet the expected conditions, thereby achieving the best performance and resource utilization.
[0052] This overall process not only provides secure management and access capabilities for Kubernetes clusters, but also achieves precise control and optimization of application service deployment and operating environment through flexible node management and label settings, making the deployment and management of application services in complex cluster environments more efficient and reliable.
[0053] In one embodiment, after applying for connection with the application cluster according to the cluster authentication information, it also includes: determining whether the application cluster is successfully connected; if the application cluster is successfully connected, entering the step of calling the application cluster interface to obtain the number of nodes of the application cluster; if the application cluster is not successfully connected, recording the connection failure information and generating a connection failure notification.
[0054] In this embodiment, first, based on the pre-configured cluster authentication information, an attempt is made to apply for a secure connection with the Kubernetes cluster. This process involves identity authentication using the cluster's API address, authentication credentials, possible certificate information, etc. to ensure that the system has sufficient permissions and legitimacy to access and manage cluster resources. Whether the connection is successful or not is crucial to subsequent operations.
[0055] Once the connection attempt is completed, a check is immediately made to determine whether the connection to the application cluster is successful. A successful connection means that the system has been authenticated and has obtained access to the cluster, and can safely perform subsequent operations. In this case, the next step is to call the API interface of the Kubernetes cluster to obtain the number of nodes in the current cluster. This information is critical to the operation and resource allocation of the system because it provides a real-time view of the cluster size and available resources, helping the system make effective decisions and adjustments.
[0056] However, if the attempt to connect to the application cluster fails, the details of the connection failure are immediately recorded and a corresponding connection failure notification is generated. Connection failures can be caused by a variety of reasons, such as incorrect authentication credentials, network problems, or abnormal cluster status. Recording and notifying these failure information is a key step in system management and maintenance. They help administrators and operation and maintenance teams respond and resolve problems quickly and ensure that the system can be restored to normal operation.
[0057] Overall, this process not only provides secure access and management capabilities for the Kubernetes cluster, but also ensures that the system can respond promptly and accurately to different situations through effective connection status monitoring and error handling mechanisms, thereby ensuring the stability and reliability of application services.
[0058] In one embodiment, before obtaining the target configuration parameters input by the user and updating the target configuration file according to the target configuration parameters, the method further includes: constructing a user interaction interface and generating a preset configuration interface, the user interaction interface at least including an input box so that the user can input the target configuration parameters through the input box; obtaining the target configuration parameters input by the user and updating the target configuration file according to the target configuration parameters, including: upon receiving the target configuration parameters input through the user interaction interface, verifying the format and validity of the target configuration parameters; when the format of the target configuration parameters is correct and the target configuration parameters are valid, triggering the running of a preset script to transmit the target configuration parameters to the preset configuration interface; verifying the integrity of the target configuration parameters transmitted by the preset configuration interface; after the integrity verification of the target configuration parameters is passed, parsing the target configuration parameters to obtain the value of at least one configuration item; updating the target configuration file according to the value of the configuration item; recording the process of updating the target configuration file to obtain an update log; the update log at least includes the target configuration parameters input by the user and the input time, and the time of updating the target configuration file.
[0059] In this embodiment, it is first necessary to build a user-friendly interactive interface, which usually includes elements such as an input box so that the user can easily enter the target configuration parameters. This interface design is intended to simplify user operations so that it can intuitively specify the configuration requirements of the application service, such as updating the container image version, adjusting resource restrictions, or configuring environment variables. After the user enters the target configuration parameters through the input box, the format and validity of these parameters are received and verified. The verification process ensures that the parameters provided by the user meet the expected data format and range, avoiding configuration errors or abnormal situations that may occur in subsequent operations. Once the target configuration parameters are verified, a preset script or program will be triggered to transfer these parameters to a preset configuration interface. The role of the preset script is to process and forward these parameters to ensure that they can be accurately applied to the target configuration file. Next, the integrity verification of the target configuration parameters transmitted by the preset configuration interface is performed. This step ensures the integrity and consistency of the parameters during transmission, preventing configuration errors caused by data loss or incompleteness.
[0060] Once the integrity verification of the target configuration parameters is passed, these parameters are parsed to extract at least one specific configuration item value. These configuration item values represent specific configuration requirements specified by the user, such as a new image version number or an updated environment variable setting. Finally, the target configuration file is updated according to the values of these configuration items. The update process may involve replacing, modifying, or adding corresponding fields in the configuration file to ensure that the latest configuration information can be correctly reflected in the deployment and operation of the application service.
[0061] At the same time, the process of updating the target configuration file is recorded and an update log is generated. The update log at least includes the target configuration parameters entered by the user and the time they were entered, as well as the time when the target configuration file was updated. These records not only help track and review the history of configuration changes, but also provide transparency and traceability of the configuration management process, providing system administrators and operation and maintenance teams with necessary operation logs and references.
[0062] This process design and implementation method effectively combines key steps such as user interaction, parameter validation, automated script execution, and logging, making it efficient, controllable, and secure to manage and update the configuration of application services in a Kubernetes environment.
[0063] In one embodiment, the process of updating the target configuration file and obtaining the update log includes: recording a timestamp for each update operation, indicating the specific time when the update occurred, and the event type (such as configuration update, configuration deletion, configuration addition, etc.); before the update, recording the status and content of the current target configuration file, which includes detailed information such as the path, version information, configuration items and their current values of the configuration file; recording the user or system entity that performed the update operation for subsequent tracing and accountability; describing in detail the changes that occurred during the update process, including the configuration items that were modified, added or deleted and their new values, which should be clear and detailed enough for subsequent understanding and review; After the update is completed, the latest status and content of the target configuration file shall be recorded, which ensures that the log records reflect the latest system status and configuration changes; the storage location or database table of the update log shall be specified for system management and log review; the corresponding log level (such as information, warning or error) shall be specified according to the impact and importance of the update for subsequent monitoring and analysis; if there are any exceptions or errors during the update process, the relevant debugging information and solutions shall be recorded in detail; the completion status of the update operation shall be recorded to confirm whether the update is successfully completed or whether further inspection and processing are required; if there is an approval process for configuration changes in the system, the corresponding approvers and approval results shall be recorded;
[0064] Through these specific steps and contents, the system can effectively record and manage the update process of the target configuration file and generate detailed and traceable update logs. These logs not only help to trace historical configuration changes, but also provide important references for subsequent troubleshooting, security audits, and operation and maintenance management.
[0065] In one embodiment, after the application service is started based on the updated initial configuration file, it also includes: during the operation of the application service, determining whether modified configuration parameters input by the user through a preset configuration interface are received; when the modified configuration parameters are received, obtaining the initial configuration file corresponding to the modified configuration parameters; unsealing the initial configuration file, modifying the unsealed initial configuration file according to the modified configuration parameters, and packaging the modified initial configuration file; and restarting the application service according to the modified initial configuration file.
[0066] In this embodiment, once the application service is started based on the updated initial configuration file, it will continuously monitor and check whether there are modified configuration parameters entered by the user through the preset configuration interface. These modifications may include adjusting the running configuration of the application service, such as updating environment variables, modifying resource limits, or changing container settings. Changes in these configuration parameters are monitored in real time, and after receiving the modified configuration parameters, the initial configuration files corresponding to the modified configuration parameters are obtained. These initial configuration files are the basic settings based on which the application service is started, including deployment configuration, environment variables, resource requirements, etc. By obtaining these files, it is possible to understand the specific modifications that the user wants to make to the application service.
[0067] Next, the obtained initial configuration file is unpacked (parsed, such as Base64 unpacking). The unpacking operation is intended to extract all configuration items and their current setting values from the file for subsequent modification and update operations. According to the received modified configuration parameters, the unpacked initial configuration file is modified accordingly. This may involve replacing, adding, or deleting configuration items to ensure that the latest configuration requirements are accurately reflected in the configuration of the application service. After completing the modification of the initial configuration file, the modified configuration file is encapsulated (encapsulated, such as Base64 encapsulation). This step reintegrates the modified configuration into a complete configuration file format so that these updated configurations can be correctly loaded and applied.
[0068] Finally, the application service is restarted based on the modified initial configuration file. The restart process ensures that the application service can apply the latest configuration changes without interrupting existing services, thereby ensuring that the system continues to meet user configuration requirements and changes during operation.
[0069] This process design and implementation method fully utilizes the flexible configuration management and automated operation features of the Kubernetes environment, enabling application services to dynamically adapt to changing configuration requirements during operation, thereby improving the flexibility, maintainability, and responsiveness of the system.
[0070] To solve the above technical problems, Figure 2As shown, the present application provides a parameter configuration system for an application service, including: a first determination unit 21, used to determine the configuration parameters in all initial configuration files based on multiple initial configuration files of the application service; a first generation unit 22, used to generate a target configuration file based on all the configuration parameters, and there is a one-to-one correspondence between the configuration parameters in the target configuration file and the configuration parameters in each initial configuration file; a first update unit 23, used to obtain the target configuration parameters input by the user, and update the target configuration file according to the target configuration parameters; a second update unit 24, used to update the configuration parameters in multiple initial configuration files of the application service according to the configuration parameters in the updated target configuration file, so that the application service is started based on the updated initial configuration file.
[0071] In one embodiment, it also includes: a first judgment unit, which is used to generate a target configuration file based on all configuration parameters, and then, when the application service is started, determine whether the target configuration parameters input by the user are received; if the target configuration parameters input by the user are received, feedback is given to the first update unit 23; if the target configuration parameters input by the user are not received, the configuration parameters in the initial configuration file are set using the default values of each configuration parameter, so that the application service is started based on the initial configuration file set according to the default values.
[0072] In one embodiment, the initial configuration file includes at least deployment resources for running the application service, file resources, task resources for processing preprocessing operations required for the application service, container permission resources when the application service is running, and files corresponding to the port resources on which the application service runs; the configuration parameters include at least: the image version used by the application service, the port provided by the application service to the outside world, the namespace of the application service, and the configurable startup parameters of the application service.
[0073] In one embodiment, it also includes: an authentication unit, which is used to read the application cluster file and determine the cluster authentication information according to the application cluster file; apply for connection with the application cluster according to the cluster authentication information; after connecting with the application cluster, call the interface of the application cluster to obtain the number of nodes of the application cluster; set the target number of nodes required for application service startup through the interface of the application cluster, the target number is used to represent the number of nodes running the application service; set the node label corresponding to the application service startup for the target number of nodes.
[0074] In one embodiment, it further includes: a second judgment unit, which is used to judge whether the application cluster is successfully connected after applying for connection with the application cluster according to the cluster authentication information; if the application cluster is successfully connected, entering the step of calling the interface of the application cluster to obtain the number of nodes of the application cluster.
[0075] In one embodiment, the system further includes: a connection failure feedback unit, which is used to determine whether the application cluster is successfully connected. If the application cluster is not successfully connected, the connection failure information is recorded and a connection failure notification is generated.
[0076] In one embodiment, it also includes: an interaction unit, which is used to obtain target configuration parameters input by a user, and before updating the target configuration file according to the target configuration parameters, construct a user interaction interface and generate a preset configuration interface, wherein the user interaction interface at least includes an input box so that the user can input the target configuration parameters through the input box; a first updating unit 23, which is specifically used to update the target configuration file according to the target configuration parameters when receiving the target configuration parameters input through the user interaction interface.
[0077] In one embodiment, it also includes: a first verification unit, which is used to verify the format and validity of the target configuration parameters after receiving the target configuration parameters input through the user interaction interface; when the format of the target configuration parameters is correct and the target configuration parameters are valid, trigger the running of a preset script to transfer the target configuration parameters to a preset configuration interface; and update the target configuration file according to the target configuration parameters of the preset configuration interface.
[0078] In one embodiment, it also includes: a second verification unit, which is used to verify the integrity of the target configuration parameters transmitted by the preset configuration interface after the target configuration parameters are transmitted to the preset configuration interface; after the integrity verification of the target configuration parameters is passed, enter the step of updating the target configuration file according to the target configuration parameters of the preset configuration interface.
[0079] In one embodiment, updating a target configuration file according to target configuration parameters of a preset configuration interface includes: parsing the target configuration parameters to obtain a value of at least one configuration item; updating the target configuration file according to the value of the configuration item; recording a process of updating the target configuration file to obtain an update log; the update log includes at least the target configuration parameters input by the user and the input time, and the time of updating the target configuration file.
[0080] In one embodiment, it also includes: a real-time parameter modification unit, which is used to determine whether modified configuration parameters input by the user through a preset configuration interface are received during the operation of the application service after the application service is started based on the updated initial configuration file; when the modified configuration parameters are received, the initial configuration file corresponding to the modified configuration parameters is obtained; the initial configuration file is unsealed, and the unsealed initial configuration file is modified according to the modified configuration parameters, and the modified initial configuration file is encapsulated; and the application service is restarted according to the modified initial configuration file.
[0081] For an introduction to the parameter configuration system for application services, please refer to the above embodiments, and this application will not go into details here.
[0082] To solve the above technical problems, Figure 3 As shown, the present application provides a parameter configuration device for an application service, including: a memory 31 for storing a computer program; a processor 32 for implementing the steps of the parameter configuration method for the application service as described above when executing the computer program.
[0083] For an introduction to the parameter configuration system for application services, please refer to the above embodiments, and this application will not go into details here.
[0084] To solve the above technical problems, Figure 4 As shown, the present application provides a non-volatile storage medium 41, on which a computer program 42 is stored. When the computer program 42 is executed by a processor, the steps of the parameter configuration method for the application service as described above are implemented.
[0085] For the introduction of the non-volatile storage medium 41 , please refer to the above-mentioned embodiment, and this application will not go into details here.
[0086] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0087] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A parameter configuration method for an application service, characterized in that: include: Determine configuration parameters in all the initial configuration files according to the multiple initial configuration files of the application service; Generate a target configuration file according to all the configuration parameters, wherein the configuration parameters in the target configuration file have a one-to-one correspondence with the configuration parameters in each of the initial configuration files; Acquire target configuration parameters input by a user, and update the target configuration file according to the target configuration parameters; The configuration parameters in the multiple initial configuration files of the application service are updated according to the updated configuration parameters in the target configuration file, so that the application service is started based on the updated initial configuration file.
2. The parameter configuration method of the application service according to claim 1, characterized in that: After generating a target configuration file according to all the configuration parameters, it also includes: When the application service is started, determining whether a target configuration parameter input by a user is received; If the target configuration parameters input by the user are received, then entering the step of updating the target configuration file according to the target configuration parameters; If the target configuration parameter input by the user is not received, the configuration parameters in the initial configuration file are set using the default values of the configuration parameters, so that the application service is started based on the initial configuration file set according to the default values.
3. The parameter configuration method for application services according to claim 1, characterized in that: The initial configuration file includes at least deployment resources for running the application service, file resources, task resources for processing preprocessing operations required for the application service, container authority resources when the application service is running, and files corresponding to port resources for the application service to run; The configuration parameters include at least: the image version used by the application service, the port provided by the application service to the outside, the namespace of the application service, and the configurable startup parameters of the application service.
4. The parameter configuration method for application services according to claim 1, characterized in that: Also includes: Reading an application cluster file, and determining cluster authentication information according to the application cluster file; Applying for connection with the application cluster according to the cluster authentication information; After connecting to the application cluster, calling the interface of the application cluster to obtain the number of nodes of the application cluster; Setting a target number of nodes required for starting the application service through an interface of the application cluster, wherein the target number is used to represent the number of nodes running the application service; The node labels corresponding to the application service startup are set for the target number of nodes.
5. The parameter configuration method for application service according to claim 4, characterized in that: After applying for connection with the application cluster according to the cluster authentication information, the method further includes: Determining whether the application cluster is successfully connected; If the application cluster is successfully connected, the step of calling the interface of the application cluster to obtain the number of nodes of the application cluster is entered.
6. The parameter configuration method for application service according to claim 5, characterized in that: After determining whether the application cluster is successfully connected, the method further includes: If the application cluster is not successfully connected, the connection failure information is recorded and a connection failure notification is generated.
7. The parameter configuration method for application services according to claim 1, characterized in that: Before obtaining the target configuration parameters input by the user and updating the target configuration file according to the target configuration parameters, the method further includes: Constructing a user interaction interface and generating a preset configuration interface, wherein the user interaction interface at least includes an input box, so that the user can input the target configuration parameters through the input box; Acquiring target configuration parameters input by a user, and updating the target configuration file according to the target configuration parameters, including: When the target configuration parameters input through the user interaction interface are received, the target configuration file is updated according to the target configuration parameters.
8. The method for configuring parameters of an application service according to claim 7, wherein: After receiving the target configuration parameter input through the user interaction interface, the method further includes: Verifying the format and validity of the target configuration parameters; When the format of the target configuration parameter is correct and the target configuration parameter is valid, triggering the running of a preset script to transmit the target configuration parameter to the preset configuration interface; The target configuration file is updated according to the target configuration parameters of the preset configuration interface.
9. The parameter configuration method of the application service according to claim 8, characterized in that: After transmitting the target configuration parameters to the preset configuration interface, the method further includes: Verifying the integrity of the target configuration parameters transmitted by the preset configuration interface; After the integrity verification of the target configuration parameters is passed, the step of updating the target configuration file according to the target configuration parameters of the preset configuration interface is entered.
10. The parameter configuration method of the application service according to claim 8, characterized in that: Updating the target configuration file according to the target configuration parameters of the preset configuration interface includes: Parsing the target configuration parameter to obtain a value of at least one configuration item; Update the target configuration file according to the value of the configuration item; The process of updating the target configuration file is recorded to obtain an update log; the update log at least includes the target configuration parameters input by the user and the input time, and the time when the target configuration file is updated.
11. The method for configuring parameters of an application service according to any one of claims 1 to 10, characterized in that: After the application service is started based on the updated initial configuration file, it also includes: During the operation of the application service, determining whether a modified configuration parameter input by a user through a preset configuration interface is received; Upon receiving the modified configuration parameters, obtaining an initial configuration file corresponding to the modified configuration parameters; Unpacking the initial configuration file, modifying the unpacked initial configuration file according to the modified configuration parameters, and packaging the modified initial configuration file; Restart the application service according to the modified initial configuration file.
12. A parameter configuration system for an application service, characterized in that: include: A first determining unit, configured to determine configuration parameters in all the initial configuration files according to the multiple initial configuration files of the application service; A first generating unit, configured to generate a target configuration file according to all the configuration parameters, wherein the configuration parameters in the target configuration file have a one-to-one correspondence with the configuration parameters in each of the initial configuration files; A first updating unit, configured to obtain a target configuration parameter input by a user, and update the target configuration file according to the target configuration parameter; The second updating unit is used to update the configuration parameters in the multiple initial configuration files of the application service according to the updated configuration parameters in the target configuration file, so that the application service is started based on the updated initial configuration file.
13. A parameter configuration device for an application service, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for configuring parameters of an application service as described in any one of claims 1 to 11 when executing a computer program.
14. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the parameter configuration method for the application service according to any one of claims 1 to 11 are implemented.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the parameter configuration method for the application service described in any one of claims 1-11 are implemented.
Citation Information
Patent Citations
Method for dynamically reconfiguring simulation environment
CN102222129A
Configuration file updating method and device, equipment and storage medium
CN114721681A
