Form conversion method and server
By converting YAML files into visual forms, users can configure parameters by filling out forms, which solves the problem of high error rate in YAML configuration and achieves a higher configuration success rate and system flexibility.
Patent Information
- Application Number
- PCT/CN2023/135515
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-21
- Filing Date
- 2023-11-30
- Publication Date
- 2024-12-26
AI Technical Summary
Existing technologies using YAML format resource configuration files have a higher probability of configuration errors, leading to an increased probability of resource deployment failure.
By converting YAML files into visual forms, users can configure parameters by filling out forms. By leveraging the correspondence between Kubernetes resource parameters and form component properties, form components with matching types and clear hierarchy are generated, reducing the probability of configuration errors.
It reduces the user's understanding of YAML syntax and format, improves the configuration success rate, enhances the system's flexibility and scalability, and reduces maintenance and upgrade costs.
Smart Images

Figure CN2023135515_26122024_PF_FP_ABST
Abstract
Description
Form conversion method and server
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on June 21, 2023, with application number 202310747036.5 and application name “Form Conversion Method and Server”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of servers, and in particular to a form conversion method and a server. Background Art
[0003] With the development of computing devices and cloud computing technologies, some container scheduling systems can automatically configure resources based on parameters contained in resource configuration files in YAML (YAML) format, and then schedule containers based on the configured resources.
[0004] Currently, resource configuration files are typically created using YAML editing software. However, this approach increases the probability of resource parameter configuration errors.
[0005] Summary of the Invention
[0006] The present invention provides a form conversion method and server that can reduce the probability of resource configuration errors. The technical solution is as follows.
[0007] In a first aspect, a form conversion method is provided, the method comprising: a terminal displaying an interface, the interface including an editing area and a first conversion button; the terminal obtaining a first configuration file based on an input operation triggered on the editing area; the terminal sending the first configuration file and a first conversion instruction to a server in response to the operation triggered on the first conversion button, the first conversion instruction instructing to convert the first configuration file into a first form; the server converting the first configuration file into a first form in response to the first conversion instruction; and the server sending the first form to the terminal.
[0008] By converting the configuration file into a form, users can configure parameter values by filling out the form. This eliminates the need for users to have a deep understanding of YAML syntax and format, thereby lowering the barrier to entry when using YAML editing software to create resource configuration files and reducing the probability of configuration failure.
[0009] The first configuration file is, for example, a configuration file. The first configuration file is, for example, a YAML file or a JavaScript object notation (JSON) file. The editing area is an interactive area for displaying and editing the configuration file, allowing the user to enter YAML syntax and modify and adjust it. The conversion button is used to trigger an instruction to convert the configuration file into a form. For example, the editing area is typically a text box or a text area provided to the user to write and modify YAML code. The first form is, for example, a form or a combination of multiple forms. A form is an interactive element for collecting user input. A form allows the user to submit data to a web page and send the data to the server for processing. A form typically contains elements such as input fields, selection boxes, and buttons in which the user can enter or select data. Forms are created using the Hypertext Markup Language (HTML). <form>The form is defined by the tag, which contains the form data to be submitted and information about how to process the data. Forms can use different Hypertext Transfer Protocol (HTTP) methods, such as GET or POST, to send data. The input fields in a form can be text boxes, password boxes, radio buttons, check boxes, drop-down lists, etc. Each input field can have an associated label that describes the purpose or instructions of the field. By using different tags and attributes, developers can customize the appearance and behavior of the form to meet specific needs. When the user fills out the form and clicks the Submit button, the form data will be sent to the server for processing. The server can use a variety of programming languages and technologies to receive and process this data. The first conversion button is used to trigger the instruction to convert the configuration file into a form.
[0010] In one possible implementation, the configuration file includes a first parameter of a Kubernetes resource, and converting the first configuration file into a first form includes: obtaining attributes of a first form component based on the first parameter, the first form component being used to configure the first parameter, and the attributes of the first form component matching the first parameter; and obtaining a first form based on the attributes of the first form component, the first form including the first form component.
[0011] Exemplarily, the attributes of the first form component include at least one of the level of the first form component in the first form, the type of the first form component, the options in the first form component, the value range of the first form component, or the hierarchical relationship between the first form component and the second form component in the first form.
[0012] Since the configuration file is converted into a form by utilizing the correspondence between the parameters of Kubernetes resources and the properties of form components, the parameters based on which the form is created do not need to be pre-set by the front-end. Instead, the parameters based on which the form is created are determined by the parameters received from the terminal and the correspondence. The correspondence can be updated and maintained as the container system is upgraded, thereby upgrading the form conversion function. This improves flexibility and scalability, and reduces the cost of upgrade and maintenance.
[0013] Exemplarily, the attribute of the first form component matches the first parameter, including: the level of the first form component in the first form matches the level of the first parameter in the configuration file.
[0014] In one possible implementation, the first form component has the same level in the first form as the first parameter in the configuration file. For example, for a parameter in a YAML file, the level of the parameter in the YAML file is determined as the level of the form component corresponding to the parameter in the form.
[0015] In another possible implementation, the first parameter's level in the configuration file is lower than the first form component's level in the first form. For a parameter in the YAML file, the level of the parameter in the YAML file is determined, and the difference between the level and the set number is used as the level of the form component corresponding to the parameter in the form.
[0016] Through the above method, the hierarchical relationship mapping function is realized, which can map the hierarchical relationship between parameters in the YAML file to the hierarchical relationship between parameters in the form, so that the converted form can visually reflect the hierarchical relationship between parameters in the interface, making the hierarchical relationship between parameters more intuitive and clear, reducing the probability of configuration failure caused by hierarchical errors due to the need to strictly control the hierarchical relationship according to a specific indentation number when configuring the YAML file, and improving the user experience.
[0017] In a possible implementation, the property of the first form component matches the first parameter, including: the type of the first form component matches the value type of the first parameter.
[0018] Exemplarily, the type of the first form component matches the value type of the first parameter, including at least one of the following:
[0019] The value type of the first parameter is integer, and the type of the first form component is a numeric input box or a sliding input bar; or
[0020] The value type of the first parameter is a string, and the type of the first form component is a text input box; or
[0021] The value type of the first parameter is Boolean, and the type of the first form component is switch; or
[0022] The value type of the first parameter is an option, and the type of the first form component is a drop-down box, a radio button, or a radio button; or
[0023] The value type of the first parameter is a time point, and the type of the first form component is a time selection box.
[0024] Through the above method, since the parameter value type of Kubernetes is taken into consideration when generating the form component, the type of the generated form component matches the parameter value type of Kubernetes. The type of the form component has a limiting effect on the parameters entered by the user, which is equivalent to forcibly limiting the parameter value type entered by the user to the type of the form component. For example, when the parameter value type is an option, the type of the form component is a drop-down box, then the user needs to select the parameter value from the options in the drop-down box. Therefore, compared with arbitrarily entering parameter values in the text input box, the parameter value range configured by the user is limited, thereby reducing the probability of configuration errors.
[0025] Exemplarily, the attribute of the first form component matches the first parameter, including: the options in the first form component include candidate values of the first parameter.
[0026] Through the above method, the function of mapping between the parameters of Kubernetes resources and the options included in the form component is realized. Based on the identifier of the Kubernetes resource, a form component including an option set can be generated, and the option set in the form component matches the identifier of the Kubernetes resource, thereby limiting the range of user-configured values within the option set and reducing the probability of non-optional value errors.
[0027] Exemplarily, the attribute of the first form component matches the first parameter, including: the value range of the first form component falls within the value range of the first parameter.
[0028] In this way, because the parameter value threshold range of Kubernetes resources is taken into account when generating the form component, the generated form component allows the configured threshold range to match the parameter value threshold range, thereby preventing the parameter value entered by the user from exceeding the threshold range and reducing the risk of over-limit errors.
[0029] Exemplarily, the attribute of the first form component matches the first parameter, including: the hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter.
[0030] Through the above method, the hierarchical relationship mapping function is realized, which can map the hierarchical relationship between parameters in the YAML file to the hierarchical relationship between parameters in the form, so that the converted form can visually reflect the hierarchical relationship between parameters in the interface, making the hierarchical relationship between parameters more intuitive and clear.
[0031] Exemplarily, the hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter, including at least one of the following:
[0032] In the case where the first parameter and the second parameter have the same level, the first form component and the second form component are in the same row or column; or, the color of the first form component is the same as the color of the second form component; or, the distance between the first form component and the interface border is the same as the distance between the second form component and the interface border; or, the size of the first form component is the same as the size of the second form component; or,
[0033] When the level of the first parameter is higher than the level of the second parameter, the first form component and the second form component are in different rows or columns; or, the color of the first form component is different from the color of the second form component; or, the distance between the first form component and the interface boundary is smaller than the distance between the second form component and the interface boundary; or, the size of the first form component is larger than the size of the second form component; or, the second form component is nested in the first form component; or, the first form component is in an expanded state and the second form component is in a visible state, and the first form component is in a collapsed state and the second form component is in a hidden state.
[0034] Through the above method, a variety of hierarchical relationship mapping implementation methods are provided, which helps to make the hierarchical relationship between parameters more intuitive and clear, and reduces the probability of configuration failure caused by hierarchical errors due to the need to strictly control the hierarchical relationship according to a specific indentation number when configuring the YAML file. Once the indentation number is wrong, it will lead to hierarchical errors, thereby improving user experience. Furthermore, since the hierarchical relationship between form components is generated by the server, and the user does not need to control the hierarchical relationship by entering the indentation amount in the YAML editing software, the probability of hierarchical errors caused by incorrect indentation input is reduced, thereby reducing the probability of configuration failure caused by hierarchical errors. In addition, since the hierarchical relationship between form components is generated based on the hierarchical relationship between parameters in Kubernetes, users can understand the relationship between parameters based on the hierarchical relationship between form components, such as which parameter is the sub-parameter of which parameter, so that users can fill in the form more conveniently, thereby improving ease of use.
[0035] In a possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining the hierarchy of the first parameter based on the identifier of the first parameter and a first corresponding relationship, the first corresponding relationship including the identifier of the first parameter and the hierarchy of the first parameter; obtaining the hierarchy of the first form component based on the hierarchy of the first parameter.
[0036] Since the above functions are achieved by utilizing the correspondence between parameter identifiers and the parameter hierarchies, when a new Kubernetes parameter needs to be added, the identifier of the newly added parameter and the parameter hierarchy are added to the correspondence, and a form component that matches the type of the newly added parameter can be generated. When the original parameter needs to be modified, the identifier of the parameter and the parameter hierarchy are modified in the correspondence, and the original correspondence can be modified. This reduces the cost of maintenance, updates, and upgrades, and improves flexibility and scalability.
[0037] In one possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining the level of the first parameter based on the number of indentations before the identifier of the first parameter in the configuration file or the number of target characters before the identifier of the first parameter, the target characters including at least one of a colon, a period, or curly brackets; and obtaining the level of the first form component based on the level of the first parameter.
[0038] Improve flexibility by mapping levels based on the number of indents or the number of characters.
[0039] In one possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining the type of the first form component based on the identifier of the first parameter and a second corresponding relationship, and the second corresponding relationship includes the identifier of the first parameter and the type of the first form component.
[0040] In one possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining the value type of the first parameter based on the identifier of the first parameter and a third correspondence, the third correspondence including the identifier of the first parameter and the value type of the first parameter; obtaining the type of the first form component based on the value type of the first parameter and a fourth correspondence, the fourth correspondence including the value type of the first parameter and the type of the first form component.
[0041] In one possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining a candidate value of the first parameter based on the identifier of the first parameter and a fifth correspondence, the fifth correspondence including the identifier of the first parameter and the candidate value of the first parameter; obtaining options in the first form component based on the candidate value of the first parameter, the options in the first form component including the candidate value of the first parameter.
[0042] Through the above implementation, since the candidate values of Kubernetes parameters are taken into account when generating the form component, the candidate values of the parameters are mapped to the options of the form component, so that the range of values that users can enter in the form component is limited to the set of allowed options, thereby reducing the probability of non-optional value errors.
[0043] In one possible implementation, the configuration file includes an identifier of the first parameter, and obtaining the properties of the first form component based on the first parameter includes: obtaining a threshold value of the first parameter based on the identifier of the first parameter and a sixth corresponding relationship, the sixth corresponding relationship including the identifier of the first parameter and the threshold value of the first parameter; obtaining a value range of the first form component based on the threshold value of the first parameter; or obtaining the threshold value of the first parameter from the first configuration file, and obtaining the value range of the first form component based on the threshold value of the first parameter.
[0044] In the above manner, since a matching form component is generated based on the threshold range of the parameter value, the parameter value input by the user is prevented from exceeding the threshold range, thereby reducing the risk of over-limit errors.
[0045] In one possible implementation, the configuration file includes a first parameter of a Kubernetes resource, and converting the first configuration file into a first form includes: obtaining attributes of a second form component based on the first parameter and a seventh correspondence, the seventh correspondence includes the first parameter and a second parameter of the Kubernetes resource, the second form component is used to configure the second parameter, and the attributes of the second form component match the second parameter; obtaining a first form based on the attributes of the first form component and the attributes of the second form component, the first form including the first form component and the second form component.
[0046] In one possible implementation, the configuration file includes the value of the first parameter, and obtaining the attributes of the second form component based on the first parameter and the seventh correspondence includes: obtaining the value type of the second parameter of the Kubernetes resource based on the value of the first parameter and the seventh correspondence, the seventh correspondence including the value of the first parameter and the value type of the second parameter; obtaining the type of the second form component based on the value type of the second parameter and the eighth correspondence, the eighth correspondence including the value type of the second parameter and the type of the second form component.
[0047] Through the above implementation method, the linkage relationship between the parameters in the configuration file can be mapped to the linkage relationship between the form components in the form, so that after the value of parameter A is configured, the type of the form component corresponding to parameter B can change with the value of parameter A. Therefore, the configuration range of the value of parameter B can be narrowed based on the form component, which is equivalent to forcing the user to choose the correct way to input based on a specific type of form component, reducing the probability of parameter B configuration error, so it is easier to use.
[0048] In one possible implementation, when determining the hierarchical display of form components, the dependencies between parameters are taken into account. For example, a first parameter is displayed or hidden based on the value of a second parameter. For example, if a first form component is selected or a specific value is entered into the first form component, the second parameter is displayed; otherwise, the second parameter is hidden. This allows the visibility of the form to be dynamically adjusted based on the user's selection and input. Alternatively, the second parameter may be enabled or disabled based on the selection of the first parameter. For example, if a first form component is selected, the second form component is enabled, allowing the user to edit it; otherwise, the second form component is disabled, preventing the user from editing it. This allows the editability of the form to be dynamically adjusted based on the user's selection.
[0049] In one possible implementation, the configuration file includes the value of the first parameter, and obtaining the attributes of the second form component based on the first parameter and the seventh correspondence includes: obtaining candidate values of the second parameter of the Kubernetes resource based on the value of the first parameter and the seventh correspondence, the seventh correspondence including the value of the first parameter and the candidate value of the second parameter; obtaining options in the second form component based on the candidate value of the second parameter, the options in the second form component including the candidate value of the second parameter.
[0050] Through the above implementation, since the parameter value type of Kubernetes is taken into consideration when generating the form component, the type of the generated form component matches the parameter value type of Kubernetes. The type of the form component has a limiting effect on the parameters entered by the user, which is equivalent to forcibly limiting the parameter value type entered by the user to the type of the form component. For example, when the parameter value type is an option, the type of the form component is a drop-down box, then the user needs to select the parameter value from the options in the drop-down box. Therefore, compared with arbitrarily entering parameter values in the text input box, the range of parameter values configured by the user is limited, thereby reducing the probability of configuration errors.
[0051] In one possible implementation, the configuration file includes the value of the first parameter, and obtaining the attributes of the second form component based on the first parameter and the seventh correspondence includes: obtaining the value range of the second parameter of the Kubernetes resource based on the value of the first parameter and the seventh correspondence, the seventh correspondence including the value of the first parameter and the value range of the second parameter; obtaining the value range of the second form component based on the value range of the second parameter, the value range of the second form component falling within the value range of the second parameter.
[0052] In one possible implementation, the configuration file includes an identifier of the first parameter, and the method further includes: querying a parameter identifier library based on the identifier of the first parameter, the parameter identifier library being used to store the correctly spelled identifier of at least one parameter of the Kubernetes resource; in response to querying the parameter identifier library for a target parameter identifier that meets a fuzzy matching condition with the identifier of the first parameter, recommending the target parameter identifier.
[0053] Through parameter identifier recommendation, the parameter identifiers to be entered can be automatically and intelligently recommended to users during the process of editing YAML files, thereby further reducing the complexity of operations. In addition, the recommendation can be made in real time when the user performs the input operation, so the timeliness is better.
[0054] In one possible implementation, the configuration file includes an identifier of the first parameter, and the method further includes: querying a parameter identifier library based on the identifier of the first parameter, the parameter identifier library being used to store a correctly spelled identifier of at least one parameter of the Kubernetes resource; in response to each parameter identifier in the parameter identifier library not matching the identifier of the first parameter, outputting a prompt message indicating that there is an error in the spelling of the identifier of the first parameter.
[0055] Since misspellings are checked and prompted, users can understand and resolve misspellings in a timely manner, thereby reducing the probability of parameter configuration errors.
[0056] In one possible implementation, after the server sends the first form to the terminal, the method further includes: the terminal displaying the first form and a second conversion button; the terminal, in response to a modification operation on the first form, obtaining a second form modified based on the first form; the terminal, in response to an operation triggering the second conversion button, sending the second form and a second conversion instruction to the server, the second conversion instruction instructing to convert the second form into a second configuration file; the server, in response to the second conversion instruction, converting the second form into a second configuration file; and the server sending the second configuration file to the terminal.
[0057] The second configuration file is, for example, a YAML file or a JSON file.
[0058] The second convert button is used to trigger the instruction to convert the form into a configuration file.
[0059] Given the plethora of Kubernetes resource types and configuration parameters, and the limited page length of a form, the probability of including input boxes for every single parameter in Kubernetes is low. This can result in insufficient coverage when configuring parameters through the form, leading to incomplete parameter configuration. However, with the aforementioned implementation, when a user creates a Kubernetes resource configuration file using a form and discovers that the form lacks an input box for a desired parameter, they can instruct the system to convert the form into a YAML file and enter the desired parameters in the YAML file, thereby improving the comprehensiveness of parameter configuration.
[0060] In a second aspect, a form conversion method is provided, the method comprising:
[0061] The server receives a first configuration file and a first conversion instruction from a terminal, wherein the first conversion instruction instructs to convert the first configuration file into a first form;
[0062] The server converts the first configuration file into a first form in response to the first conversion instruction;
[0063] The server sends the first form to the terminal.
[0064] By converting the configuration file into a form, users can configure parameter values by filling out the form. This eliminates the need for users to have a deep understanding of YAML syntax and format, thereby lowering the barrier to entry when using YAML editing software to create resource configuration files and reducing the probability of configuration failure.
[0065] In a third aspect, a server is provided, comprising at least one processor and at least one memory, wherein the at least one memory stores computer program instructions; the at least one processor executes the computer program instructions so that the server executes the method described in the second aspect above.
[0066] In a fourth aspect, a computing device cluster is provided, which includes multiple computing devices, each computing device including a processor and a memory; the processors of the multiple computing devices are used to execute instructions stored in the memories of the multiple computing devices, so that the computing device cluster executes the method described in the second aspect.
[0067] In a fifth aspect, a form conversion device is provided, the system comprising:
[0068] A receiving module is configured to receive a first configuration file and a first conversion instruction from a terminal, wherein the first conversion instruction instructs to convert the first configuration file into a first form; a converting module is configured to convert the first configuration file into the first form in response to the first conversion instruction; and a sending module is configured to send the first form to the terminal.
[0069] The conversion module, receiving module, and sending module can all be implemented in software or hardware. For example, the implementation of the conversion module will be described below using the conversion module as an example. Similarly, the implementation of the receiving module and sending module can refer to the implementation of the conversion module.
[0070] As an example of a software functional unit, a conversion module may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the conversion module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0071] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0072] As an example of a hardware functional unit, a conversion module may include at least one computing device, such as a server. Alternatively, the conversion module may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0073] The multiple computing devices included in the conversion module can be distributed in the same region or in different regions. The multiple computing devices included in the conversion module can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the conversion module can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0074] In a sixth aspect, a computer-readable storage medium is provided, which stores at least one instruction. When the instruction is executed on a computer, the computer executes the method provided by the second aspect or any optional method of the second aspect.
[0075] In the seventh aspect, a computer program product is provided, which includes one or more computer program instructions. When the computer program instructions are loaded and run by a computer, the computer executes the method provided by the second aspect or any optional method of the second aspect.
[0076] In an eighth aspect, a chip is provided, comprising a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the method in the above-mentioned second aspect and any possible implementation of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] FIG1 is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0078] FIG2 is a flow chart of a form conversion method provided in an embodiment of the present application;
[0079] FIG3 is a schematic diagram of an interface for converting a YAML file to a form provided in an embodiment of the present application;
[0080] FIG4 is a schematic diagram of an interface of a YAML editing software provided in an embodiment of the present application;
[0081] FIG5 is a schematic diagram of a form interface provided in an embodiment of the present application;
[0082] FIG6 is a flow chart of a form conversion method provided in an embodiment of the present application;
[0083] FIG7 is a flow chart of a form conversion method provided in an embodiment of the present application;
[0084] FIG8 is a flow chart of a form conversion method provided in an embodiment of the present application;
[0085] FIG9 is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0086] FIG10 is a flowchart of a form conversion method provided in an embodiment of the present application;
[0087] FIG11 is a schematic diagram of a system architecture provided in an embodiment of the present application;
[0088] FIG12 is a flowchart of a form conversion method provided in an embodiment of the present application;
[0089] FIG13 is a schematic structural diagram of a form conversion device provided in an embodiment of the present application;
[0090] FIG14 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0091] FIG15 is a schematic diagram of the architecture of a computing device cluster provided in an embodiment of the present application;
[0092] FIG16 is a schematic diagram of the architecture of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0093] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0094] The following is an explanation of some terminology concepts involved in some embodiments of the present application.
[0095] (1) Kubernetes
[0096] Kubernetes, also known as K8s or kube, is an open source container scheduling platform used to automatically deploy, scale, and manage containerized applications.
[0097] (2) Kubernetes resources
[0098] Kubernetes resources refer to the resources used in Kubernetes to deploy, run, or manage applications. Kubernetes resources are also called Kubernetes objects. Kubernetes resources include applications (stateless or stateful), pods (container groups), config maps, secrets, services, deployments, replica sets, namespaces, volumes, stateful sets, daemon sets, jobs, or cron jobs. A pod is the smallest computing unit in Kubernetes, representing one or more related containers and the storage and network resources they share. A config map is a collection of key-value pairs. Config maps are used to store non-sensitive configuration data, such as application environment variables, command-line parameters, configuration files, and other data. Secrets are used to store and manage sensitive configuration data. A service provides a single stable network entry for a group of pods. A deployment is used to manage pod replica sets to achieve horizontal scaling, rollback, and updates of applications. A replica set is used to keep a specified number of replicas running and automatically create new replicas when the number of replicas is insufficient. A namespace is used to divide a Kubernetes cluster into multiple virtual clusters to isolate a group of resources, which can be managed and authorized separately. A volume is a persistent storage resource provided to a container or pod. A stateful set is used to enable one or more stateful pods to run in a fixed order and have a unique identifier and network name. A daemon set runs one or more pods on each node to perform specific system tasks, such as log collection, monitoring, and data collection. Jobs and cron jobs are used to perform one-time or scheduled tasks, such as data backup or regular removal of expired data. In addition to the resource types listed above, Kubernetes resources can also be application programming interfaces (APIs).For example, Kubernetes resources include horizontal pod autoscaler, vertical pod autoscaler, pod disruption budget, network policy, etc., which are used to implement more advanced features such as autoscaling, network security, and load balancing.
[0099] (3) Data serialization language (YAML ain't markup language, YAML)
[0100] YAML is a human-readable data serialization language commonly used to write configuration files. In this example, files in the YAML format are referred to as YAML files. In Kubernetes, YAML files can be used to define the configuration of running resources.
[0101] (4) Form
[0102] In Hypertext Markup Language (HTML), the form tag is usually called a form. It can submit the data in the form to a specified server address using a specified request method, such as a get request or a post request.
[0103] (5) TypeScript (TS) files
[0104] A TS file refers to TypeScript code stored in a file with a .ts extension. TS files can contain declarations for variables, functions, classes, interfaces, and other features, and can organize code into modules. When writing TypeScript code, you can use an editor or command-line tool to compile the .ts file into a JavaScript file, which can then be run in a browser or Node.js environment. TypeScript is an object-oriented programming language and a superset of JavaScript. It extends JavaScript with many new features, such as static typing, interfaces, namespaces, and classes, making writing JavaScript applications more convenient and easier to maintain.
[0105] The following is an example of an application scenario of the embodiment of the present application.
[0106] In one implementation, when using a container scheduling system like Kubernetes, users create resource configuration files (hereinafter referred to as YAML files) by entering resource parameters in YAML format into a YAML editing software. The YAML file specifies resource parameters. The container scheduling system configures resources based on the resource parameters in the YAML file and schedules containers based on the resources.
[0107] However, the YAML format is more complex than other formats and has strict requirements on syntax and format. For example, data must be indented a specified number of spaces, a colon (':') must be used to separate key names and values, and a line break must be added after each data item. If the syntax and format of the YAML file do not meet these requirements, the container scheduling system may parse the YAML file incorrectly, resulting in a high barrier to entry for creating resource configuration files, making resource deployment more difficult and increasing the probability of configuration failure.
[0108] Based on this, in a possible implementation of the present application, due to the correspondence between the parameters of the resources based on which the container scheduling system schedules the container and the attributes of the form component, such as the parameters of Kubernetes resources and the attributes of the form component, the YAML file is converted into a visual form, thereby supporting users to configure the values of the parameters by filling in the form. Therefore, it is not necessary to require users to have an in-depth understanding of the syntax and format of YAML, which reduces the usage threshold when using YAML editing software to create resource configuration files, reduces the probability of configuration failure, and reduces the difficulty of resource deployment.
[0109] Furthermore, since the parameters for creating a form based on the container scheduling system do not need to be pre-set by the front-end, for example, the parameters for creating the form do not need to be set in the code such as the TS file executed by the front-end server, but it supports determining the parameters for creating the form based on the parameters and the corresponding relationship, if the container scheduling system is upgraded and evolved, and new resources or new parameters are added to the container scheduling system, it is not necessary to update the style of the form by modifying the code in the TS file executed by the front-end server. Instead, the corresponding relationship can be updated based on the newly added parameters, and the function of the form conversion can be upgraded along with the upgrade of the container system, thereby improving flexibility and scalability and reducing the cost of upgrade and maintenance.
[0110] This embodiment focuses on the method for converting between YAML files and forms. The method provided in this embodiment can also be applied to converting between configuration files in formats other than YAML and forms. For example, the method provided in this embodiment can also be used to convert between JSON files and forms.
[0111] If necessary, the embodiment of the present application may optionally support the function of mapping between parameter value types and form component types. The implementation method of this optional function will be described after the title "Function 1".
[0112] If necessary, the embodiment of the present application may choose to support the mapping function between the options of parameter values and the options of the form component. The implementation method of this optional function will be described after the title "Function 2".
[0113] If necessary, the embodiment of the present application may optionally support the function of mapping the threshold range of parameter values with the threshold range allowed to be configured by the form component. The implementation method of the optional function will be described after the title "Function Three".
[0114] If necessary, the embodiment of the present application may optionally support the function of hierarchical relationship mapping, and the implementation method of the optional function will be described after the title "Function Four".
[0115] If necessary, the embodiment of the present application may optionally support the function of linkage relationship mapping, and the implementation method of the optional function will be described after the title "Function Five".
[0116] If necessary, the embodiment of the present application may optionally support the function of recommended parameter identification, and the implementation method of this optional function will be described after the title "Function Six".
[0117] If necessary, the embodiment of the present application may optionally support the function of parameter error identification. The implementation method of this optional function will be described after the title "Function Seven".
[0118] The following example illustrates the hardware system architecture associated with the application scenario.
[0119] FIG1 is a schematic diagram of the architecture of a computing system 100 provided in an embodiment of the present application. The computing system 100 includes a terminal 120 and a server system 140. The terminal 120 and the server system 140 are connected via a communication network 160.
[0120] A terminal refers to a device that supports human-computer interaction, has the ability to access a network, and is typically equipped with an operating system. Terminals 120 include, but are not limited to, mobile phones, tablet computers, laptops, desktop computers, automobiles, vehicle-mounted terminals, wearable devices, and handheld game consoles. Terminal 120 may also be referred to as user equipment (UE), smart terminals, mobile terminal user equipment, or terminal equipment. Terminal 120 runs an application for editing YAML files and forms. Terminal 120 interacts with server system 140 through the application, thereby accessing the service provided by server system 140 for converting YAML files into forms.
[0121] The server system 140 is used to run a service that converts YAML files into forms. The server system 140 allows terminals to access the service via the network. The server system 140 can be a standalone server, a cluster or distributed system containing multiple servers, or a cloud computing platform or virtualization center. The servers included in the server system 140 can be physical servers, virtual machines, containers, or virtualized devices based on network function virtualization (NFV). The servers included in the server system 140 can be physical servers, virtual machines, containers, or other virtualized devices.
[0122] Communication network 160 is used to support data communication between terminal 120 and server system 140. Communication network 160 generally supports standard communication technologies and / or protocols. Communication network 160 is typically the Internet, but can also be any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network, or a virtual private network. Communication network 160 includes one or more network devices, such as switches, routers, etc.
[0123] Terminal 120 can edit YAML files by running YAML editing software 1201. Terminal 120 can also edit forms by running form editing software 1202. YAML editing software, also known as a YAML editor, allows users to enter parameters for resources to be configured. For example, the YAML editing software renders an editing interface to the screen of terminal 120 to present a view for editing YAML.
[0124] The YAML editing software 1201 and the form editing software 1202 can be, for example, a World Wide Web (Web) application, an application client, an application programming interface (API) integrated in a third-party application, a plug-in integrated in a third-party application, or at least one implementation in a software development kit (SDK) integrated in a third-party application. A Web application is an application accessed through a Web browser. An application client can be an independent software client or a mini-program. A mini-program is a child application that depends on a parent application to run.
[0125] In the process of executing the method of converting a YAML file into a form, optionally, the server system 140 undertakes the main data processing task, and the terminal 120 undertakes the secondary data processing task; or, the server system 140 undertakes the secondary data processing task, and the terminal 120 undertakes the main data processing task; or, the terminal 120 and the server system 140 collaborate to undertake the data processing task.
[0126] The server system 140 may include multiple servers. For example, the server system 140 includes a front-end server 140 - a and a back-end server 140 - b.
[0127] The front-end server is a server located near the terminal 120. It manages the front-end resources of the computing system 100, such as HTML pages, JavaScript source code, and Cascading Style Sheets (CSS). It provides users with a website's front-end interface and interactive features. The back-end server 140-b handles business logic and database operations. The back-end server receives data requests from the front-end server, processes these requests, and returns the corresponding results to the front-end server.
[0128] The front-end server and the back-end server can be located on different physical servers, and the front-end server 140-a and the back-end server 140-b communicate with each other via a network and the Hypertext Transfer Protocol (HTTP). The front-end server and the back-end server can also be integrated on the same physical server.
[0129] Optionally, computing system 100 also includes a storage system 180. Storage system 180 is used to store data required by server system 140 to convert a YAML file into a form, such as resource parameters and form component attributes based on which the container scheduling system schedules containers, the correspondence between parameter identifiers and parameter value types, the correspondence between parameter value types and form component types, the correspondence between parameter identifiers and parameter value threshold ranges, the correspondence between parameter hierarchies and form component hierarchies, the correspondence between parameter identifiers and parameter hierarchies, and the correspondence between the identifier of a first parameter and the identifier of a second parameter. Storage system 180 includes one or more storage devices. Storage system 180 can be located external to server system 140 and exchange data with server system 140 via a communication network or bus. For example, storage system 180 is an external hard disk array, a storage server, a cloud storage system, etc. Alternatively, storage system 180 can be located internal to server system 140 and exchange data with server system 140 via a bus.
[0130] Optionally, computing system 100 further includes a terminal 170, which is used to configure data required by server system 140 when executing the method for converting a YAML file into a form, such as the parameters of the resources based on which the container scheduling system schedules containers and the attributes of the form component, the correspondence between parameter identifiers and parameter value types, the correspondence between parameter value types and form component types, the correspondence between parameter identifiers and parameter value threshold ranges, the correspondence between parameter hierarchies and form component hierarchies, the correspondence between parameter identifiers and parameter hierarchies, and the correspondence between the identifier of a first parameter and the identifier of a second parameter. Administrator 107 can perform configuration via terminal 170 using a command line, a configuration interface, or by editing a configuration file.
[0131] Optionally, the computing system 100 also includes a container scheduling system 190, which is used to perform container scheduling functions. The server system 140 can interact with the container scheduling system 190 via a network. For example, the server system 140 can send a YAML file to the container scheduling system 190, and the container scheduling system 190 schedules the container based on the received YAML file. The embodiment of the present application uses Kubernetes as an example of a container deployment system. Kubernetes can also be replaced by Docker Swarm, Mesos, or other types of container scheduling systems that support resource deployment based on YAML files.
[0132] The following is an example of the method flow of the embodiment of the present application.
[0133] FIG2 is a flow chart of a form conversion method provided in an embodiment of the present application.
[0134] In one possible implementation, method 200 is executed by a terminal. For example, the terminal executes method 200 by running browser software or service client software. For example, in conjunction with the application scenario shown in FIG1 , method 200 can be executed by terminal 120 while running YAML editing software 1201 (YAML editing software 1201 is a specific example of browser software or service client software).
[0135] In another possible implementation, the execution entity of method 200 is a single server or a system composed of multiple servers.
[0136] In another possible implementation, method 200 shown in FIG2 is performed interactively by a terminal and a server. The following description focuses on the interaction between the terminal and the server system as an example to illustrate the method flow. Steps described below as being performed by the server can also be replaced by being performed by the terminal, or by the terminal and the server system working together. Steps performed by the terminal can also be replaced by being performed by the server system, or by the terminal and the server system working together.
[0137] S210: The terminal obtains the YAML file.
[0138] S220: The terminal sends the YAML file to the server system.
[0139] In one possible execution scenario for sending a YAML file, referring to FIG3 , while the terminal is running YAML editing software 1201, the YAML editing software interface 300 is displayed. Interface 300 includes a text input box 308 and a button 305. Text input box 308 is used to enter the contents of the YAML file. Button 305 is used to trigger an instruction to convert the YAML file into a form. When the YAML file needs to be converted into a form, the user can click button 305 to trigger a first conversion instruction, which is used to instruct the YAML file to be converted into a form. In response to the first conversion instruction, the terminal obtains the value of text input box 308, obtains the YAML file, and sends the YAML file to the server system.
[0140] In one possible implementation of sending a YAML file, YAML editing software 1201 includes a form conversion interface, which is a software-implemented communication interface, such as an API, plug-in, or SDK. Terminal 120 runs YAML editing software 1201, invokes the form conversion interface, and sends the YAML file to the server system.
[0141] In one possible implementation of sending a YAML file, a terminal generates a first request message based on the YAML file and a first conversion instruction; and the terminal sends the first request message to a server system. The first request message includes the YAML file and the first conversion instruction. The first request message may be, for example, an HTTP message, an encrypted Hypertext Transfer Protocol Secure (HTTPS) message, a File Transfer Protocol (FTP) message, or a Simple Mail Transfer Protocol (SMTP) message.
[0142] S230: The server system receives the YAML file from the terminal.
[0143] In a possible implementation of receiving the YAML file, the server system receives a first request message from the terminal, obtains the YAML file and a first conversion instruction from the first request message, and executes S240 in response to the first conversion instruction.
[0144] S240. The server system obtains a form based on the YAML file and the corresponding relationship between the parameters of the Kubernetes resource and the attributes of the form component.
[0145] In one possible implementation method of obtaining a form, the server system obtains the parameters of the Kubernetes resource from the YAML file, searches for the correspondence between the parameters of the Kubernetes resource and the attributes of the form component based on the parameters of the Kubernetes resource, obtains the attributes of the form component corresponding to the parameters of the Kubernetes resource, generates a form component based on the attributes of the found form component, and the form component is used to configure the parameters of the Kubernetes resource. The system generates a form based on the form component.
[0146] For example, the server system obtains the identifier of the Kubernetes resource from the YAML file. Based on the identifier of the Kubernetes resource, the system searches for the correspondence between the identifier of the Kubernetes resource and the identifier of the form component, obtains the identifier of the form component corresponding to the identifier of the Kubernetes resource, generates the form component based on the identifier of the form component, and the server system generates a form based on the form component.
[0147] The parameters of a Kubernetes resource include, for example, the identifier of the parameter of the Kubernetes resource. The identifier of the parameter includes, for example, the key of the parameter itself and the key of the parent parameter to which the parameter belongs. The key of the parent parameter and the key of the parameter are separated, for example, by the symbol . The identifier of the parameter is, for example, the key of the parameter, and the identifier of the parameter is, for example, the name of the parameter, a label, or other data that can identify the parameter. The key of the parameter is also called the keyword of the parameter, which is used to identify and describe a parameter.
[0148] The attributes of the form component include, for example, an identifier of the form component, for example, a key of the form component, and for example, a name of the form component.
[0149] In one possible implementation of obtaining the correspondence between Kubernetes resource parameters and form component attributes, the server system generates a read request based on parameter identifiers obtained from a YAML file. The read request indicates obtaining the correspondence between the Kubernetes resource parameters and form component attributes. The server system sends the read request to storage system 180. In response to the read request, storage system 180 sends a read response to the server system. The read response includes the correspondence between the Kubernetes resource parameters and form component attributes.
[0150] In another possible implementation of obtaining the correspondence between Kubernetes resource parameters and form component attributes, administrator 107 performs a configuration operation through terminal 170, editing a configuration file on terminal 170 to trigger a configuration test. Terminal 170 sends the configuration file to the server system, which includes the correspondence between Kubernetes resource parameters and form component attributes. The server system receives the configuration file from terminal 170 and obtains the correspondence between Kubernetes resource parameters and form component attributes from the configuration file.
[0151] In another possible implementation of obtaining the correspondence between Kubernetes resource parameters and form component attributes, administrator 107 performs a configuration operation through terminal 170, editing a configuration file on terminal 170 to trigger a configuration test. Terminal 170 sends the configuration file to the server system, which includes the correspondence between Kubernetes resource parameters and form component attributes. The server system receives the configuration file from terminal 170 and obtains the correspondence between Kubernetes resource parameters and form component attributes from the configuration file.
[0152] In another possible implementation of obtaining the correspondence between the parameters of Kubernetes resources and the attributes of form components, a server system interacts with a management node of Kubernetes, and the server system sends a query request to the management node of Kubernetes (e.g., a default controller), where the query request indicates obtaining the parameters of Kubernetes resources. The management node of Kubernetes receives the query request, and in response to the query request, sends a query response to the server system, where the query response includes the parameters of the Kubernetes resources. The server system obtains the parameters of the Kubernetes resources from the query response, determines the attributes of the form components that match the parameters of the Kubernetes resources based on the identifiers of the parameters of the Kubernetes resources and the values of the parameters of the Kubernetes resources, and establishes a correspondence between the parameters of the Kubernetes resources and the attributes of the form components.
[0153] In another possible implementation of obtaining the correspondence between Kubernetes resource parameters and form component attributes, the server system obtains the Kubernetes resource parameters from an API description file provided by Kubernetes. Based on the identifiers and values of the Kubernetes resource parameters, the server system determines the form component attributes that match the Kubernetes resource parameters and establishes the correspondence between the Kubernetes resource parameters and the form component attributes. The API description file includes all available APIs, resources, operations, and parameters, and provides usage examples and instructions.
[0154] In another possible implementation method of obtaining the correspondence between the parameters of Kubernetes resources and the attributes of form components, the server system reads the historical log of the user account logged in to the terminal, obtains the identifiers and parameter values of the Kubernetes resources configured in the historical time period recorded in the historical configuration log, determines the attributes of the form component that match the parameters of the Kubernetes resources based on the identifiers and parameter values of the Kubernetes resources, and establishes the correspondence between the parameters of the Kubernetes resources and the attributes of the form component.
[0155] In a possible implementation of saving the correspondence between the parameters of the Kubernetes resource and the attributes of the form component, the correspondence between the parameters of the Kubernetes resource and the attributes of the form component is saved via a JavaScript object notation (JSON) file.
[0156] S250: The server system sends a form to the terminal.
[0157] In one possible implementation of sending a form, the server system generates a first response message based on the form, the first response message including the form. The server system sends the first response message to the terminal. The first response message may be, for example, a Hypertext Transfer Protocol (HTTP) message, the first request message may be, for example, a File Transfer Protocol (FTP) message, or the first request message may be, for example, a Simple Mail Transfer Protocol (SMTP) message.
[0158] The method provided in this embodiment converts a YAML file into a visual form by utilizing the correspondence between Kubernetes resource parameters and form component properties. This allows users to configure parameter values by filling out the form. This eliminates the need for users to have an in-depth understanding of YAML syntax and format, lowers the barrier to entry when using YAML editing software to create resource configuration files, and reduces the probability of configuration failure.
[0159] Furthermore, since the parameters for creating a form based on the container scheduling system do not need to be pre-set by the front end, but instead support determining the parameters based on which the form is created through the parameters received from the terminal and the corresponding relationship, the corresponding relationship can be updated and maintained as the container system is upgraded, thereby upgrading the form conversion function, thereby improving flexibility and scalability and reducing the cost of upgrade and maintenance.
[0160] The above embodiment describes the basic process of converting a YAML file into a form based on a correspondence. The following further details some of the functions that can be achieved by converting a YAML file into a form. The correspondence between the parameter identifier and the parameter value type, the correspondence between the parameter value type and the type of the form component, the correspondence between the parameter identifier and the threshold range of the parameter value, the correspondence between the parameter hierarchy and the hierarchy of the form component, the correspondence between the parameter identifier and the parameter hierarchy, and the correspondence between the identifier of the first parameter and the identifier of the second parameter described below are specific examples of the parameters of the Kubernetes resources and the attributes of the form components in the above embodiment.
[0161] Function 1: Mapping between parameter value types of Kubernetes resources and form component types
[0162] Kubernetes parameter values come in many different types, and users may not be clear about the correct type, leading to a high probability of configuration failure. Based on this, an implementation provided in this application implements a mapping function between parameter value types and form component types. This allows the user to generate a form component that matches the Kubernetes parameter value type entered when editing a YAML file.
[0163] The parameter value type is, for example, an integer (int, meaning an integer), option, Boolean, string, or time.
[0164] Types of form components include number input box, select box, button, radio box, checkbox, switch, text input box (also called string input box), slider, etc.
[0165] For example, the correspondence between parameter value types and form component types is shown in Table 1 below.
[0166] Table 1
[0167] In one possible implementation of the mapping between parameter value types and form types, the server system obtains the identifier of the Kubernetes resource from the YAML file and, based on the identifier of the Kubernetes resource, searches for the correspondence between the identifier of the Kubernetes resource and the parameter value type of the Kubernetes resource to obtain the parameter value type corresponding to the identifier of the Kubernetes resource. Based on the type of the parameter value of the Kubernetes resource, the server system searches for the correspondence between the type of the parameter value of the Kubernetes resource and the type of the form component to obtain the type of the form component, thereby implementing the mapping between the parameter value type and the form type.
[0168] In another possible implementation of the mapping between parameter value types and form types, the server system obtains the identifier of the Kubernetes resource from the YAML file, searches for the correspondence between the identifier of the Kubernetes resource and the type of the form component based on the identifier of the Kubernetes resource, obtains the type of the form component, and thus implements the mapping between the parameter value type and the form type.
[0169] As a specific example, please refer to Figure 3. The user enters parameter 310 in the YAML editing software interface 300. The identifier of parameter 310 includes restart policy (meaning container restart policy). The server system searches for the correspondence between the parameter identifier and the parameter value type based on the restart policy, and obtains that the parameter value type corresponding to the restart policy is option. The server system searches for the correspondence between the parameter value type and the type of the form component based on the option, and obtains that the type of the form component corresponding to the option is a drop-down box. A drop-down box 410 named Container Restart Policy is generated in the form 400, so that the user can select the container restart policy in the drop-down box 410.
[0170] As a specific example, please refer to Figure 3. The user enters parameter 320 in the YAML editing software interface 300. The identifier of parameter 320 includes replicas (meaning the number of pod copies). The server system searches for the correspondence between the parameter identifier and the parameter value type based on replicas, and obtains that the parameter value type corresponding to replicas is an integer; the server system searches for the correspondence between the parameter value type and the type of the form component based on the integer, and obtains that the type of the form component corresponding to the integer is a numeric input box. Therefore, a numeric input box 420 named "number of pod copies" is generated in the form 400, so that the user can enter the value of the number of pod copies in the numeric input box 420.
[0171] As a specific example, please refer to Figure 3. The user enters parameter 330 in the YAML editing software interface 300. The identifier of parameter 330 includes privileged (meaning to run the container in privileged mode). The server system searches for the correspondence between the parameter identifier and the parameter value type based on privileged, and obtains that the parameter value type corresponding to privileged is Boolean; the server system searches for the correspondence between the parameter value type and the type of the form component based on the options, and obtains that the type of the form component corresponding to the Boolean type is switch. A switch 430 named "Run container in privileged mode" is generated in the form 400, so that the user can choose whether to run the container in privileged mode by clicking the switch.
[0172] As a specific example, the parameter input by the user is name (meaning name). Based on name, the server system searches for the correspondence between the parameter identifier and the parameter value type, and obtains that the parameter value type corresponding to name is string type; based on the string type, the server system searches for the correspondence between the parameter value type and the type of the form component, and obtains that the type of the form component corresponding to the string type is a text input box, so a text input box named name is generated so that the user can enter a name in the text input box.
[0173] Based on the mapping between parameter value types and form component types, the following effects are achieved.
[0174] First, further reduce the probability of configuration errors.
[0175] Because the Kubernetes parameter value type is taken into consideration when generating the form component, the type of the generated form component matches the Kubernetes parameter value type. The type of the form component limits the parameters entered by the user, which is equivalent to forcibly limiting the parameter value type entered by the user to the type of the form component. For example, when the parameter value type is an option, the form component type is a drop-down box, and the user needs to select the parameter value from the options in the drop-down box. Therefore, compared to arbitrarily entering parameter values in the text input box, the range of parameter values configured by the user is limited, thereby reducing the probability of configuration errors.
[0176] Second, improve scalability
[0177] Since the above functions are realized by utilizing the correspondence between the parameter identifier and the parameter value type, and the correspondence between the parameter value type and the form component type, when a new parameter needs to be added, the identifier of the newly added parameter and the parameter value type are added to the correspondence, and a form component matching the type of the newly added parameter can be generated. When the original parameter needs to be modified, the identifier of the parameter and the parameter value type are modified in the correspondence, and the original correspondence can be modified. This reduces the cost of server system maintenance, updates, and upgrades, and improves scalability.
[0178] Third, improve usability
[0179] By automatically generating form components, the threshold for parameter configuration is lowered, allowing users to complete parameter configuration more efficiently and accurately without having to deeply understand the type of parameter values.
[0180] Optionally, if the parameter value type cannot be found based on the parameter identifier, the server system obtains a common form component type, such as a text input box, as the form type corresponding to the parameter value type. For example, for some less commonly used parameters, outdated or obsolete parameters, the database stored by the server system may not contain a correspondence between the parameter identifier and the parameter value type. However, when the user enters a parameter that is not in the database, a text input box can be generated, allowing the user to freely enter the parameter value in the text input box, which helps achieve graceful degradation and improves compatibility.
[0181] Function 2: Mapping between Kubernetes resources and form component options
[0182] In the scenario of using Kubernetes, since the parameter values of many Kubernetes resources are specific options, if the parameter values of the Kubernetes configured by the user do not belong to the set of options allowed by Kubernetes, it will cause a non-optional value error. Based on this, in one implementation of the present application, a mapping function between the parameters of the Kubernetes resource and the options included in the form component is realized. Based on the identification of the Kubernetes resource, a form component including an option set can be generated, and the option set in the form component matches the identification of the Kubernetes resource, thereby limiting the range of the user-configured value to the option set and reducing the probability of non-optional value errors.
[0183] In one possible implementation of the mapping between the parameters of a Kubernetes resource and the options of a form component, the server system obtains the identifier of the Kubernetes resource from a YAML file, searches for the correspondence between the identifier of the Kubernetes resource and the option set of the parameter value based on the identifier of the Kubernetes resource, and obtains the option set corresponding to the identifier of the Kubernetes resource. The server system generates a form component based on the option set, and the form component includes the option set. For example, the form component is a drop-down box, and each option in the drop-down box is an option for the parameter value of the corresponding Kubernetes resource. For another example, the form component is a selection button, and each option allowed to be selected by the selection button is an option for the parameter value of the corresponding Kubernetes resource.
[0184] As a specific example of implementing a mapping between Kubernetes resources and options in a form component, please refer to FIG3 . A user enters a Kubernetes resource 310 in a YAML editing software interface 300. The identifier of Kubernetes resource 310 includes an image pull policy. The server system obtains the image pull policy from the YAML file and, based on the correspondence between the identifier of the image pull policy parameter and the set of options, obtains an option set including always, never, if not present, and on failure. During the process of converting the YAML file to a form, the server system generates a drop-down box 410 corresponding to Kubernetes resource 310. The option set in drop-down box 410 includes always, never, if not present, and on failure. "Always" indicates that an image is always attempted to be pulled. If a local or remote image does not exist, the latest remote image is attempted. "Never" indicates that an image is not attempted to be pulled and only the local image is used. "If not present" indicates that a remote image is attempted to be pulled only if the image does not exist locally. "On failure" indicates that a new image is attempted only if an error occurs in the previously used image or the pull fails.
[0185] As another specific example of implementing a mapping between Kubernetes resources and options for form components, the server system obtains max-pods from a YAML file. max-pods is the identifier of the parameter for the maximum number of Pods allowed to run on a node. Based on the correspondence between the identifier of the max-pods lookup parameter and the option set for the parameter value, the server system obtains an option set including the maximum number of Pods. When converting the YAML file to a form, the server system generates a drop-down box corresponding to max-pods. The drop-down box includes the maximum number of Pods, so that users can configure the maximum number of Pods by selecting from the drop-down box.
[0186] Based on the mapping between Kubernetes resources and form component options, the following effects are achieved.
[0187] First, further reduce the probability of configuration errors.
[0188] Because the options for Kubernetes resource parameter values are taken into account when generating the form component, the parameter value options are mapped to the options of the form component. This limits the range of values that users can enter in the form component to the set of allowed options, thereby reducing the probability of non-optional value errors.
[0189] Second, improve usability
[0190] By automatically generating a form component that includes options, the threshold for parameter configuration is lowered, so that users do not need to have an in-depth understanding of the parameter value options. By making selections, they can complete parameter configuration more efficiently and accurately.
[0191] Third, improve scalability
[0192] Since the above functions are implemented by using parameter identifiers and parameter value option sets, when a new parameter needs to be added, the identifier of the newly added parameter and the parameter value option set are added to the corresponding relationship, and a matching form component can be generated for the newly added parameter. When the original parameter needs to be modified, the identifier of the parameter and the parameter value option are modified in the corresponding relationship, and the original corresponding relationship can be modified. This reduces the cost of server system maintenance, updates, and upgrades, and improves scalability.
[0193] Function 3: Mapping the threshold range of parameter values to the threshold range allowed for configuration by form components
[0194] In Kubernetes scenarios, since the parameter values of many resources in Kubernetes must meet the set threshold range, if the value of the user-configured parameter exceeds the threshold range, an over-limit error will occur, which in turn causes the scheduler to schedule resources based on the incorrect parameters, bringing the risk of scheduling failure or resource contention.
[0195] Based on this, in one implementation of the present application, a mapping of the threshold range of parameter values and the threshold range of form components is implemented, and a matching form component can be generated based on the threshold range of parameter values, thereby avoiding the parameter value entered by the user exceeding the threshold range and reducing the risk of over-limit errors.
[0196] In one possible implementation of mapping the threshold range of parameter values to the threshold range allowed for configuration in a form component, the server system obtains the identifier of the Kubernetes resource from a YAML file, searches for the correspondence between the identifier of the Kubernetes resource and the threshold range of the parameter value for the Kubernetes resource based on the identifier of the Kubernetes resource, and obtains the threshold range of the parameter value corresponding to the identifier of the Kubernetes resource. The server system generates a form component based on the threshold range of the parameter value, and the threshold range allowed for configuration in the form component matches the threshold range of the parameter value. For example, the maximum value allowed for configuration in the form component is the same as the maximum value of the parameter, and the minimum value allowed for configuration in the form component is the same as the minimum value of the parameter.
[0197] As a way to obtain the correspondence between parameter identifiers and parameter value thresholds, this correspondence is established based on Kubernetes resource quotas. Resource quotas are Kubernetes configurations used to limit resource usage at different levels, such as namespaces, nodes, pods, and containers.
[0198] As a specific example of mapping parameter value thresholds to the threshold ranges allowed by form components, consider a user input parameter including "memory" (meaning memory capacity). The server system, based on memory, searches for a correspondence between the parameter identifier and the parameter value threshold range, and determines that the parameter value threshold range corresponding to memory (e.g., memory quota) is 2 gigabytes (GB). Based on the parameter value threshold range, the server system generates a numeric input box that allows a maximum value of 2GB.
[0199] Based on the mapping between the threshold range of the parameter value and the threshold range allowed to be configured by the form component, the effects achieved include the following aspects.
[0200] First, further reduce the probability of configuration errors.
[0201] Because the parameter value threshold ranges of Kubernetes resources are taken into account when generating form components, the generated form components allow the configured threshold ranges to match the parameter value threshold ranges, thereby reducing the risk of over-limit errors.
[0202] Second, improve scalability
[0203] Since the above functions are realized by utilizing the correspondence between the parameter identifier and the threshold range of the parameter value, when a new parameter needs to be added, the identifier of the newly added parameter and the threshold range of the parameter value are added to the correspondence, and a form component that matches the type of the newly added parameter can be generated. When the original parameter needs to be modified, the identifier of the parameter and the threshold range of the parameter value are modified in the correspondence, and the original correspondence can be modified. This reduces the cost of server system maintenance, updates, and upgrades, and improves flexibility and scalability.
[0204] Third, improve usability
[0205] By automatically generating form components, the threshold for parameter configuration is lowered, allowing users to complete parameter configuration more efficiently and accurately without having to deeply understand the threshold of the parameter value, reducing user configuration errors and tedious operations.
[0206] Function 4: Hierarchical relationship mapping
[0207] Hierarchical relationships can also be called parent-child relationships, nested relationships, or include-and-be-included relationships. For example, if parameter A includes parameter B, we can say that parameter A is the parent parameter of parameter B, and parameter B is the child parameter of parameter A. Parameter A is one level higher than parameter B.
[0208] YAML files have strict requirements for the number of indents before parameters. Typically, YAML files use two spaces of indentation to represent a sub-level. For example, if parameter B is a sub-parameter of parameter A, and parameter C is a sub-parameter of parameter B, when writing a YAML file, parameter B is typically indented two spaces more than parameter A, and parameter C is indented four spaces more than parameter A. If the number of indents for the parameters in the YAML file does not match the number of indents corresponding to the correct level of the parameters, a level error will occur, resulting in an error message and a failure to apply the YAML file in Kubernetes.
[0209] Based on this, in an implementation method provided in the present application, the function of hierarchical relationship mapping is realized, which can map the hierarchical relationship between parameters in the YAML file to the hierarchical relationship between parameters in the form, so that the converted form can visually reflect the hierarchical relationship between parameters in the interface, making the hierarchical relationship between parameters more intuitive and clear, reducing the probability of configuration failure caused by hierarchical errors due to the need to strictly control the hierarchical relationship according to a specific indentation number when configuring the YAML file, and improving the user experience.
[0210] In one possible implementation of hierarchical relationship mapping, the server system obtains the parameter hierarchy based on the YAML file. Based on the parameter hierarchy, the server system searches for a correspondence between the parameter hierarchy and the form component hierarchy, obtains the form component hierarchy, and generates a form component with the characteristics of the hierarchy.
[0211] There are many ways to determine the level of a parameter based on a YAML file. For example, the level of a parameter can be determined based on the number of indentations before the parameter in the YAML file. For example, the level of a parameter can be determined based on the ratio of the number of indentations before the parameter in the YAML file to 2. For example, the YAML file includes the following parameters in Kubernetes. In the following YAML file, the parameter name is a subparameter of the parameter metadata, and the parameter replicas is a subparameter of the parameter spec. The level of the parameter metadata is, for example, 1, the level of the parameter name is, for example, 2, the level of the parameter spec is, for example, 1, and the level of the parameter replicas is, for example, 2.
[0212] The hierarchy of form components in a form can be reflected in many ways. For example, the hierarchy of form components can be reflected based on the number of indentations before the label name of the form component. For another example, the hierarchy of form components can be reflected based on the height of the form component in the form. For another example, the hierarchy of form components can be reflected based on the row in which the form component is located in the form. For another example, the hierarchy of form components can be reflected based on whether the form component is in a visible state or a hidden state when the cascading list is in an expanded state; for another example, the hierarchy of form components can be reflected based on whether the form component is in a visible state or a hidden state when the cascading list is in a collapsed state; for another example, the hierarchy of form components can be reflected based on the color of the form component; for another example, the hierarchy of form components can be reflected based on the level of the form component in the tree control of the form component. For another example, the hierarchy of form components can be reflected based on the grouping of the form component in the form. For another example, the hierarchy of form components includes the distance between the form component and the interface boundary.
[0213] The correspondence between the hierarchy of parameters and the hierarchy of form components is, for example, a one-to-one relationship. For example, the YAML file includes a first parameter and a second parameter, and the form includes a first form component corresponding to the first parameter and a second form component corresponding to the second parameter. The server system determines based on the YAML file that the hierarchy of the first parameter is the same as the hierarchy of the second parameter, and the hierarchy of the obtained first form component is the same as the hierarchy of the obtained second form component, so the first parameter and the second parameter are at the same hierarchy in the generated form. The server system determines based on the YAML file that the first parameter is a subparameter of the second parameter (such as the first parameter is 1 level lower than the second parameter), and the obtained first form component is a subcomponent of the second form component.
[0214] In one possible implementation, the level of a parameter in a YAML file is the same as the level of the corresponding form component in a form. For example, when converting a YAML file to a form, for a parameter in the YAML file, the level of the parameter in the YAML file is determined, and this is used as the level of the corresponding form component in the form. For example, if a parameter is at the third level in a form, the parameter is displayed in the component at the third level in the form. For another example, when converting a form to a YAML file, for a form component in the form, the level of the form component in the form is determined, and this is used as the level of the parameter in the YAML file.
[0215] In another possible implementation, the level of the YAML file parameters is lower than the level of the corresponding form components in the form. For example, in the process of converting a YAML file into a form, for a parameter in the YAML file, the level of the parameter in the YAML file is determined, and the difference between the level and the set number is used as the level of the form component corresponding to the parameter in the form. For another example, in the process of converting a YAML file into a form, the metadata in the YAML file is displayed at the first level in the form, the parameters before the metadata (such as kind or version number) are displayed through the title in the form without reflecting the level of the parameters before the metadata, and the sub-parameters of the metadata are displayed at the second level in the form, thereby highlighting the important hierarchical relationship and weakening the hierarchical relationship of unimportant parameters, making the visual effect of the form clearer.
[0216] Based on hierarchical relationship mapping, the effects achieved include the following aspects.
[0217] First, since the hierarchical relationship between form components is generated by the server system, users do not need to control the hierarchical relationship by entering indentation in the YAML editing software, thereby reducing the probability of hierarchical errors caused by incorrect indentation input, and further reducing the probability of configuration failure caused by hierarchical errors.
[0218] Second, because the hierarchical relationship between form components is generated based on the hierarchical relationship between parameters in Kubernetes, users can understand the relationship between parameters based on the hierarchical relationship between form components, such as which parameter is the sub-parameter of which parameter, making it easier for users to fill out forms, thereby improving usability.
[0219] As a specific example, please refer to Figure 4 , which shows parameters 301 and 302 in the YAML editing software interface 300. Parameter 301 is the labels tag on line 6, and parameter 302 is app.kubernetes.lo / component:storage on line 7. Parameter 302 is indented two spaces compared to parameter 301, indicating that parameter 301 is the parent parameter of parameter 302. After converting the YAML file shown in interface 300 into a form, please refer to Figure 5. Form 400 in Figure 5 includes text input box 401 and text input box 402. Text input box 401 is the form component corresponding to parameter 301, and text input box 402 is the form component corresponding to parameter 302. Text input box 402 is indented by a certain amount compared to text input box 401. It can also be said that the distance between text input box 402 and the interface boundary is farther than the distance between text input box 401 and the interface boundary, indicating that text input box 401 is the parent component of text input box 402. From this example, it can be seen that through hierarchical mapping, the parent-child hierarchical relationship between parameters 301 and 302 is mapped to the parent-child hierarchical relationship between text input box 401 and text input box 402.
[0220] As another specific example, please refer to Figure 4. The interface 300 of the YAML editing software in Figure 4 includes parameters 301 and 303. Parameter 303 is an annotation located on the 12th line. The number of indent spaces of parameter 303 and parameter 301 is the same, indicating that parameter 303 and parameter 301 are at the same level. After converting the YAML file shown in the interface 300 into a form, please refer to Figure 5 and convert parameter 303 into a text input box 403. The number of pixels indented in the text input box 403 and the text input box 401 are the same. In other words, the distance between the text input box 403 and the interface boundary is the same as the distance between the text input box 401 and the interface boundary, indicating that the text input box 403 and the text input box 401 are at the same level. From this example, it can be seen that through hierarchical mapping, the same-level hierarchical relationship between parameter 301 and parameter 303 is mapped to the same-level hierarchical relationship between text input box 401 and text input box 403.
[0221] As another specific example, for the three Kubernetes parameters of version number, container, and volume, the version number is determined to be a sub-parameter of the container based on the YAML file. After the YAML file is mapped to a form, the version number input box in the form is located below and to the right of the container input box. The user can see from the positional relationship between the two input boxes that the version number to be entered is the container version number, not the volume version number.
[0222] In a possible implementation method of obtaining the parameter hierarchy based on a YAML file, the server system obtains the parameter identifier based on the YAML format file, searches for the correspondence between the parameter identifier and the parameter hierarchy based on the parameter identifier, and obtains the parameter hierarchy corresponding to the parameter identifier.
[0223] Regarding the data source for the correspondence between the parameter identifiers and the parameter hierarchy, in one possible implementation, a database is established and maintained that includes the identifiers and hierarchy of each parameter in Kubernetes. In one possible implementation, the Kubernetes command-line tool, kubectl, is used to obtain the hierarchy of each parameter in a Kubernetes resource. In another possible implementation, documentation is accessed on the official Kubernetes documentation website to obtain the relationship between the hierarchical structure of Kubernetes resources and their parameters.
[0224] In another possible implementation of obtaining the parameter hierarchy based on the YAML file, the server system converts the YAML format file into a JavaScript Object Notation (JSON) format file, and obtains the parameter hierarchy based on the JSON format file.
[0225] For example, for a parameter in a JSON file, the number of colons and curly braces preceding the parameter is used as the parameter level. Another example is converting a JSON parameter into the format of parent parameter.child parameter.child-child parameter, and the number of dots preceding the parameter is used as the parameter level.
[0226] As a specific example, in JSON format, parameters are enclosed in curly braces {}, and the parameter name and value are separated by a colon:. Parameters are separated by a comma, . For example, a JSON file includes the following two parameters. Because there is a colon and curly braces between the parameter with the key metadata and the parameter with the key name, the parameter with the key name is determined to be a subparameter of the parameter with the key metadata. Alternatively, when converting JSON format to YAML format, the line containing the parameter name is converted to metadata.name. Because there is a dot between metadata and name, the parameter with the key name is determined to be a subparameter of the parameter with the key metadata.
[0227] In another possible implementation of obtaining the parameter level based on the YAML file, the server system obtains the parameter level based on the number of indentations before the parameter in the YAML file. For example, the server system uses the ratio of the number of indentations before the parameter to 2 as the parameter level.
[0228] The various methods for obtaining hierarchical features listed above can be performed individually or in combination. For example, the method for obtaining hierarchical features can be a combination of the two methods of searching for corresponding relationships based on parameter identifiers and parsing JSON format files. For example, the method for obtaining hierarchical features includes the following steps 1 and 5.
[0229] Step 1: The server system converts the YAML format file into a JSON format file.
[0230] Step 2: The server system obtains the first-level features of the parameters based on the JSON format file.
[0231] Step 3: The server system obtains the parameter identifier based on the JSON format file, searches for the correspondence between the parameter identifier and the parameter level based on the parameter identifier, obtains the second-level feature of the parameter, and compares the first-level feature with the second-level feature.
[0232] Step 4: If the first-level feature and the second-level feature are the same, the server system determines that the parameter level is correct and determines the first-level feature or the second-level feature as the parameter level.
[0233] Step 5: If the first-level feature and the second-level feature are different, the server system determines that the parameter level is wrong. In the case of a parameter level error, the server system may prompt the user that the parameter level is wrong.
[0234] As a specific example, referring to FIG4 , for parameter 305 (name) in row 4 of FIG4 , the key of parameter 305 is name, the key of its parent parameter is metadata, and the identifier of parameter 305 is, for example, metadata.name. During step 3, the server system searches for the correspondence between the parameter identifier and the parameter level based on metadata.name and determines that the level of metadata.name is 2.
[0235] Through the methods described in steps 1 and 5 above, not only can the parameter hierarchy be obtained, but also the parameter hierarchy is verified by comparison before hierarchical relationship mapping, thereby improving the correctness of the parameter hierarchy.
[0236] Function 5: Linkage relationship mapping
[0237] In the Kubernetes scenario, there are correlations between the configurations of some parameters. For example, the value of parameter A limits the value range of parameter B. When the value of parameter A is determined, the value of parameter B needs to be configured as a specific type of value, a specific option, or within a specific threshold range. If the user does not consider the value of parameter A when configuring the value of parameter B, the input value of parameter B will not meet the requirements of parameter A, resulting in the risk of configuration errors such as invalid configuration operations. This embodiment defines this relationship in which the configuration of one parameter is restricted by the configuration of other parameters as a linkage relationship.
[0238] As a specific example of parameters with a linkage relationship, for the volume type and permissions parameters, if the volume type value is configured as a persistent volume claim (PVC), the permissions value must be configured as read-only or write-read. If the volume type value is configured as a secret, the permissions value must be configured as a number representing file permissions. Conversely, if the volume type value is configured as a PVC and the permissions value is configured as a number, a parameter configuration error will occur.
[0239] The current YAML editing software does not check the linkage relationship of parameters and provide error prompts in combination with the usage scenarios of Kubernetes, resulting in a high probability of parameter configuration errors. Based on this, in a possible implementation method of the present application, the linkage relationship between parameters in the YAML file is mapped to the linkage relationship of form components in the form, so that after the value of parameter A is configured, the type of form component corresponding to parameter B can change with the value of parameter A. Therefore, the configuration range of the value of parameter B can be limited based on the form component, which is equivalent to forcing the user to choose the correct way to input based on a specific type of form component, reducing the probability of parameter B configuration error, so it is easier to use.
[0240] The following uses the first parameter and the second parameter as examples to illustrate how to implement linkage relationship mapping. The form component corresponding to the first parameter is described as a first form component, and the form component corresponding to the second parameter is described as a second form component. The first form component is used to configure the value of the first parameter, and the second form component is used to configure the value of the second parameter.
[0241] In one possible implementation of the linkage relationship mapping, the server system obtains the identifier of the first parameter and the value of the first parameter from the YAML file. Based on the identifier of the first parameter, the server system searches for the correspondence between the identifier of the first parameter and the identifier of the second parameter, and obtains the identifier of the second parameter. Based on the value of the first parameter and the identifier of the second parameter, the server system searches for the correspondence between the value of the first parameter, the identifier of the second parameter, and the candidate value of the second parameter, and obtains the candidate value of the second parameter. Based on the candidate value of the second parameter, the server system searches for the correspondence between the value type of the second parameter and the type of the second form component, and obtains the type of the second form component.
[0242] As a specific example, a YAML file includes a volume type parameter whose value is a PVC. The server system searches Table 2-1 for the volume type and obtains the permissions, thereby determining that the parameter associated with the volume type is the permissions. The server system searches Table 2-2 for the permissions and PVC and obtains the read-only or read-write option. The server system searches Table 2-3 for the read-only or read-write option and, in response to a match between the read-only or read-write option and the option in Table 2-3, generates a drop-down box for the permissions, which contains the options read-only or read-write.
[0243] Table 2-1
[0244] Table 2-2
[0245] Table 2-3
[0246] In another possible implementation of the linkage relationship mapping, the server system obtains the identifier of the first parameter and the value of the first parameter from the YAML file. Based on the identifier of the first parameter, the server system searches for a correspondence between the identifier of the first parameter and the identifier of the second parameter to obtain the identifier of the second parameter. Based on the value of the first parameter and the identifier of the second parameter, the server system searches for a correspondence between the value of the first parameter, the identifier of the second parameter, and the type of the second form component to obtain the type of the second form component.
[0247] As a specific example, a YAML file includes a volume type parameter whose value is a PVC. The server system uses the volume type's mapping relationship shown in Table 2-4 to obtain the permissions, thereby determining that the parameter associated with the volume type is the permissions. The server system also uses the permissions' mapping relationship shown in Table 2-5 to obtain a drop-down list, and therefore determines to generate a drop-down list for the permissions.
[0248] Table 2-4
[0249] Table 2-5
[0250] In another possible implementation of the linkage relationship mapping, the server system obtains the identifier and value of the first parameter from the YAML file. Based on the identifier and value of the first parameter, the server system searches for a correspondence between the identifier, value, and candidate values of the second parameter to obtain the candidate value of the second parameter. Based on the candidate value of the second parameter, the server system searches for a correspondence between the candidate value of the second parameter and the type of the second form component to obtain the type of the second form component.
[0251] In another possible implementation of the linkage relationship mapping, the server system obtains the identifier and value of the first parameter from the YAML file. Based on the identifier and value of the first parameter, the server system searches for a correspondence between the identifier, value, and type of the second form component to obtain the type of the second form component.
[0252] Based on linkage relationship mapping, the effects achieved include the following aspects.
[0253] First, further reduce the probability of parameter configuration errors.
[0254] Since the value of the first parameter related to the second parameter is taken into consideration when generating the form component of the second parameter, the type of the generated form component matches the relationship between the two parameters and the value of the first parameter. This is equivalent to limiting and restricting the value range of the second parameter through the type of the form component, thereby increasing the probability of correct parameter input.
[0255] Second, improve scalability
[0256] Because these functions are implemented using mappings, they are flexible and easy to expand and adjust. For example, when upgrading or updating Kubernetes, new parameters or new relationships between parameters can be added to the mappings to update the functions mapped by the linkages. This reduces the cost of server system maintenance, updates, and upgrades, and improves scalability.
[0257] Third, improve usability
[0258] By automatically generating form components based on the relationship between parameters, the threshold for parameter configuration is lowered, allowing users to complete parameter configuration more efficiently and accurately without having to deeply understand the relationship between parameters.
[0259] Function 6: Parameter identification recommendation
[0260] In one possible implementation of parameter identifier recommendation, while a user is editing a YAML file, the terminal listens for parameter input events. In response to the parameter input event, the terminal obtains the identifier of the input parameter and sends the identifier to the server system. The server system receives the identifier from the terminal. Based on the identifier, the server system searches a parameter identifier library to obtain a target parameter identifier that matches the parameter identifier. The server system then sends the target parameter identifier to the terminal, which then displays the target parameter identifier.
[0261] By recommending parameter identifiers, the system can automatically and intelligently recommend parameter identifiers to users when they are editing YAML files, thereby further reducing the complexity of operations. In addition, the system can provide real-time recommendations when users perform input operations, thus improving timeliness.
[0262] A parameter identifier library, also known as a lexicon, contains multiple possible parameter identifiers. For example, a parameter identifier library includes identifiers for parameters used by the container scheduling system. For example, a parameter identifier library includes the keys for all common parameters in Kubernetes.
[0263] As a possible implementation method for constructing a parameter identification library, the parameter identification library includes identifiers of the parameters of the resources based on which the container scheduling system schedules containers. For example, the parameter identification library includes identifiers of all parameters of the resources based on which the container scheduling system schedules containers. For example, a server system interacts with a management node of the container scheduling system, and the server system receives identifiers of all parameters sent by the management node of the container scheduling system and saves the identifiers of the parameters to the parameter identification library. For another example, the identifiers of the parameters are obtained from the API description file of the container scheduling system.
[0264] As another possible implementation of building a parameter identification library, the parameter identification library includes identifiers of parameters configured by a user account during historical time periods. For example, upon obtaining authorization from a user account, the server system reads the user account's historical configuration log, which records the identifiers of parameters configured during historical time periods. The server system then saves the identifiers of the parameters configured during historical time periods to the parameter identification library.
[0265] As another possible implementation method for constructing a parameter identification library, the parameter identification library includes parameters whose configuration frequencies of user accounts meet conditions in historical time periods. For example, after obtaining authorization from the user account, the server system reads the historical configuration log of the user account, counts the configuration frequencies of the identifiers of the configured parameters recorded in the historical configuration log, selects the parameters with the top k configuration frequencies or the configuration frequencies higher than the set frequencies from the identifiers of the configured parameters in the historical time period, and saves the identifiers of the selected parameters to the parameter identification library. In this way, parameter identifiers can be recommended to users based on the parameter configuration habits of the user in the historical time period, thereby reducing the complexity of the user's configuration parameter identifiers and achieving personalized recommendations.
[0266] Another possible implementation of a parameter identifier library is to include the preferred parameter identifiers of parameters configured by user accounts over historical time periods. For example, a user can customize identifiers for some of their preferred parameters, and the server system can save these identifiers to the parameter identifier library. This approach allows for the recommendation of parameter identifiers based on the user's personal preferences, thereby reducing the complexity of configuring parameter identifiers and enabling personalized recommendations.
[0267] As a way of searching in the parameter identification library, the server system uses a fuzzy query method to search in the parameter identification library to obtain the target parameter identification in the parameter identification library that satisfies the regular expression with the parameter identification. Fuzzy query usually refers to a query method that constructs a regular expression based on some special symbols and operators, and uses the regular expression to represent the matching condition. The fuzzy query method allows the search result (such as the identification of the target parameter) to be different from the index based on which the search is performed (such as the identification of the parameter input by the user), for example, the search result and the index based on which the search is performed satisfy the regular expression. By using the fuzzy query method, even if there is an error in the identification of the parameter input by the user, there is a certain probability that the identification of the target parameter can be found, thereby more comprehensively detecting and matching the target parameter identification and improving the accuracy of parameter recommendation.
[0268] As a specific example of parameter identification recommendation, the server system receives parameter identification a from the terminal, and the parameter identification library includes parameter identification abc. The server system queries the parameter identification library based on parameter identification a and determines that identification abc in the parameter identification library matches identification a, and therefore recommends identification abc to the user.
[0269] Another possible implementation of parameter identifier recommendation involves predicting the parameter identifier to be configured based on a machine learning algorithm. For example, a machine learning model is trained using the parameter identifiers configured in a user account's historical time period as a training sample set. After obtaining the parameter identifiers from the YAML file, the parameter identifiers are input into the machine learning model, which then outputs the target parameter identifier. The server system then recommends the target parameter identifier to the user.
[0270] Function 7: Parameter error identification
[0271] In a possible implementation of parameter error identification, during the user editing of a YAML file, the terminal listens for a parameter identifier input completion event. In response to the parameter identifier input completion event, the terminal obtains the identifier of the input parameter, and the terminal sends the parameter identifier to the server system. The server system receives the identifier of the parameter from the terminal. Based on the identifier of the parameter, the server system searches the parameter identifier library for a target parameter identifier that matches the identifier of the parameter. If no parameter identifier that matches the identifier of the parameter is found in the parameter identifier library, for example, each parameter identifier stored in the parameter identifier library does not meet the matching condition with the parameter identifier received from the terminal, the server system determines that there may be an error in the parameter input, and the server system sends an error prompt message to the terminal, which is used to prompt the user to confirm whether the input is incorrect. The terminal displays an error prompt message.
[0272] The parameter identifier input completion event is triggered, for example, by a colon input operation. Specifically, in a YAML file, the key and value in a key-value pair are typically separated by a colon. The terminal can listen for colon input operations and, in response to the colon input operation, obtain the string before the colon as the input parameter identifier and send the parameter identifier to the server system.
[0273] In this way, when the user is editing the YAML file, as the user completes the input operation of the parameter identifier, it can identify whether there are errors in the parameters entered by the user and prompt possible errors without having to wait for the YAML file to be edited. Therefore, the function of real-time error prompt is realized, the error prompt delay is shorter, and the timeliness is better.
[0274] In one possible implementation of parameter error identification using a YAML editor, a user enters a parameter identifier and value in the YAML editor, followed by a line break (a line break indicates that an input is complete, such as when pressing the Enter key to wrap a line). When the system detects the line break, if an error occurs during verification based on the identifier and value of the currently entered parameter, an error message is displayed in the YAML editor, indicating that the input parameter is incorrect.
[0275] In one possible implementation of parameter error identification using a visual form, a user enters a parameter value in an input box surrounding a parameter identifier in the form. When the system detects that the input box has lost focus (losing focus means that the input box is not currently the user's input target), an error occurs based on the parameter identifier and the value of the parameter entered in the input box. An error message is displayed around the input box, indicating that the parameter input is incorrect.
[0276] Optionally, after the terminal displays an error message, the user can choose to ignore the error message. In this case, the server system can create a resource based on the parameters entered by the user. If the creation is successful, the identifier of the parameter entered by the user is updated in the parameter identifier library. In this way, considering that no matching target parameter identifier is found in the parameter identifier library, it may be due to incomplete data stored in the parameter identifier library. Therefore, while the error message is displayed, it avoids blocking the user's normal operation and improves the comprehensiveness of the parameter identifier library data.
[0277] The embodiment shown in FIG2 focuses on describing the process of converting a YAML file into a form. The embodiment of the present application also provides a method for converting a form into a YAML file, which is illustrated below with reference to FIG6 .
[0278] FIG6 is a flow chart of a form conversion method 500 provided in an embodiment of the present application. The method 500 shown in FIG6 includes S510 to S550.
[0279] S510: The terminal obtains a form.
[0280] S520: The terminal sends a form to the server system.
[0281] In one possible scenario for sending a form, referring to FIG3 , a terminal displays a YAML editing software interface 400, which includes a button 405. Button 405 is used to trigger the conversion of the form into a YAML file. When the form needs to be converted into a YAML file, the user can click button 405, triggering a second conversion instruction that instructs the form to be converted into a YAML file. In response to the second conversion instruction, the terminal obtains the identifiers of each form component in interface 400 and the values within the form components, obtains the form, and sends the form to the server system.
[0282] In one possible implementation of sending the form file, the form editing software includes a YAML conversion interface, which is a communication interface implemented by software, such as an API, plug-in, or SDK. Terminal 120 runs the form editing software, calls the YAML conversion interface, and sends the YAML file to the server system.
[0283] In one possible implementation of sending a form, the terminal generates a second request message based on the form and the second conversion instruction; the terminal then sends the second request message to the server system. The second request message includes the form and the second conversion instruction. The second request message may be, for example, an HTTP message, an FTP message, or an SMTP message.
[0284] S530: The server system receives a form from the terminal.
[0285] In a possible implementation of receiving the form, the server system receives a second request message from the terminal, obtains the form and the second conversion instruction from the second request message, and executes S240 in response to the second conversion instruction.
[0286] S540. The server system obtains a YAML file based on the form and the correspondence between the parameters of the Kubernetes resources and the attributes of the form components.
[0287] In one possible implementation, the server system converts the identifier of a form component and the value of the form component based on the form. The server system obtains the identifier of the parameter of the Kubernetes resource based on the identifier of the form component and the correspondence between the identifier of the form component and the identifier of the parameter of the Kubernetes resource. The server system obtains the value of the parameter of the Kubernetes resource based on the value of the form component. The server system retrieves the YAML file based on the key-value pairs.
[0288] In addition, the server system can determine the hierarchy of the Kubernetes resource parameters based on the identifiers of the Kubernetes resource parameters and the correspondence between the identifiers of the Kubernetes resource parameters and the hierarchy of the Kubernetes resource parameters. Based on the identifiers of the Kubernetes resource parameters, the indentation of the parameters in the YAML file is determined, thereby reducing the probability of parameter hierarchy errors.
[0289] S550: The server system sends the YAML file to the terminal.
[0290] The method provided in this embodiment helps to solve the shortcoming of incomplete parameter coverage in wizard-style creation by converting the form into a YAML file, and realizes the automatic generation of YAML files, reducing human maintenance costs. In particular, due to the excessive types of Kubernetes resources and the parameters configured in the Kubernetes resources, and the limited length of the form page, the probability of the form containing input boxes corresponding to all parameters in Kubernetes is low, resulting in that it may be difficult to cover all parameters in Kubernetes when configuring parameters through the form, and the parameter configuration is not comprehensive enough. Through the above implementation method, when the user uses the form to create a Kubernetes resource configuration file, if it is found that there is no input box corresponding to the parameter that needs to be configured in the form, the system can be instructed to convert the form into a YAML file and enter the parameters that need to be configured in the YAML file, thereby improving the comprehensiveness of the parameter configuration.
[0291] Based on the above embodiments of converting from a YAML file to a form and from a form to a YAML file, the embodiments of the present application also provide a process for converting between a YAML file and a form, which is illustrated below with reference to the embodiments of Figures 7 and 8.
[0292] FIG7 is a flow chart of a form conversion method 600 provided in an embodiment of the present application. The method shown in FIG7 includes S610 to S691.
[0293] S610: The terminal obtains a first form.
[0294] This embodiment involves modification of form content. To distinguish descriptions, “first form” is used to describe the form before modification, and “second form” is used to describe the form after modification.
[0295] S620: The terminal sends a first form to the server system.
[0296] S630: The server system receives a first form from the terminal.
[0297] S640. The server system obtains a first YAML file based on the correspondence between the first form and the attributes of the Kubernetes resource and the form component.
[0298] This embodiment involves modifying the content of a YAML file. To distinguish descriptions, "first YAML file" is used to describe the YAML file before modification, and "second YAML file" is used to describe the YAML file after modification.
[0299] S650: The server system sends the first YAML file to the terminal.
[0300] S660: In response to the modification operation on the first YAML file, the terminal obtains a second YAML file based on the first YAML file and the modified parameters.
[0301] For example, the terminal displays the contents of a first YAML file in a YAML file editor interface. A user performs a modification operation on the first YAML file. For example, the user enters a new parameter in the YAML file editor interface, such as entering the identifier of the required parameter and the parameter value in the key:value format. Alternatively, the user deletes an existing parameter in the first YAML file, or the user updates the value of a parameter in the first YAML file. In response to the modification operation, the terminal obtains a second YAML file based on the first YAML file and the modified parameter in the first YAML file.
[0302] S670: The terminal sends a second YAML file to the server system.
[0303] S680: The server system receives a second YAML file from the terminal.
[0304] S690. The server system obtains a second form based on the correspondence between the second YAML file and the parameters of the Kubernetes resource and the attributes of the form component.
[0305] As one possible implementation method for obtaining the second form, the server system compares the second YAML file with the first YAML file to determine the modified Kubernetes resource parameters in the second YAML file compared to the first YAML file. Based on the modified parameters, the server system searches for a correspondence between the Kubernetes resource parameters and the attributes of the form components, obtains the attributes of the form components corresponding to the modified Kubernetes resource parameters, and updates the first form based on the attributes of the form components corresponding to the modified Kubernetes resource parameters to obtain the second form.
[0306] S691: The server system sends a second form to the terminal.
[0307] The method provided in this embodiment realizes the mutual conversion between YAML files and forms, thereby combining the advantages of the two methods of editing YAML files and the form-based creation method, which not only lowers the usage threshold of YAML creation, but also reduces the probability of incomplete parameter coverage in wizard-based creation.
[0308] FIG8 is a flow chart of a form conversion method 700 provided in an embodiment of the present application. The method shown in FIG8 includes the following steps.
[0309] S710. The terminal obtains a first YAML file.
[0310] S720: The terminal sends a first YAML file to the server system.
[0311] S730: The server system receives a first YAML file from the terminal.
[0312] S740. The server system obtains a first form based on the first YAML file and the corresponding relationship.
[0313] S750: The server system sends a first form to the terminal.
[0314] S760: In response to the modification operation on the first form, the terminal obtains a second form based on the first form and the modified parameters.
[0315] S770: The terminal sends a second form to the server system.
[0316] S780: The server system receives a second form from the terminal.
[0317] S790. The server system obtains a second YAML file based on the second form and the corresponding relationship.
[0318] S791. The server system sends a second YAML file to the terminal.
[0319] The method provided in this embodiment realizes the mutual conversion between YAML files and forms, thereby combining the advantages of the two methods of editing YAML files and the form-based creation method, which not only lowers the usage threshold of YAML creation, but also reduces the probability of incomplete parameter coverage in wizard-based creation.
[0320] In the above embodiments, the steps of searching for various corresponding relationships can be executed by the server system. This embodiment does not limit the execution subject of the step of searching for corresponding relationships. The following example illustrates the execution subject of the search step with reference to the system architecture shown in FIG1 .
[0321] In one possible implementation, the correspondence is stored in the memory of front-end server 140-a. A network interface of front-end server 140-a receives a YAML file from a terminal and sends the YAML file to a processor of front-end server 140-a. Based on the received parameters, the processor of front-end server 140-a searches the stored correspondence for the corresponding relationship and obtains the properties of the form component.
[0322] In another possible implementation, the corresponding relationship is stored in the memory of the back-end server 140-b. After the processor of the front-end server 140-a receives the parameters in the YAML file from the terminal, the processor of the front-end server 140-a generates a read request based on the parameters in the received YAML file. The read request indicates to obtain the properties of the form component corresponding to the parameters in the YAML file. The processor of the front-end server 140-a instructs the network interface of the front-end server 140-a to send the read request to the back-end server 140-b. The back-end server 140-b receives the read request from the front-end server 140-a. The processor of the back-end server 140-b searches the corresponding relationship stored in the memory of the back-end server 140-b based on the parameters in the received YAML file, and obtains the properties of the form component corresponding to the parameters in the YAML file.
[0323] In another possible implementation, the corresponding relationship is stored in a storage system 180 that is communicatively connected to the server system. The processor of backend server 140-b generates a read request based on the parameters in the received YAML file. The read request indicates that the form component attributes corresponding to the parameters in the YAML file should be retrieved. The processor of backend server 140-b instructs the network interface of backend server 140-b to send the read request to storage system 180. Storage system 180 obtains the parameters in the YAML file from the read request, searches for the corresponding relationship based on the parameters in the YAML file, obtains the attributes of the form component, and sends the attributes of the form component to backend server 140-b.
[0324] The YAML files in the various embodiments listed above can be used to instruct the container scheduling system to deploy containers. As an exemplary application scenario of a YAML file, in combination with the architecture shown in Figure 1, the server system 140 sends a request message to the container scheduling system 190. The request message includes a YAML file and an apply instruction. The apply instruction indicates that the YAML file is applied for resource configuration. The controller of the container scheduling system 190 obtains the YAML file and the apply instruction from the request message, and in response to the apply instruction, configures the resources based on the resource parameters in the YAML file, and then uses the configured resources to manage the containerized application deployed by the user 101. As a specific example, when the user edits the YAML file or form, the parameters of the configured resources include the number of container copies, the name of the volume to be mounted, and the type of volume to be mounted. The controller of the container scheduling system 190 creates a specified number of pod copies on each node according to the number of copies, and assigns volumes of the specified name and specified type to the pod copies.
[0325] The above embodiment is described below with reference to an example.
[0326] The following example provides a system architecture for implementing a visual form based on Angular.
[0327] Angular is a TypeScript-based development platform for building modern web applications. Angular uses a model-view-controller (MVC) style architecture to help developers easily manage and organize the logic layer of an application. The components of the Angular architecture include a web browser, template, component, module, two-way data binding, and dependency injection. A browser refers to a web browser that users use to access websites. A web browser is used to display the application's interface, thereby presenting the application's view to the user. A template refers to an HTML file used to represent a view in an application. The template is used to generate the application's interface. A component is equivalent to a controller, used to manage and organize the application's logic. A module is a container for components that is used to combine and organize the various parts of an application.
[0328] Two-way data binding is a technique that automatically associates models with views, synchronizing model data with the view and automatically responding to user input in the view. This makes code writing simpler and more efficient.
[0329] For example, please refer to Figure 9, which is a schematic diagram of a system architecture provided by an embodiment of the present application. The system architecture shown in Figure 9 includes an editor template 910, a form template 920, a form conversion module 930, a hierarchical relationship management module 940, a linkage relationship management module 950, a parameter error identification module 960 and a resource management center 970.
[0330] An editor template is an HTML file template. It defines the editor's view, displaying it in the browser. The editor is used to edit YAML files. In one possible implementation, the editor template is created using an Angular template. An Angular template is an HTML file that describes the structure and style of the build interface. An Angular template contains Angular directives, bindings, and template expressions. An Angular template serves as the view layer for the entire Angular application and is particularly useful for building dynamic applications.
[0331] A form template is a template for an HTML file. It defines the form view so that the form is displayed in the browser. In one possible implementation, the form template is created using an Angular template.
[0332] The form conversion module is used to convert editor templates to form templates and vice versa. It includes services such as hierarchical relationship management, linkage relationship management, and intelligent parameter recognition.
[0333] The Hierarchical Relationship Management module handles hierarchical relationships in Kubernetes resource configuration files. For example, if a Kubernetes resource configuration file is a deployment file and the resource is a pod, pods can be configured in the deployment file. The Hierarchical Relationship Management module manages the hierarchical relationship between deployments and pods.
[0334] The linkage relationship management module handles linkage-related parameters in Kubernetes resource configuration files. For example, linkage parameters include volume type and default permissions. When the volume type is set to PVC, the default permissions must be set to read-only or read-write. When the volume type is set to Secret, the default permissions must be set to a number representing file permissions.
[0335] The parameter error intelligent identification service is used to make parameter recommendations based on the full parameter key library managed by the resource management center.
[0336] The parameter error intelligent identification service also compares input parameters with reference parameters to identify parameter errors. Reference parameters can be preset parameters, standard parameters, or parameters from historical data. Parameter comparison involves comparing input parameters with reference parameters based on spelling, name, type, format, range, and value.
[0337] The Resource Management Center manages the resources required by the form conversion module when converting YAML files to and from forms. For example, the resources managed by the Resource Management Center include Kubernetes resource configuration files for different scenarios, the full Kubernetes parameter key-value library, the mapping relationships between parameter value types and form component types, the mapping relationships between parameter value options and form component options, the mapping relationships between linkage relationships, and the mapping relationships between parameter value threshold ranges and the threshold ranges allowed for configuration in form components. The Kubernetes parameter key-value library includes key-value pairs for common parameters in Kubernetes.
[0338] For example, please refer to FIG10, which is a flowchart of converting a YMAL file into a form provided by an embodiment of the present application. The method shown in FIG10 includes the following steps.
[0339] S810: The user performs an input operation in the editor displayed in the browser, thereby inputting the content of the YAML file.
[0340] At step S820, the user clicks a button displayed in the editor that reads "Convert to Form," triggering an instruction to convert the YAML file into a form. In response to the instruction, the terminal running the browser generates an HTTP request based on the YAML file input into the browser and sends the HTTP request to the form conversion module. The HTTP request includes the YAML file and the instruction to convert the file into a form.
[0341] S830: The form conversion module parses the YAML file in response to the conversion instruction and sends the YAML file to the hierarchical relationship management module and the linkage relationship management module.
[0342] S840, the hierarchical relationship management module processes the hierarchical relationship between the parameters in the YAML file, and converts the YAML file into a visual form containing the hierarchical relationship based on the hierarchical relationship between the parameters in the YAML file.
[0343] S850, the linkage relationship management module processes the linkage relationship between the parameters in the YAML file, converts the YAML file into a visual form containing the linkage relationship based on the linkage relationship of the parameters in the YAML file, and displays the linkage on the front end.
[0344] S860, the parameter error identification module performs a fuzzy query on the unrecognizable parameter keys and recommends the query results to the form for the user to modify and select.
[0345] S870: The hierarchical relationship management module returns a form template including the hierarchical relationship to the browser.
[0346] S880, browser rendering includes a hierarchical form template.
[0347] S890: The linkage relationship management module returns a form template including the linkage relationship to the browser.
[0348] S811, the browser renders the form template including the linkage relationship.
[0349] S812: The linkage relationship management module returns an error message and recommended parameters.
[0350] S813, the browser renders a form template including error prompt information and recommended parameters.
[0351] The following is a further detailed description of each unit in the architecture shown in FIG9 .
[0352] The editor template is based on the front-end plugin code mirror. Specifically, the system obtains Document Object Model (DOM) elements and uses the CodeMirror.fromTextArea method to convert them into YAML editors. Two-way data binding is used to transfer data between the YAML editor and the web front-end components.
[0353] The DOM is a standard model for representing documents such as HTML. It represents the entire document as a tree structure consisting of nodes, each of which represents an element, attribute, text, or comment. DOM elements are used to represent elements in web pages.
[0354] One possible implementation of the interaction between the editor and the user is that the editor template interacts with the web front-end component through two-way data binding. For example, the browser acts as the (view) layer, and the browser renders the editor on the page, so that the browser presents the view of the editor. The user edits the YAML file through the editor displayed in the browser and enters the parameters to be modified. The browser (or view) sends the modified parameters to the web front-end component (component) through two-way data binding (data binding). After the web front-end component obtains data from the resource configuration center (module), the web front-end component renders the data to the page through the browser. Generally, the web front-end component (component) sends a submission (post) request to the back-end server by calling the interface of the service (module Service). The post request includes the YAML file entered in the editor. The post request is used to instruct the creation of a resource configuration file.
[0355] For example, please refer to FIG11 , which shows an architecture for interaction between an editor and a user.
[0356] The architecture shown in Figure 11 includes four components: Web browser, template, component, and module.
[0357] A web browser is the client software that users use to access web applications, such as Google Chrome or Mozilla Firefox. You access Angular applications through a browser by entering a Uniform Resource Locator (URL) or following hyperlinks to navigate to different pages. The web browser parses and renders HTML, CSS, and JavaScript code to present the user interface.
[0358] Templates describe how data is displayed and how users interact with them. They define a component's view and are essentially HTML code that describes its structure, style, and behavior. Templates act as data-driven applications, binding component data to its view so that when the component's data changes, the template automatically updates the view. Templates define the application's user interface. Templates can contain binding expressions, structural directives, attribute directives, and other content to dynamically generate and update HTML elements.
[0359] A component is a basic building block in an application. It encapsulates related data and behaviors and is associated with a template, used to generate part of the user interface. Components can contain other components and interact with them through input and output properties, event binding, and other methods. A component is a container for organizing and controlling the interface and logic of an application. Components typically contain a template, a controller (such as a class), and some styles. Components handle user interaction and data display logic and can be divided into multiple subcomponents to form an organic whole.
[0360] Modules are used to organize and manage the different parts of an application. A module can be a page, a feature module, or even the root module of the entire application. Modules provide a componentized approach to applications, allowing each module to be developed and deployed independently, facilitating code maintenance and expansion.
[0361] Given the relationships between the four components mentioned above, a component typically contains a template, and this template can be used to generate a portion of the user interface. Components can define input and output properties, event bindings, and other methods to interact with other components. Components typically belong to a module and can be declared, exported, and imported within that module. Templates typically contain binding expressions that reference component data and dynamically update HTML elements based on data changes. Modules can import other modules, and these modules can use exported components and services. For example, an application consists of multiple modules, each of which defines components and services. Each component has a template that defines its view. When users interact with the application, the component responds according to the template. Components can also be assembled with other components to form a component tree. This approach facilitates flexible application management and expansion, code reuse, and decoupling.
[0362] Form templates are visual form wizards that parse the key-value pairs that can be set for Kubernetes resources and then present them visually. The principles and architecture of form templates are similar to those of editor templates.
[0363] The form conversion module is used to implement mutual conversion between YAML files received from the editor and visual forms.
[0364] For example, please refer to FIG12 , which shows a specific process of the form conversion module realizing the conversion between YAML files and forms, and the process includes the following steps.
[0365] S310, form template input form.
[0366] S321: The form conversion module parses the form to obtain a JSON file. The JSON file includes multiple key-value pairs. Each key-value pair corresponds to a form component, where the key is the name of the form component and the value is the value entered in the form component.
[0367] As a possible implementation of form parsing, the form conversion module obtains the name of each form component in the form. The form conversion module obtains the value entered in each form component. The form conversion module saves the name and input value of the same form component into the key and value of a key-value pair, respectively, to obtain a key-value pair.
[0368] As a specific example of parsing a form, a form includes a text box and a drop-down box. The name of the text box is pod name, the value entered in the text box is abc, the name of the drop-down box is image pull policy, and the option selected in the drop-down box is always. The form conversion module obtains the name of the text box and the value entered in the text box, and combines the name of the text box and the value entered in the text box into a key-value pair corresponding to the text box. The format of the key-value pair is, for example, pod name:abc.
[0369] The form conversion module obtains the name of the drop-down box and the option selected in the drop-down box, and combines the name of the drop-down box and the option selected in the drop-down box into a key-value pair corresponding to the drop-down box. The format of the key-value pair is, for example, image pull policy: always.
[0370] S322, the form conversion module converts the JSON file into a YAML file.
[0371] For example, the form conversion module reads the key-value pairs in the JSON file as JSON objects, uses a programming language that supports the YAML format, such as Python and Java, to convert the JSON objects into YAML format data, and writes the converted YAML format data into a new YAML file, overwriting or creating a new YAML file.
[0372] S323, the form conversion module outputs the YAML file and displays it in the editor.
[0373] S350: The form conversion module inputs a YAML file.
[0374] S361, the form conversion module converts the YAML file into a JSON file.
[0375] S362, the form conversion module obtains key-value pairs containing hierarchical relationships from the JSON file.
[0376] S363, the form conversion module searches for the correspondence between the parameter value type provided by the resource management center and the type of the form component based on the key-value pair.
[0377] In one possible implementation, the form conversion module searches the full key library of the parameters of the Kubernetes resource based on the key-value pair, and obtains the key in the key library that matches the key in the key-value pair. Based on the found key, the form conversion module searches for the correspondence between the parameter key and the parameter value type, and obtains the parameter value type. Based on the parameter value type, the module searches for the correspondence between the parameter value type and the type of the form component, and obtains the type of the form component. If the type of the form component is found, the following S364-a is executed. If the type of the form component is not found, the following S364-b is executed.
[0378] S364-a, the form conversion module obtains the type of the form component in the corresponding relationship, so as to generate a form based on the type of the form component.
[0379] For example, if the full key library of the Kubernetes resource parameter already stores the key and parameter value type of the user-entered parameter, the above search process can match the parameter value type stored in the library based on the key of the user-entered parameter, which helps to determine the form component that matches the parameter value type, making the form component type more consistent with the characteristics of the parameter and more accurate.
[0380] S364-b, the form conversion module obtains the default form component (such as a text input box) as the form type.
[0381] S365, the form conversion module generates a form according to the form template based on the form type obtained through S364-a or the form type obtained through S364-b.
[0382] S366, the form conversion module outputs the form.
[0383] The hierarchical relationship management module is used to process JSON files, obtain the hierarchical relationship between parameters from the JSON files, and generate a visual form containing the hierarchical relationship based on the hierarchical relationship between the parameters.
[0384] The linkage relationship management module is used to handle the linkage relationship between parameters in Kubernetes. Through the linkage relationship mapping managed by the resource management center, it identifies key-value pairs with linkage relationships and automatically adds linkage logic.
[0385] The parameter error intelligent identification service is used to perform fuzzy queries based on user-entered parameter values to obtain recommended parameter values. The parameter error intelligent identification service is also used to compare the user-entered parameter values with the recommended parameter values to determine whether the user-entered parameter values are acceptable.
[0386] The following describes an embodiment using a simplified front-end project example. The front-end project in the following example is used to implement a web application that converts between forms and YAML.
[0387] For example, the front-end project directory structure is as follows.
[0388] The following explains the meaning of the above directory structure.
[0389] Components represents the storage of application components, in the form of a folder with the path src / app / components. Components include a YAML editor and a form. The YAML editor consists of HTML, TS, and SCSS files. The HTML file editor.component.html stores the HTML template for the YAML editor. The TS file editor.component.ts stores the TypeScript code for the editor component. The TS file editor.component.ts is a component and is bidirectionally data-bound to the HTML file editor.component.html. The SCSS file editor.component.scss stores the placement and styling of DOM elements within the editor. The HTML file form.component.html stores the HTML template for the form. The TS file form.component.ts stores the TypeScript code for the form. The file form.component.scss stores the placement and styling of the DOM elements within the form component. The TS file form.component.ts is a component. The TS file form.component.ts performs two-way data binding with the HTML file form.component.html.
[0390] Services is used to store services in the application, providing functional operations such as form and YAML conversion, hierarchical relationship processing, linkage relationship processing, and error identification. By executing services, the data required by the TS file form.component.ts and the TS file editor.component.ts are processed. Services includes the TS file transform.service.ts, the TS file layer.service.ts, the TS file binding.service.ts, and the TS file paramerror.service.ts. The TS file transform.service.ts is used to implement conversion between YAML and JSON. The TS file layer.service.ts is used to implement hierarchical relationship processing. The TS file binding.service.ts is used to implement linkage relationship processing. The TS file paramerror.service.ts is used to implement parameter error identification services.
[0391] Modules are used to store the resources required for services to perform operations. The resources stored in modules are, for example, JSON files. For example, modules include the JSON file key value.json, the JSON file key form.json, the JSON file layer.json, and the JSON file binding.json. The JSON file key value.json is used to configure key-value pairs in YAML. The JSON file key form.json is used to configure key-value pairs in forms. The JSON file layer.json is used to configure the hierarchy of parameters. The JSON file binding.json is used to configure the linkage relationship of parameters. These JSON files can be provided to operation and maintenance personnel or developers. Operation and maintenance personnel or developers can modify the JSON files and add new parameters to upgrade and maintain the forms and editors.
[0392] The following example uses a positive scenario to illustrate this. A positive scenario is a scenario where the application's functionality is tested by inputting correct parameters.
[0393] The wizard creates a page flow for creating a visual form. On the page displaying the form, the user selects a creation type. The system loads the form template for the selected type and, based on the corresponding JSON file, generates a form that includes hierarchical relationships, linkage relationships, form type matching, and validation rules. The form includes wizard information, parameter explanations, and high-risk warnings. The user fills out the form according to the prompts. Clicking OK triggers the creation of the configuration file. The terminal running a browser sends the creation request. During this process, if the user finds that the parameters do not meet the requirements, they can click the "Convert Form to YAML" button displayed in the form to trigger the conversion of the form into a YAML file. In response to the conversion instruction, the system converts the form into a YAML file and presents the YAML file to the user through the YAML editing software. In the YAML editing software, the user enters the required parameters in the key:value format and then clicks the "Convert Form to YAML" button displayed in the editor to trigger the conversion of the form into a YAML file. In response to the conversion instruction, the system obtains the new parameters entered through the YAML editing software, converts the YAML file containing the new parameters into a form, and displays the form on the page. The user can then see the new parameters previously entered in the form of a visual form on the page. If the key of the new parameter matches the correspondence between the parameter key and the form type, the system generates a form component based on the type of form component corresponding to the parameter key, making the form type more accurate. If the key of the new parameter does not match the correspondence between the parameter key and the form component type, a text input box is generated by default to configure the parameter.
[0394] The following describes a scenario for creating a Kubernetes configuration file using YAML editing software.
[0395] The system implements a YAML editor based on the code mirror plug-in. The YAML editor interface appears in the browser. The user selects the creation type; the system loads the built-in YAML template; the user adds the required parameters in the editor; the YAML editor verifies the parameters are correct; the user clicks "Submit" to create the request. If the user finds any parameters unfamiliar during this process, they can click the "YAML Wizard" button in the interface. There are two possible scenarios:
[0396] Case 1: If the built-in template includes a DOM element corresponding to the parameter type input by the user, the system generates a DOM element corresponding to the parameter type.
[0397] Case 2: If the built-in template doesn't have a DOM element corresponding to the parameter type entered by the user, the system generates a DOM element using attributes and a text input box. The attributes serve as the parameter key, and the text input box is used to enter the text value. Furthermore, during the conversion process, fuzzy search technology can be used to indicate possible misspellings of the parameter.
[0398] Through the above embodiment, first, the advantages of YAML files and visual forms are complemented. The combination of the two methods not only lowers the threshold for using YAML creation, but also reduces the probability of incomplete parameter coverage in wizard-style creation.
[0399] Second, an automated form generation solution is implemented through YAML<->JSON<->form component<->wizard to reduce manual maintenance costs.
[0400] Third, the error rate of creating Kubernetes resources can be reduced by controlling the value range of Kubernetes resources through the front-end.
[0401] Fourth, automatically handle the parameter linkage process to reduce invalid redundant parameters.
[0402] Fifth, automatically handle parameter hierarchical relationships to enhance the user experience.
[0403] The present application also provides a form conversion device, as shown in FIG13 , comprising:
[0404] The receiving module is configured to receive a first configuration file and a first conversion instruction from a terminal, wherein the first conversion instruction instructs to convert the first configuration file into a first form; the converting module is configured to convert the first configuration file into the first form in response to the first conversion instruction; and the sending module is configured to send the first form to the terminal.
[0405] In one possible implementation, the configuration file includes a first parameter of a Kubernetes resource, a conversion module configured to obtain an attribute of a first form component based on the first parameter, the first form component configured to configure the first parameter, and the attribute of the first form component matching the first parameter;
[0406] A first form is obtained based on a property of the first form component, where the first form includes the first form component.
[0407] In a possible implementation, the attribute of the first form component includes at least one of a level of the first form component in the first form, a type of the first form component, an option in the first form component, a value range of the first form component, or a hierarchical relationship between the first form component and a second form component in the first form;
[0408] The properties of the first form component match the first parameter and include at least one of the following:
[0409] The hierarchy of the first form component in the first form matches the hierarchy of the first parameter in the configuration file; or,
[0410] The type of the first form component matches the value type of the first parameter; or,
[0411] The options in the first form component include candidate values for the first parameter; or,
[0412] The value range of the first form component falls within the value range of the first parameter; or,
[0413] The hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter.
[0414] In one possible implementation, the hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter, including at least one of the following:
[0415] In the case where the first parameter and the second parameter have the same level, the first form component and the second form component are in the same row or column; or, the color of the first form component is the same as the color of the second form component; or, the distance between the first form component and the interface border is the same as the distance between the second form component and the interface border; or, the size of the first form component is the same as the size of the second form component; or,
[0416] When the level of the first parameter is higher than the level of the second parameter, the first form component and the second form component are in different rows or columns; or, the color of the first form component is different from the color of the second form component; or, the distance between the first form component and the interface boundary is smaller than the distance between the second form component and the interface boundary; or, the size of the first form component is larger than the size of the second form component; or, the second form component is nested in the first form component; or, when the first form component is in the expanded state, the second form component is in the visible state, and when the first form component is in the collapsed state, the second form component is in the hidden state.
[0417] In one possible implementation, the type of the first form component matches the value type of the first parameter, including at least one of the following:
[0418] The value type of the first parameter is integer, and the type of the first form component is a numeric input box or a sliding input bar; or,
[0419] The value type of the first parameter is a string, and the type of the first form component is a text input box; or,
[0420] The value type of the first parameter is Boolean, and the type of the first form component is switch; or,
[0421] The value type of the first parameter is option, and the type of the first form component is drop-down box, radio button, or radio button; or
[0422] The value type of the first parameter is a time point, and the type of the first form component is a time selection box.
[0423] In one possible implementation, the configuration file includes an identifier of the first parameter, and the conversion module is configured to perform at least one of the following:
[0424] Obtaining a level of the first parameter based on an identifier of the first parameter and a first corresponding relationship, wherein the first corresponding relationship includes the identifier of the first parameter and the level of the first parameter; obtaining a level of the first form component based on the level of the first parameter; or,
[0425] Obtaining the level of the first parameter based on the number of indentations before the identifier of the first parameter in the configuration file or the number of target characters before the identifier of the first parameter, where the target characters include at least one of a colon, a period, or a curly brace; obtaining the level of the first form component based on the level of the first parameter; or,
[0426] Obtaining the type of the first form component based on the identifier of the first parameter and the second corresponding relationship, where the second corresponding relationship includes the identifier of the first parameter and the type of the first form component; or,
[0427] Obtaining the value type of the first parameter based on the identifier of the first parameter and a third correspondence, the third correspondence including the identifier of the first parameter and the value type of the first parameter; obtaining the type of the first form component based on the value type of the first parameter and a fourth correspondence, the fourth correspondence including the value type of the first parameter and the type of the first form component; or
[0428] Obtaining a candidate value for the first parameter based on the identifier of the first parameter and the fifth correspondence, wherein the fifth correspondence includes the identifier of the first parameter and the candidate value for the first parameter; obtaining options in the first form component based on the candidate value for the first parameter, wherein the options in the first form component include the candidate value for the first parameter; or,
[0429] Obtaining a threshold value of the first parameter based on the identifier of the first parameter and the sixth corresponding relationship, wherein the sixth corresponding relationship includes the identifier of the first parameter and the threshold value of the first parameter; obtaining a value range of the first form component based on the threshold value of the first parameter; or,
[0430] A threshold value of a first parameter is obtained from a first configuration file, and a value range of a first form component is obtained based on the threshold value of the first parameter.
[0431] In one possible implementation, the configuration file includes a first parameter of the Kubernetes resource, and a conversion module is used to obtain the attributes of the second form component based on the first parameter and a seventh correspondence, the seventh correspondence includes the first parameter and the second parameter of the Kubernetes resource, the second form component is used to configure the second parameter, and the attributes of the second form component match the second parameter; based on the attributes of the first form component and the attributes of the second form component, a first form is obtained, and the first form includes a first form component and a second form component.
[0432] In one possible implementation, the configuration file includes the value of the first parameter, and the conversion module is used to obtain the value type of the second parameter of the Kubernetes resource based on the value of the first parameter and the seventh correspondence, the seventh correspondence includes the value of the first parameter and the value type of the second parameter; obtain the type of the second form component based on the value type of the second parameter and the eighth correspondence, the eighth correspondence includes the value type of the second parameter and the type of the second form component; or, based on the value of the first parameter and the seventh correspondence, obtain the candidate value of the second parameter of the Kubernetes resource, the seventh correspondence includes the value of the first parameter and the candidate value of the second parameter; obtain options in the second form component based on the candidate value of the second parameter, the options in the second form component include the candidate value of the second parameter; or, based on the value of the first parameter and the seventh correspondence, obtain the value range of the second parameter of the Kubernetes resource, the seventh correspondence includes the value of the first parameter and the value range of the second parameter; obtain the value range of the second form component based on the value range of the second parameter, and the value range of the second form component falls within the value range of the second parameter.
[0433] In a possible implementation, the configuration file includes an identifier of the first parameter, and the apparatus further includes:
[0434] a query module, configured to query a parameter identifier library based on the identifier of the first parameter, the parameter identifier library being configured to store a correctly spelled identifier of at least one parameter of a Kubernetes resource;
[0435] A recommendation module is configured to recommend a target parameter identifier in response to searching the parameter identifier library for a target parameter identifier that satisfies a fuzzy matching condition with the identifier of the first parameter; or
[0436] The output module is configured to output a prompt message in response to each parameter identifier in the parameter identifier library not matching the identifier of the first parameter, wherein the prompt message indicates that there is a spelling error in the identifier of the first parameter.
[0437] In a possible implementation, the conversion module is further configured to convert the second form into a second configuration file in response to a second conversion instruction; and the sending module is further configured to send the second configuration file.
[0438] The conversion module, receiving module, and sending module can all be implemented in software or hardware. For example, the implementation of the conversion module will be described below using the conversion module as an example. Similarly, the implementation of the receiving module and sending module can refer to the implementation of the conversion module.
[0439] As an example of a software functional unit, a conversion module may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the conversion module may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.
[0440] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.
[0441] As an example of a hardware functional unit, a conversion module may include at least one computing device, such as a server. Alternatively, the conversion module may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0442] The multiple computing devices included in the conversion module can be distributed in the same region or in different regions. They can also be distributed in the same AZ or in different AZs. Similarly, they can be distributed in the same VPC or across multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.
[0443] The present embodiment also provides a computing device 800. As shown in FIG14 , computing device 800 includes a bus 802, a processor 804, a memory 806, and a communication interface 808. Processor 804, memory 806, and communication interface 808 communicate with each other via bus 802. Computing device 800 can be a server or a terminal device. The present embodiment does not limit the number of processors and memories in computing device 800.
[0444] Bus 802 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG14 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 804 may include a path for transmitting information between various components of computing device 800 (e.g., memory 806, processor 804, and communication interface 808).
[0445] The processor 804 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0446] The memory 806 may include volatile memory, such as random access memory (RAM). The processor 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0447] Memory 806 stores executable program code, and processor 804 executes the executable program code to implement the functions of the aforementioned receiving module, conversion module, and sending module, thereby implementing the method for converting a configuration file into a form. In other words, memory 806 stores instructions for executing the method for converting a configuration file into a form.
[0448] The communication interface 803 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.
[0449] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0450] As shown in Figure 15, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the method for converting a configuration file into a form.
[0451] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the method for converting a configuration file into a form. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for executing the method for converting a configuration file into a form.
[0452] The memory 806 in different computing devices 800 in the computing device cluster may store different instructions, each for executing a portion of the functions of the form conversion system. In other words, the instructions stored in the memory 806 in different computing devices 800 may implement the functions of one or more of the receiving module, the conversion module, and the sending module.
[0453] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network (WAN) or a local area network (LAN), among others. FIG. 16 illustrates a possible implementation. As shown in FIG. 16 , two computing devices 800A and 800B are connected via a network. Specifically, the connection to the network is achieved via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the conversion module. Simultaneously, the memory 806 in the computing device 800B stores instructions for executing the functions of the receiving module and the sending module.
[0454] The connection method between the computing device clusters shown in Figure 16 can be that considering that the configuration file conversion method provided in this application requires a large amount of data storage, it is considered to hand over the functions implemented by the conversion module to the computing device 800A for execution.
[0455] 16 may also be implemented by multiple computing devices 800. Similarly, the functionality of computing device 800B may also be implemented by multiple computing devices 800.
[0456] The present application also provides another computing device cluster. The connection relationship between the computing devices in this computing device cluster can be similar to the connection method of the computing device clusters shown in Figures 15 and 16. However, the difference is that the memory 806 of one or more computing devices 800 in this computing device cluster can store the same instructions for executing the configuration file to form conversion method.
[0457] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the configuration file to form conversion method. In other words, the combination of one or more computing devices 800 can jointly execute the instructions for executing the configuration file to form conversion method.
[0458] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster may store different instructions for executing the partial function of converting the configuration file into a form. In other words, the instructions stored in the memory 806 in different computing devices 800 may implement the functions of one or more means of the receiving module, the converting module, and the sending module.
[0459] The present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored on any available medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to execute a method for converting a configuration file into a form, or vice versa.
[0460] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute a method for converting a configuration file into a form, or instruct the computing device to execute a method for converting a configuration file into a form.
[0461] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0462] It should be understood that in this application, "at least one (item)" means one or more, and "more" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.
[0463] It should also be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprise," "include," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0464] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0465] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one 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 application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.< / form>
Claims
1. A form conversion method, characterized in that: The method comprises: A terminal display interface, the interface including an editing area and a first conversion button; The terminal obtains a first configuration file based on an input operation triggered on the editing area; In response to the operation of triggering the first conversion button, the terminal sends the first configuration file and a first conversion instruction to the server, where the first conversion instruction instructs to convert the first configuration file into a first form; The server converts the first configuration file into a first form in response to the first conversion instruction; The server sends the first form to the terminal.
2. The method according to claim 1, characterized in that The configuration file includes a first parameter of a Kubernetes resource, and converting the first configuration file into a first form includes: Obtaining an attribute of a first form component based on the first parameter, where the first form component is used to configure the first parameter, and the attribute of the first form component matches the first parameter; A first form is obtained based on the properties of the first form component, where the first form includes the first form component.
3. The method according to claim 2, characterized in that The attributes of the first form component include at least one of a level of the first form component in the first form, a type of the first form component, options in the first form component, a value range of the first form component, or a hierarchical relationship between the first form component and a second form component in the first form; The properties of the first form component match the first parameter, including at least one of the following: The level of the first form component in the first form matches the level of the first parameter in the configuration file; or, The type of the first form component matches the value type of the first parameter; or, The options in the first form component include candidate values for the first parameter; or, The value range of the first form component falls within the value range of the first parameter; or, The hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter.
4. The method according to claim 3, characterized in that The hierarchical relationship between the first form component and the second form component matches the hierarchical relationship between the first parameter and the second parameter, including at least one of the following: In the case where the first parameter and the second parameter have the same level, the first form component and the second form component are in the same row or column; or, the color of the first form component is the same as the color of the second form component; or, the distance between the first form component and the interface border is the same as the distance between the second form component and the interface border; or, the size of the first form component is the same as the size of the second form component; or, In the case where the level of the first parameter is higher than the level of the second parameter, the first form component and the second form component are in different rows or columns; or, the color of the first form component is different from the color of the second form component; Alternatively, the distance between the first form component and the interface boundary is smaller than the distance between the second form component and the interface boundary; alternatively, the size of the first form component is larger than the size of the second form component; alternatively, the second form component is nested within the first form component; alternatively, the first form component is in an expanded state and the second form component is in a visible state, and the first form component is in a folded state and the second form component is in a hidden state.
5. The method according to claim 3, characterized in that The type of the first form component matches the value type of the first parameter, including at least one of the following: The value type of the first parameter is integer, and the type of the first form component is a numeric input box or a sliding input bar; or The value type of the first parameter is a string, and the type of the first form component is a text input box; or The value type of the first parameter is Boolean, and the type of the first form component is switch; or The value type of the first parameter is an option, and the type of the first form component is a drop-down box, a radio button, or a radio button; or The value type of the first parameter is a time point, and the type of the first form component is a time selection box.
6. The method according to at least one of claims 2 to 5, characterized in that The configuration file includes an identifier of the first parameter, and obtaining the attribute of the first form component based on the first parameter includes at least one of the following: Obtaining a level of the first parameter based on an identifier of the first parameter and a first corresponding relationship, where the first corresponding relationship includes the identifier of the first parameter and the level of the first parameter; Obtaining the level of the first form component based on the level of the first parameter; or, Obtaining the level of the first parameter based on the number of indentations before the identifier of the first parameter in the configuration file or the number of target characters before the identifier of the first parameter, wherein the target characters include at least one of a colon, a period, or a curly bracket; obtaining the level of the first form component based on the level of the first parameter; or Obtaining the type of the first form component based on the identifier of the first parameter and a second corresponding relationship, where the second corresponding relationship includes the identifier of the first parameter and the type of the first form component; or, obtaining a value type of the first parameter based on the identifier of the first parameter and a third correspondence, wherein the third correspondence includes the identifier of the first parameter and the value type of the first parameter; obtaining a type of the first form component based on the value type of the first parameter and a fourth correspondence, wherein the fourth correspondence includes the value type of the first parameter and the type of the first form component; or obtaining a candidate value of the first parameter based on the identifier of the first parameter and a fifth corresponding relationship, wherein the fifth corresponding relationship includes the identifier of the first parameter and the candidate value of the first parameter; obtaining options in the first form component based on the candidate value of the first parameter, wherein the options in the first form component include the candidate value of the first parameter; or Obtaining a threshold value of the first parameter based on the identifier of the first parameter and a sixth corresponding relationship, wherein the sixth corresponding relationship includes the identifier of the first parameter and the threshold value of the first parameter; obtaining a value range of the first form component based on the threshold value of the first parameter; or, A threshold value of the first parameter is obtained from the first configuration file, and a value range of the first form component is obtained based on the threshold value of the first parameter.
7. The method according to any one of claims 1 to 6, characterized in that The configuration file includes a first parameter of a Kubernetes resource, and converting the first configuration file into a first form includes: Obtaining attributes of a second form component based on the first parameter and a seventh correspondence, where the seventh correspondence includes the first parameter and a second parameter of the Kubernetes resource, the second form component is used to configure the second parameter, and the attributes of the second form component match the second parameter; A first form is obtained based on the properties of the first form component and the properties of the second form component, where the first form includes the first form component and the second form component.
8. The method according to claim 7, characterized in that The configuration file includes the value of the first parameter, and obtaining the attribute of the second form component based on the first parameter and the seventh correspondence includes at least one of the following: Based on the value of the first parameter and a seventh correspondence, obtaining a value type of a second parameter of the Kubernetes resource, the seventh correspondence including the value of the first parameter and the value type of the second parameter; based on the value type of the second parameter and an eighth correspondence, obtaining a type of the second form component, the eighth correspondence including the value type of the second parameter and the type of the second form component; or Based on the value of the first parameter and a seventh correspondence, obtaining a candidate value for a second parameter of the Kubernetes resource, the seventh correspondence including the value of the first parameter and the candidate value of the second parameter; based on the candidate value of the second parameter, obtaining options in the second form component, the options in the second form component including the candidate value of the second parameter; or, Based on the value of the first parameter and the seventh correspondence, a value range of the second parameter of the Kubernetes resource is obtained, where the seventh correspondence includes the value of the first parameter and the value range of the second parameter; based on the value of the second parameter The value range obtains the value range of the second form component, and the value range of the second form component falls within the value range of the second parameter.
9. The method according to any one of claims 1 to 8, characterized in that The configuration file includes an identifier of the first parameter, and the method further includes: Performing a query based on the identifier of the first parameter in a parameter identifier library, where the parameter identifier library is used to store a correctly spelled identifier of at least one parameter of the Kubernetes resource; In response to finding a target parameter identifier that satisfies a fuzzy matching condition with the identifier of the first parameter in the parameter identifier library, recommending the target parameter identifier; or In response to each parameter identifier in the parameter identifier library not matching the identifier of the first parameter, a prompt message is output, wherein the prompt message indicates that there is a spelling error in the identifier of the first parameter.
10. The method according to any one of claims 1 to 9, characterized in that After the server sends the first form to the terminal, the method further includes: The terminal displays the first form and the second conversion button; The terminal obtains a second form modified based on the first form in response to a modification operation on the first form; In response to the operation of triggering the second conversion button, the terminal sends the second form and a second conversion instruction to the server, where the second conversion instruction instructs to convert the second form into a second configuration file; The server converts the second form into a second configuration file in response to the second conversion instruction; The server sends the second configuration file to the terminal.
11. A form conversion method, characterized in that: The method comprises: The server receives a first configuration file and a first conversion instruction from a terminal, wherein the first conversion instruction instructs to convert the first configuration file into a first form; The server converts the first configuration file into a first form in response to the first conversion instruction; The server sends the first form to the terminal.
12. A server, characterized in that: The server includes at least one processor and at least one memory, wherein computer program instructions are stored in the at least one memory; the at least one processor executes the computer program instructions, so that the server performs the method according to claim 11.
Citation Information
Patent Citations
Efficient Web form validation method and framework thereof
CN102426549A
Interface generation method and device based on content management system, equipment and storage medium
CN112631564A
Web system and method for realizing Hadoop platform parameter dynamic tuning
CN116009866A
Form conversion method and server
CN116956825A
Method and system for providing service to user
CN1913442A
Cited By
Enhanced automatic form processing using a knowledge graph data strucrture and a large language model
US20250278558A1
