CN116956825A - Form conversion method and server - Google Patents

Form conversion method and server Download PDF

Info

Publication number
CN116956825A
CN116956825A CN202310747036.5A CN202310747036A CN116956825A CN 116956825 A CN116956825 A CN 116956825A CN 202310747036 A CN202310747036 A CN 202310747036A CN 116956825 A CN116956825 A CN 116956825A
Authority
CN
China
Prior art keywords
parameter
form component
value
identification
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310747036.5A
Other languages
Chinese (zh)
Inventor
李红雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
XFusion Digital Technologies Co Ltd
Original Assignee
XFusion Digital Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by XFusion Digital Technologies Co Ltd filed Critical XFusion Digital Technologies Co Ltd
Priority to CN202310747036.5A priority Critical patent/CN116956825A/en
Publication of CN116956825A publication Critical patent/CN116956825A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The application discloses a form conversion method and a server, wherein the method comprises the following steps: the terminal display interface comprises an editing area and a first conversion button; the terminal acquires a first configuration file based on the input operation triggered by the editing area; the terminal responds to the operation triggered by the first conversion button and sends a first configuration file and a first conversion instruction to the server, wherein the first conversion instruction indicates that the first configuration file is converted into a first form; the server responds to the first conversion instruction and converts the first configuration file into a first form; the server sends a first form to the terminal. By converting the configuration file into a form, the user is supported to configure the values of the parameters by filling in the form, and the user is not required to have deep knowledge of the grammar and format of the YAML, so that the use threshold caused when the YAML editing software is used for creating the resource configuration file is reduced, and the probability of configuration failure is reduced.

Description

Form conversion method and server
Technical Field
The application relates to the field of servers, in particular to a form conversion method and a server.
Background
With the development of computing devices and cloud computing technologies, some container scheduling systems are capable of automatically configuring resources based on parameters contained in resource configuration files in the data serialization language (YAML ain't markup language, YAML) format, and further scheduling containers based on the configured resources.
Currently, yacl editing software is commonly used to create resource profiles. However, the probability of resource parameter configuration errors is high in this way.
Disclosure of Invention
The embodiment of the application provides a form conversion method and a server, which can reduce the probability of resource configuration errors. The technical proposal is as follows.
In a first aspect, a form conversion method is provided, the method including: the terminal displays an interface, wherein the interface comprises an editing area and a first conversion button; the terminal acquires a first configuration file based on the input operation triggered by the editing area; the terminal responds to the operation triggered by the first conversion button and sends the first configuration file and a first conversion instruction to a server, wherein the first conversion instruction indicates that the first configuration file is converted into a first form; the server responds to the first conversion instruction and converts the first configuration file into a first form; and the server sends the first form to the terminal.
By converting the configuration file into a form, the user is supported to configure the values of the parameters by filling in the form, and the user is not required to have deep knowledge of the grammar and format of the YAML, so that the use threshold caused when the YAML editing software is used for creating the resource configuration file is reduced, and the probability of configuration failure is reduced.
The first profile is, for example, a profile. The first configuration file is, for example, a YAML file or a JavaScript object notation (JavaScript object notation, JSON) file. The edit field is an interactable field for displaying and editing a configuration file, allowing a user to input YAML grammar and make modifications and adjustments thereto. The convert button is used to trigger an instruction to convert the configuration file into a form. For example, the edit field is typically a text box or text field that provides the user with the ability to write and modify YAML code. The first form is, for example, a single form or a combination of forms. Forms (forms) are an interactive element for collecting user input. Forms allow users to submit data to a web page and send the data to a server for processing. Forms typically contain elements such as input fields, selection boxes, buttons, etc., in which a user may enter or select data. Forms are defined by < form > tags using hypertext markup language (hypertext markup language, HTML) that contain the form data to be submitted and information on how to process the data. The forms may use different hypertext transfer protocol (hypertext transfer protocol, HTTP) methods (e.g., GET or POST) to send the data. The input fields in the form may be text boxes, password boxes, radio buttons, check boxes, drop down lists, and the like. Each input field may have an associated tag that describes the purpose or description of the field. By using different labels and attributes, a developer 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 side may use various programming languages and techniques to receive and process such data. The first conversion button is used for triggering an instruction for converting the configuration file into a form.
In one possible implementation, the configuration file includes a first parameter of a Kubernetes resource, and the converting the first configuration file into the first form includes: obtaining an attribute of a first form component based on the first parameter, wherein the first form component is used for configuring the first parameter, and the attribute of the first form component is matched with the first parameter; a first form is obtained based on the attributes of the first form component, the first form including the first form component.
Illustratively, the attribute of the first form component includes at least one of a hierarchy of the first form component in the first form, a type of the first form component, an option in the first form component, a range of values of the first form component, or a hierarchical relationship between the first form component and a second form component in the first form.
The configuration file is converted into the form by utilizing the corresponding relation between the parameters of the Kubernetes resource and the attributes of the form component, so that the form is created based on which parameters are not required to be preset by the front end, the parameters based on which the form is created are determined through the parameters received from the terminal and the corresponding relation, and the function of converting the form can be updated by updating and maintaining the corresponding relation along with the upgrading evolution of the container system, thereby improving the flexibility and the expandability and reducing the cost of updating and maintaining.
Illustratively, the attribute of the first form component matches the first parameter, including: the hierarchy of the first form component in the first form matches the hierarchy of the first parameter in the configuration file.
In one possible implementation, the first form component has the same level in the first form as the first parameter has in the configuration file. For example, for a parameter in the YAML file, the level at which the parameter is located in the YAML file is determined as the level at which the form component corresponding to the parameter is located in the form.
In another possible implementation, the level of the first parameter in the configuration file is less than the level of the first form component in the first form. For one parameter in the YAML file, determining the level of the parameter in the YAML file, and taking the difference between the level and the set number as the level of the form component corresponding to the parameter in the form.
By the method, the function of hierarchical relation mapping is realized, the hierarchical relation among the parameters in the YAML file can be mapped into the hierarchical relation among the parameters in the form, the hierarchical relation among the parameters can be visually represented in the interface by the converted form, the hierarchical relation among the parameters is more visual and clear, the probability of configuration failure caused by the hierarchical error once the hierarchical error is caused due to the fact that the hierarchical relation is strictly controlled according to the specific retraction quantity when the YAML file is configured is reduced, and user experience is improved.
In one possible implementation, the matching of the attribute of the first form component with the first parameter includes: the type of the first form component matches the value type of the first parameter.
Illustratively, the type of the first form component matches the value type of the first parameter, including at least one of:
the value type of the first parameter is integer, and the type of the first form component is a digital input box or a sliding input bar; or alternatively, the process may be performed,
the value type of the first parameter is a character string, and the type of the first form component is a text input box; or alternatively, the process may be performed,
the value type of the first parameter is Boolean, and the type of the first form component is a switch; or alternatively, the process may be performed,
the value type of the first parameter is an option, and the type of the first form component is a drop-down frame, a single selection frame or a single selection frame; or alternatively, the process may be performed,
the value type of the first parameter is a time point, and the type of the first form component is a time selection box.
In this way, due to the fact that the type of the parameter value of Kubernetes is considered when the form component is generated, the type of the generated form component is matched with the type of the parameter value of Kubernetes, the type of the form component has a limiting effect on the parameter input by the user, which is equivalent to limiting the type of the parameter value input by the user to the type of the form component, for example, when the type of the parameter value is an option, the type of the form component is a drop-down box, for example, the user needs to select the parameter value from the options in the drop-down box, so that compared with any parameter value input in a text input box, the range of the parameter value configured by the user is limited, and the configuration error probability is reduced.
Illustratively, the attribute of the first form component matches the first parameter, including: options in the first form component include candidate values for the first parameter.
By the method, the function of mapping between the parameters of the Kubernetes resource and the options included in the form component is realized, the form component including the option set can be generated based on the identification of the Kubernetes resource, and the option set in the form component is matched with the identification of the Kubernetes resource, so that the range of values configured by a user is limited in the option set, and the probability of non-selectable value errors is reduced.
Illustratively, the attribute of the first form component matches the first parameter, including: the value range of the first form component falls into the value range of the first parameter.
By the method, the threshold value range of the Kubernetes resource is considered when the form component is generated, and the generated form component allows the configured threshold value range to be matched with the parameter value threshold value range, so that the parameter value input by a user is prevented from exceeding the threshold value range, and the risk of overrun errors is further reduced.
Illustratively, 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.
Through the mode, the function of hierarchical relation mapping is realized, the hierarchical relation among the parameters in the YAML file can be mapped into the hierarchical relation among the parameters in the form, the hierarchical relation among the parameters can be visually represented in the interface by the converted form, and the hierarchical relation among the parameters is more visual and clear.
Illustratively, 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:
in the case where the first parameter and the second parameter have the same hierarchy, the first form component and the second form component are in the same row or the same column; alternatively, 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 boundary is the same as the distance between the second form component and the interface boundary; alternatively, the first form component is the same size as the second form component; or alternatively, the process may be performed,
in the case where the first parameter is higher in level than the second parameter, the first form component and the second form component are in different rows or different columns; alternatively, 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; alternatively, the first form component has a size that is greater than the size of the second form component; alternatively, the second form component is nested within the first form component; or the first form component is in an unfolding state, the second form component is in a visible state, the first form component is in a folding state, and the second form component is in a hiding state.
By the method, multiple hierarchical relation mapping implementation modes are provided, the hierarchical relation among parameters is more visual and clear, the probability that the configuration fails due to the fact that the hierarchical relation is controlled strictly according to the specific retraction quantity when the YAML file is configured is reduced, and user experience is improved once the retraction quantity is wrong, the probability that the configuration fails due to the fact that the retraction quantity is wrong is improved. Further, since the hierarchical relationship between form components is generated by the server without requiring the user to input the setback control hierarchical relationship in the YAML editing software, the probability of the input setback error causing the hierarchical error is reduced, and the probability of the hierarchical error causing the configuration failure is reduced. In addition, because the hierarchical relationship between the form components is generated based on the hierarchical relationship between the parameters in the Kubernetes, the user can understand the relationship between the parameters according to the hierarchical relationship between the form components, such as which parameter is a sub-parameter of which parameter, so that the user can fill in the form more conveniently, thereby improving usability.
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: obtaining a hierarchy of the first parameter based on the identification of the first parameter and a first correspondence, wherein the first correspondence comprises the identification of the first parameter and the hierarchy of the first parameter; a hierarchy of the first form component is obtained based on the hierarchy of the first parameter.
Because the functions are realized by utilizing the identifiers of the parameters and the corresponding relation among the parameter levels, when new Kubernetes parameters are needed to be added, the identifiers of the newly added parameters and the parameter levels are added into the corresponding relation, so that form components with matched types can be generated aiming at the newly added parameters, when original parameters are needed to be modified, the identifiers of the parameters and the parameter levels are modified into the corresponding relation, and the original corresponding relation can be modified, thereby reducing the maintenance, updating and upgrading costs and improving the flexibility and the expandability.
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: obtaining a hierarchy of the first parameter based on a number of indents before identification of the first parameter or a number of target characters before identification of the first parameter in the configuration file, the target characters including at least one of a colon, a dot number, or a bracket; a hierarchy of the first form component is obtained based on the hierarchy of the first parameter.
Flexibility is improved by performing hierarchical mapping based on the number of indents or the number of characters.
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: and obtaining the type of the first form component based on the identification of the first parameter and a second corresponding relation, wherein the second corresponding relation comprises the identification of the first parameter and the type of the first form component.
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: obtaining a value type of the first parameter based on the identification of the first parameter and a third corresponding relation, wherein the third corresponding relation comprises the identification of the first parameter and the value type of the first parameter; and obtaining the type of the first form component based on the value type of the first parameter and a fourth corresponding relation, wherein the fourth corresponding relation comprises the value type of the first parameter and the type of the first form component.
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: obtaining a candidate value of the first parameter based on the identification of the first parameter and a fifth corresponding relation, wherein the fifth corresponding relation comprises the identification of the first parameter and the candidate value of the first parameter; options in the first form component are obtained based on the candidate value of the first parameter, the options in the first form component including the candidate value of the first parameter.
By the implementation mode, the candidate values of the parameters are mapped with the options of the form component by taking the candidate values of the Kubernetes parameters into consideration when the form component is generated, so that the range of the values which can be input by a user in the form component is limited within the allowed option set, and the probability of non-selectable value errors is reduced
In one possible implementation, the configuration file includes an identification of the first parameter, and the obtaining the attribute of the first form component based on the first parameter includes: obtaining a threshold value of the first parameter based on the identification of the first parameter and a sixth corresponding relation, wherein the sixth corresponding relation comprises the identification 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.
By the method, the matched form component is generated based on the threshold range of the parameter values, so that the parameter values input by a user are prevented from exceeding the threshold range, and the risk of overrun errors is reduced.
In one possible implementation, the configuration file includes a first parameter of a Kubernetes resource, and the converting the first configuration file into the first form includes: obtaining an attribute of a second form component based on the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the first parameter and a second parameter of the Kubernetes resource, the second form component is used for configuring the second parameter, and the attribute of the second form component is matched with the second parameter; a first form is obtained 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.
In one possible implementation, the configuration file includes a value of the first parameter, and the obtaining the attribute of the second form component based on the first parameter and the seventh correspondence includes: obtaining a value type of a second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the value of the first parameter and the value type of the second parameter; and obtaining the type of the second form component based on the value type of the second parameter and an eighth corresponding relation, wherein the eighth corresponding relation comprises the value type of the second parameter and the type of the second form component.
Through the implementation manner, the linkage relation between the parameters in the configuration file can be mapped into the linkage relation of the form components in the form, so that after the value of the parameter A is configured, the type of the form component corresponding to the parameter B can be changed along with the value of the parameter A, and therefore, the configuration range of the value of the parameter B can be limited based on the form component, which is equivalent to the way of forcing a user to select and input in a correct mode based on the form component of a specific type, and the probability of configuration errors of the parameter B is reduced, so that the configuration method is easier to use.
In one possible implementation, the dependencies between parameters are considered when determining the hierarchical presentation of the form components. For example, the first parameter is displayed or hidden according to the value of the second parameter. For example, if the first form component is selected or a particular value is entered into the first form component, the second parameter is displayed, otherwise the second parameter is hidden. This may dynamically adjust the visibility of the form based on user selections and inputs. Or the second parameter may be enabled or disabled depending on the selection of the first parameter. For example, if a first form component is selected, a second form component is enabled, allowing the user to edit; otherwise, the second form component is disabled and the user is not allowed to edit. This allows the editability of the form to be dynamically adjusted according to the user's selection.
In one possible implementation, the configuration file includes a value of the first parameter, and the obtaining the attribute of the second form component based on the first parameter and the seventh correspondence includes: obtaining a candidate value of the second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the value of the first parameter and the candidate value of the second parameter; options in the second form component are obtained based on the candidate value of the second parameter, the options in the second form component including the candidate value of the second parameter.
By the implementation manner, since the type of the parameter value of Kubernetes is considered when the form component is generated, the type of the generated form component is matched with the type of the parameter value of Kubernetes, the type of the form component has a limiting effect on the parameter input by the user, which is equivalent to limiting the type of the parameter value input by the user to the type of the form component, for example, when the type of the parameter value is an option, for example, a drop-down box, the user needs to select the parameter value from the option in the drop-down box, so that compared with any parameter value input in a text input box, the range of the parameter value configured by the user is limited, and the configuration error probability is reduced.
In one possible implementation, the configuration file includes a value of the first parameter, and the obtaining the attribute of the second form component based on the first parameter and the seventh correspondence includes: obtaining a value range of a second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the value of the first parameter and the value range of the second parameter; and obtaining the value range of the second form component based on the value range of the second parameter, wherein the value range of the second form component falls into the value range of the second parameter.
In one possible implementation, the configuration file includes an identification of the first parameter, and the method further includes: inquiring in a parameter identification library based on the identification of the first parameter, wherein the parameter identification library is used for storing identification of correct spelling of at least one parameter of the Kubernetes resource; and recommending the target parameter identification in response to the fact that the target parameter identification meeting the fuzzy matching condition with the identification of the first parameter is inquired in the parameter identification library.
Through parameter identification recommendation, parameter identification to be input can be automatically and intelligently recommended to a user in the process of editing the YAML file by the user, so that the operation complexity is further reduced, and the user can recommend the parameter identification in real time when performing the input operation, so that the timeliness is better.
In one possible implementation, the configuration file includes an identification of the first parameter, and the method further includes: inquiring in a parameter identification library based on the identification of the first parameter, wherein the parameter identification library is used for storing identification of correct spelling of at least one parameter of the Kubernetes resource; and outputting prompt information in response to each parameter identifier in the parameter identifier library not being matched with the identifier of the first parameter, wherein the prompt information indicates that the spelling of the identifier of the first parameter is wrong.
Because of performing misspell checksum prompt, users can know and solve the problem of misspell in time, thereby reducing the probability of parameter configuration errors.
In one possible implementation, 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 responds to the modification operation of the first form to obtain a second form modified based on the first form; the terminal responds to the operation triggered by the second conversion button and sends the second form and a second conversion instruction to a server, wherein the second conversion instruction indicates that the second form is converted into a second configuration file; the server responds to the second conversion instruction and converts the second form into a second configuration file; and the server sends the second configuration file to the terminal.
The second configuration file is, for example, a YAML file or a JSON file.
The second conversion button is used for triggering an instruction for converting the form into a configuration file.
Considering that the types of the Kubernetes resources and the parameters configured in the Kubernetes resources are too many, the length of the page of the form is limited, and the probability that the form contains an input box corresponding to each parameter in all the parameters in the Kubernetes is low, so that when the parameters are configured through the form, it may be difficult to cover all the parameters in the Kubernetes, and the parameter configuration is not comprehensive enough. Through the implementation manner, when a user creates the Kubernetes resource configuration file by using the form, if no input box corresponding to the parameters to be configured is found in the form, the form can be converted into the YAML file through the indication system, and the parameters to be configured are input in the YAML file, so that the comprehensiveness of parameter configuration is improved.
In a second aspect, a form conversion method is provided, the method including:
the method comprises the steps that a server receives a first configuration file from a terminal and a first conversion instruction, wherein the first conversion instruction indicates that the first configuration file is converted into a first form;
the server responds to the first conversion instruction and converts the first configuration file into a first form;
And the server sends the first form to the terminal.
By converting the configuration file into a form, the user is supported to configure the values of the parameters by filling in the form, and the user is not required to have deep knowledge of the grammar and format of the YAML, so that the use threshold caused when the YAML editing software is used for creating the resource configuration file is reduced, and the probability of configuration failure is reduced.
In a third aspect, a server is provided, the server comprising at least one processor and at least one memory, the at least one memory having computer program instructions stored therein; the at least one processor executes the computer program instructions to cause the server to perform the method of the second aspect described above.
In a fourth aspect, a computing device cluster is provided, the computing device cluster comprising a plurality of computing devices, each computing device comprising a processor and a memory; the processors of the plurality of computing devices are configured to execute instructions stored in the memories of the plurality of computing devices to cause the cluster of computing devices to perform the method as described in the second aspect.
In a fifth aspect, there is provided a form conversion apparatus, the system comprising:
The receiving module is used for receiving a first configuration file from the terminal and a first conversion instruction, wherein the first conversion instruction indicates that the first configuration file is converted into a first form; the conversion module is used for responding to the first conversion instruction and converting the first configuration file into a first form; and the sending module is used for sending the first form to the terminal.
The conversion module, the receiving module and the transmitting module can be realized by software or can be realized by hardware. Illustratively, the implementation of the conversion module is described next by taking the conversion module as an example. Similarly, the implementation of the receiving module and the transmitting module may refer to the implementation of the converting module.
Modules as an example of a software functional unit, the conversion module may include code that runs on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container, among others. Further, the above-described computing examples may be one or more. For example, the translation module may include code that runs on multiple hosts/virtual machines/containers. It should be noted that, multiple hosts/virtual machines/containers for running the code may be distributed in the same region (region), or may be distributed in different regions. Further, multiple hosts/virtual machines/containers for running the code may be distributed in the same availability zone (availability zone, AZ) or may be distributed in different AZs, each AZ comprising a data center or multiple geographically close data centers. Wherein typically a region may comprise a plurality of AZs.
Also, multiple hosts/virtual machines/containers for running the code may be distributed in the same virtual private cloud (virtual private cloud, VPC) or in multiple VPCs. In general, one VPC is disposed in one region, and a communication gateway is disposed in each VPC for implementing inter-connection between VPCs in the same region and between VPCs in different regions.
Modules as an example of hardware functional units, the conversion module may include at least one computing device, such as a server or the like. Alternatively, the conversion module may be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD), etc. The PLD may be implemented as a complex program logic device (complex programmable logical device, CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL), or any combination thereof.
Multiple computing devices included in the conversion module may be distributed in the same region or may be distributed in different regions. The plurality of computing devices included in the conversion module may be distributed in the same AZ or may be distributed in different AZ. Also, the plurality of computing devices included in the conversion module may be distributed in the same VPC, or may be distributed in a plurality of VPCs. Wherein the plurality of computing devices may be any combination of computing devices such as servers, ASIC, PLD, CPLD, FPGA, and GAL.
In a sixth aspect, there is provided a computer readable storage medium having stored therein at least one instruction which when executed on a computer causes the computer to perform the method provided in the second aspect or any of the alternatives of the second aspect.
In a seventh aspect, there is provided a computer program product comprising one or more computer program instructions which, when loaded and run by a computer, cause the computer to carry out the method as provided in the second aspect or any of the alternatives of the second aspect described above.
In an eighth aspect, a chip is provided, comprising a memory for storing computer instructions and a processor for calling and executing the computer instructions from the memory to perform the method of the second aspect and any possible implementation of the second aspect.
Drawings
FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 2 is a flowchart of a form conversion method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an interface between YAML file and form conversion according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an interface of YAML editing software provided by an embodiment of the present application;
FIG. 5 is a schematic illustration of a form interface provided by an embodiment of the present application;
FIG. 6 is a flowchart of a form conversion method provided by an embodiment of the present application;
FIG. 7 is a flowchart of a form conversion method according to an embodiment of the present application;
FIG. 8 is a flowchart of a form conversion method provided by an embodiment of the present application;
FIG. 9 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 10 is a flowchart of a form conversion method provided by an embodiment of the present application;
FIG. 11 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 12 is a flowchart of a form conversion method provided by an embodiment of the present application;
FIG. 13 is a schematic diagram of a form switching device according to an embodiment of the present application;
FIG. 14 is a schematic diagram of a computing device provided by an embodiment of the present application;
FIG. 15 is a schematic diagram of a computing device cluster architecture according to an embodiment of the present application;
fig. 16 is a schematic architecture diagram of a computing device cluster according to an embodiment of the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of embodiments of the application will be rendered by reference to the appended drawings and appended drawings.
Some term concepts related to some embodiments of the present application are explained below.
(1)Kubernetes
Kubernetes, also known as K8s or kube, is an open-source container dispatch platform for automatically deploying, expanding, and managing containerized applications.
(2) Kubernetes resource
Kubernetes resources refer to resources in Kubernetes that are used to deploy, run, or manage an application. Kubernetes resources may also be referred to as Kubernetes objects. Kubernetes resources are, for example, applications (stateless applications or stateful applications), pod (container groups), config map (configuration map), secret (security key), service (service), deployment, copy set (duplicate set), namespace (namespace), volume (volume), stateful copy set, daemon set (daemon copy set), job (job), or cron job (timed task). Where pod is the smallest computational unit of Kubernetes, pod represents one or more related containers and their shared storage and network resources. A config map is a collection of key-value pairs (key-value), and is used to store data such as environment variables, command line parameters, configuration files, etc. of an application, to store and manage sensitive configuration data.
(3) Data serialization language (YAML ain't markup language, YAML)
YAML is a human-readable data serialization language commonly used to write configuration files, and the present embodiment refers to YAML format files simply as YAML files. In Kubernetes, YAML files may be used to define the configuration of the execution resources.
(4) Form
In hypertext markup language (hypertext markup language, HTML), form tags are commonly referred to as forms. It may submit the data in the form to the specified server address using a specified request means, such as a get request or a post request.
(5) TypeScript (TS) document
The TS file is a file in which TypeScript code is stored in the extension of TS. The TS file may contain declarations of variables, functions, classes, interfaces, etc., and may organize code in a modular fashion. When writing TypeScript code, an editor or command line tool may be used to compile the ts file into a JavaScript file, which then runs in a browser or node. Js environment. TypeScript is an object-oriented programming language, and TypeScript is a superset of JavaScript language. The JavaScript application system expands a plurality of new characteristics, such as static type, interface, naming space, class and the like, based on JavaScript, and can make JavaScript writing application more convenient and easier to maintain.
The application scenario of the embodiment of the present application is illustrated below.
In a scenario using a Kubernetes et al container scheduling system, in one implementation, a user inputs parameters of a resource based on a YAML format in YAML editing software according to a requirement of configuring the resource, thereby creating a YAML-format resource configuration file (hereinafter referred to as YAML file). The YAML file specifies parameters for the resource. The container scheduling system configures resources based on parameters of the resources in the YAML file and schedules containers based on the resources.
However, since the YAML format is more complex than other formats, the requirements on grammar and format are strict, for example, the specified number of spaces is contracted before data, a colon is used, "separating key name and key value," a line-feed character needs to be added after each item of data, if the grammar and format of the YAML file do not meet the requirements, the analysis error of the YAML file of the container scheduling system can be caused, so that the use threshold for creating the resource configuration file is too high, the resource deployment difficulty is higher, and the probability of configuration failure is higher.
Based on this, in one possible implementation manner of the present application, because the corresponding relationship between the parameters of the resource and the attributes of the form component, for example, the parameters of the Kubernetes resource and the attributes of the form component, is used when the container scheduling system is used to schedule the container, the YAML file is converted into the visualized form, so that the user is supported to configure the values of the parameters by filling the form, the user is not required to have deep knowledge about the grammar and format of the YAML, the use threshold brought when the YAML editing software is used to create the resource configuration file is reduced, the probability of configuration failure is also reduced, and the resource deployment difficulty is reduced.
Further, since the form is created based on which parameter of the container scheduling system is not necessarily preset by the front end, for example, it is not necessary to set the parameter on which the form is created based in the code such as the TS file executed by the front end server, but rather the parameter on which the form is created is supported by determining the parameter on which the form is created based on the parameter and the correspondence relation, if the container scheduling system is upgraded and evolved, new resources or new parameters are added in the container scheduling system, it is not necessary to update the form style by modifying the code in the TS file executed by the front end server, but rather the correspondence relation can be updated based on the newly added parameter, and the function of the form conversion can be updated following the upgrade of the container system, so that flexibility and expandability are improved, and the cost of upgrade and maintenance is also reduced.
The present embodiment focuses on the method of converting between YAML files and forms, and the method provided in the present embodiment may also be applicable to converting between profiles and forms in formats other than YAML. For example, conversion between JSON files and forms may also be achieved based on the method provided by the present embodiment.
If desired, embodiments of the present application may select a function that supports a mapping between parameter value types and form component types, and the implementation of this optional function will be described after the heading "function one".
If desired, embodiments of the present application may select a function that supports a mapping between options of parameter values and options of form components, the implementation of which will be described after the heading "function two".
If desired, embodiments of the present application may select a function that supports a mapping of threshold ranges of parameter values to threshold ranges that the form component allows to be configured, and the implementation of the optional function will be described after the heading "function three".
If desired, the embodiment of the present application may select a function supporting hierarchical relationship mapping, and the implementation of the optional function will be described after the heading "function four".
If desired, the embodiment of the present application may select a function supporting linkage mapping, and the implementation of the optional function will be described after the heading "function five".
If desired, the embodiment of the present application may select a function supporting identification of recommended parameters, and the implementation of this optional function will be described after the heading "function six".
If desired, embodiments of the present application may select a function that supports parameter error identification, and the implementation of this optional function will be described after the heading "function seven".
The following illustrates the hardware system architecture associated with an application scenario.
Fig. 1 is a schematic diagram of an architecture of a computing system 100 according to an embodiment of the present application, where the computing system 100 includes a terminal 120 and a server system 140. The terminal 120 is connected to the server system 140 via a communication network 160.
A terminal (terminal) is a device supporting a man-machine interaction function, having the capability of accessing a network, and generally carrying an operating system. Types of terminals 120 include, but are not limited to, cell phones, tablet computers, notebook computers, desktop computers, automobiles, vehicle terminals, wearable devices, palm game consoles, and the like. The terminal 120 may also be referred to as a User Equipment (UE), a smart terminal, a mobile terminal user equipment (user device), or a terminal device (terminal equipment). The terminal 120 runs an application program for implementing editing of the YAML file and the form, and the terminal 120 interacts with the server system 140 through the application program, thereby accessing a service provided by the server system 140 for converting the YAML file into the form.
The server system 140 is used to run a service that converts the YAML file into a form, and the server system 140 allows the terminal to access the service through a network. The server system 140 may be a stand-alone server, a cluster or a distributed system including a plurality of servers, or a cloud computing platform or a virtualization center. The servers included in the server system 140 may be physical servers, virtual machines, containers, or virtualized devices implemented based on network function virtualization (network functions virtualization, NFV). The server system 140 may include a physical server or a virtualized device such as a virtual machine or a container.
The communication network 160 is used to support data communication connections between the terminal 120 and the server system 140. Communication network 160 typically supports standard communication techniques and/or protocols. The communication network 160 is typically the internet, but may be any combination of local area networks (local area network, LAN), metropolitan area networks (metropolitan area network, MAN), wide area networks (wide area network, WAN), mobile, wired or wireless networks, private networks, or virtual private networks. Communication network 160 includes one or more network devices, such as switches, routers, and the like.
The terminal 120 can implement a function of editing the YAML file by running the YAML editing software 1201. The terminal 120 can implement a function of editing a form by running the form editing software 1202. YAML editing software may also be referred to as a YAML editor, which is used for a user to input parameters of a resource to be configured. For example, the YAML editing software is used to render an editing interface to the screen of the terminal 120 in order to present a view of editing YAML.
The YAML editing software 1201 and the form editing software 1202 may be, for example, a global information network (Web) application program, for example, an application client, for example, an Application Program Interface (API) integrated in a third party application, for example, a plug-in integrated in the third party application, and for example, at least one implementation of a software development kit (software development kit, SDK) integrated in the third party application. The Web application is an application accessed through a Web browser. The application client may be a stand-alone software client or an applet. An applet refers to a child application that runs in dependence on a parent application.
In the flow of performing the method of converting YAML files into forms, optionally, the server system 140 assumes primary data processing tasks and the terminal 120 assumes secondary data processing tasks; alternatively, the server system 140 assumes secondary data processing tasks and the terminal 120 assumes primary data processing tasks; alternatively, the data processing tasks are cooperatively undertaken between the terminal 120 and the server system 140.
The server system 140 may include a plurality of servers. For example, front-end servers 140-a and back-end servers 140-b are included in server system 140.
The front-end server refers to a server near one end of the terminal 120. The front-end server is used to manage front-end resources of the computing system 100, such as HTML pages, javaScript source code, cascading style sheets (Cascading Style Sheets, CSS), and to provide website front-end interfaces and interactive functionality for the user. The back-end server 140-b is used to handle business logic and database operations. The back-end server receives the data requests submitted by the front-end server, processes the requests and returns corresponding results to the front-end server.
The front-end server and the back-end server may be separate on different physical servers, with the front-end server 140-a and the back-end server 140-b communicating via a network and the hypertext transfer protocol (hypertext transfer protocol, HTTP) protocol. The front-end server and the back-end server may also be integrated on the same physical server.
Optionally, the computing system 100 also includes a storage system 180. The storage system 180 is configured to store data required by the server system 140 to perform conversion of the YAML file into a form, for example, a correspondence between a parameter of a resource and a form component, an attribute of the parameter, an identifier of the parameter, a correspondence between a parameter value type and a form component type, a correspondence between an identifier of the parameter and a threshold range of parameter values, a correspondence between a level of the parameter and a level of the form component, a correspondence between an identifier of the parameter and a level of the parameter, and a correspondence between an identifier of the first parameter and an identifier of the second parameter, where the parameter is based on when the container is scheduled by the container scheduling system. The storage system 180 includes one or more storage devices. The storage system 180 may be located external to the server system 140, exchanging data with the server system 140 over a communication network or bus. For example, the storage system 180 is an external hard disk array, a storage server, a cloud storage system, or the like. Alternatively, the storage system 180 may be located inside the server system 140, and exchange data with the server system 140 via a bus.
Optionally, the computing system 100 further includes a terminal 170, where the terminal 170 is configured to configure data required by the server system 140 when executing the method of converting the YAML file into a form, for example, a correspondence between a parameter of a resource based on which the container scheduling system schedules the container and an attribute of a form component, a correspondence between an identification of the parameter and a type of the parameter value, a correspondence between a type of the parameter value and a type of the form component, a correspondence between an identification of the parameter and a threshold range of the parameter value, a correspondence between a level of the parameter and a level of the form component, a correspondence between an identification of the parameter and a level of the parameter, and a correspondence between an identification of the first parameter and an identification of the second parameter. The administrator 107 may be configured through the terminal 170 by way of a command line, configuration interface, edit configuration file, etc.
Optionally, the computing system 100 further includes a container dispatch system 190, the container dispatch system 190 for assuming the functions of container dispatch. The server system 140 may interact with the container scheduling system 190 over a network, for example, the server system 140 may send the YAML file to the container scheduling system 190, the container scheduling system 190 scheduling containers based on the received YAML file. The embodiment of the application is exemplified by a container deployment system as Kubernetes, which can be replaced by a Docker Swarm, mesos or other types of container scheduling systems supporting YAML file-based resource deployment.
The following is an illustration of a method flow of an embodiment of the present application.
Fig. 2 is a flowchart of a form conversion method according to an embodiment of the present application.
In one possible implementation, the execution subject of the method 200 is a terminal. The method 200 is performed by the terminal, for example, by running browser software or service client software. For example, in connection with the application scenario shown in fig. 1, the method 200 may be performed by the terminal 120 during the execution of the YAML editing software 1201 (the YAML editing software 1201 is a specific example of browser software or business client software).
In another possible implementation, the method 200 is performed in a system of a single server or a plurality of servers.
In yet another possible implementation, the method 200 shown in fig. 2 is performed interactively by a terminal and a server. The following describes the method flow with the emphasis on terminal and server system interactions as examples. The steps described below as being performed by the server may be replaced by being performed by the terminal or being performed by the terminal in cooperation with the server system, and the steps performed by the terminal may be replaced by being performed by the server system or being performed by the terminal in cooperation with the server system.
S210, the terminal acquires the YAML file.
S220, the terminal sends the YAML file to the server system.
In one possible implementation scenario for sending the YAML file, please refer to fig. 3, the terminal displays an interface 300 of the YAML editing software during the running of the YAML editing software 1201, and the interface 300 includes a text input box 308 and buttons 305. Text input box 308 is used to input the contents of the YAML file. Button 305 is used to trigger instructions to convert the YAML file into a form. When it is desired to convert the YAML file to a form, the user may click on button 305, triggering a first conversion instruction indicating conversion of the YAML file to a form. The terminal obtains the value of the text input box 308 in response to the first conversion instruction, obtains the YAML file, and transmits the YAML file to the server system.
In one possible implementation of sending the YAML file, the YAML editing software 1201 includes a form conversion interface, which is a software implemented communication interface, such as an API, plug-in, or SDK. The terminal 120 transmits the YAML file to the server system by calling the form conversion interface by running the YAML editing software 1201.
In one possible implementation of sending the YAML file, the terminal generates a first request message based on the YAML file and the first conversion instruction; the terminal sends a first request message to the server system. The first request message includes a YAML file and a first conversion instruction. The first request message is, for example, an HTTP message, and the first request message is, for example, an encrypted hypertext transfer protocol (hypertext transfer protocol secure, HTTPs) message, or a file transfer protocol (file transfer protocol, FTP) message, and is, for example, a simple mail transfer protocol (simple mail transfer protocol, SMTP) message.
S230, the server system receives the YAML file from the terminal.
In one possible implementation of receiving the YAML file, the server system receives a first request message from the terminal, and the server system obtains the YAML file and the first conversion instruction from the first request message. The server system performs S240 in response to the first conversion instruction.
S240, the server system obtains the form based on the attribute correspondence relation between the parameters of the YAML file and the Kubernetes resource and the form component.
In one possible implementation manner of obtaining the form, the server system obtains parameters of the Kubernetes resource from the YAML file, searches a corresponding relation 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 the form component based on the searched attributes of the form component, the form component is used for configuring the parameters of the Kubernetes resource, and the system generates the form based on the form component.
For example, the server system obtains the identification of the Kubernetes resource from the YAML file, the system searches for a correspondence between the identification of the Kubernetes resource and the identification of the form component based on the identification of the Kubernetes resource, obtains the identification of the form component corresponding to the identification of the Kubernetes resource, generates the form component based on the identification of the form component, and the server system generates the form based on the form component.
The parameters of the Kubernetes resource include, for example, an identification of the parameters of the Kubernetes resource. The identification of a parameter comprises, for example, a key of the parameter itself, and a key of a parent parameter to which the parameter belongs. The key of the parent parameter is separated from the key of the parameter, e.g., by a symbol. The identification of the parameter is, for example, a key (key) of the parameter, which in turn is, for example, the name of the parameter, a label (label), or other data capable of identifying the parameter. The key of a parameter is also called a key of a parameter, and is used for identifying and describing a parameter
The attributes of the form component include, for example, an identification of the form component. The identity of the form component is, for example, a key of the form component. The identification of the form component is, for example, the name of the form component.
In one possible implementation manner of obtaining the attribute correspondence between the parameters of the Kubernetes resource and the form component, the server system generates a read request based on the parameter identifier obtained from the YAML file, where the read request indicates the attribute correspondence between the parameters of the Kubernetes resource and the form component. The server system sends a read request to the storage system 180, and the storage system 180 sends a read response to the server system in response to the read request, the read response including a parameter of the Kubernetes resource and an attribute correspondence of the form component.
In another possible implementation of obtaining the correspondence between the parameters of the Kubernetes resource and the attributes of the form component, the administrator 107 performs a configuration operation through the terminal 170, edits a configuration file on the terminal 170, and triggers the configuration quality. The terminal 170 sends a configuration file to the server system, where the configuration file includes a corresponding relationship between parameters of the Kubernetes resource and attributes of the form component. The server system receives the configuration file from the terminal 170, and obtains the attribute correspondence of the parameters of the Kubernetes resource and the form component from the configuration file.
In another possible implementation of obtaining the correspondence between the parameters of the Kubernetes resource and the attributes of the form component, the administrator 107 performs a configuration operation through the terminal 170, edits a configuration file on the terminal 170, and triggers the configuration quality. The terminal 170 sends a configuration file to the server system, where the configuration file includes a corresponding relationship between parameters of the Kubernetes resource and attributes of the form component. The server system receives the configuration file from the terminal 170, and obtains the attribute correspondence of the parameters of the Kubernetes resource and the form component from the configuration file.
In another possible implementation of obtaining the correspondence between the parameters of the Kubernetes resource and the attributes of the form component, the server system interacts with a management node of the Kubernetes, and the server system sends a query request to the management node of the Kubernetes (e.g., a default value controller (default controller)), the query request indicating the parameters of the Kubernetes resource to be obtained. The management node of Kubernetes receives the query request, and in response to the query request, sends a query response to the server system, the query response including parameters of the Kubernetes resource. The server system obtains the parameters of the Kubernetes resource from the query response, determines the attribute of the form component matched with the parameters of the Kubernetes resource based on the identification of the parameters of the Kubernetes resource and the value of the parameters of the Kubernetes resource, and establishes the corresponding relation between the parameters of the Kubernetes resource and the attribute of the form component.
In another possible implementation manner of obtaining the correspondence between the parameters of the Kubernetes resource and the attributes of the form component, the server system determines the attributes of the form component matched with the parameters of the Kubernetes resource based on the identification of the parameters of the Kubernetes resource and the values of the parameters of the Kubernetes resource from the parameters of the Kubernetes resource in the API description file provided by the Kubernetes, and establishes the correspondence between the parameters of the Kubernetes resource and the attributes of the form component. The API description file includes all available APIs, resources, operations, and parameters, and provides examples and description of use.
In another possible implementation manner of obtaining the corresponding relation between the parameters of the Kubernetes resource and the attributes of the form components, the server system reads a history log of a user account logged in by the terminal, obtains the identification of the parameters of the Kubernetes resource and the values of the parameters configured in a history time period recorded in the history configuration log, determines the attributes of the form components matched with the parameters of the Kubernetes resource based on the identification of the parameters of the Kubernetes resource and the values of the parameters of the Kubernetes resource, and establishes the corresponding relation between the parameters of the Kubernetes resource and the attributes of the form components.
In one possible implementation manner of saving the attribute correspondence between the parameters of the Kubernetes resource and the form component, the attribute correspondence between the parameters of the Kubernetes resource and the form component is saved through a JavaScript object notation (JavaScript object notation, JSON) file.
S250, the server system sends the form to the terminal.
In one possible implementation of sending the form, the server system generates a first response message based on the form, the first response message including the form. The server system sends a first response message to the terminal. The first response message is, for example, a hypertext transfer protocol (hypertext transfer protocol, HTTP) message, the first request message is, for example, a file transfer protocol (file transfer protocol, FTP) message, and the first request message is, for example, a simple mail transfer protocol (simple mail transfer protocol, SMTP) message.
According to the method provided by the embodiment, the YAML file is converted into the visual form by utilizing the corresponding relation between the parameters of the Kubernetes resource and the attributes of the form component, so that the user is supported to configure the values of the parameters in a form filling mode, the user is not required to have deep knowledge on the grammar and the format of the YAML, the use threshold brought when the YAML editing software is used for creating the resource configuration file is reduced, and the probability of configuration failure is reduced.
Further, since the form creation based on which parameter in the container scheduling system is not necessarily preset by the front end, but the parameter based on which the form creation is determined by the parameter received from the terminal and the corresponding relation is supported, the function of the form conversion can be updated by following the update evolution of the container system and maintaining the corresponding relation, so that the flexibility and the expandability are improved, and the cost of updating and maintaining is also reduced.
The above embodiments describe the basic flow of converting a YAML file into a form based on correspondence, and some functions that may be implemented in converting a YAML file into a form are further described in detail below. The correspondence between the identifier of the parameter and the type of the parameter value, the correspondence between the type of the parameter value and the type of the form component, the correspondence between the identifier of the parameter and the threshold range of the parameter value, the correspondence between the hierarchy of the parameter and the hierarchy of the form component, the correspondence between the identifier of the parameter and the hierarchy of the parameter, and the correspondence between the identifier of the first parameter and the identifier of the second parameter described below are lower specific examples of the parameters of the Kubernetes resource and the attributes of the form component in the above embodiments.
Mapping between parameter value types of function one, kubernetes resources and types of form components
There are many types of parameter values in Kubernetes, and the user may not be aware of the correct type of parameter values, resulting in a high probability of configuration failure. Based on the above, in one implementation manner provided by the application, the function of mapping between the parameter value type and the type of the form component is realized, and the form component with the type matched with the parameter value type can be generated according to the parameter value type of Kubernetes input by a user when editing the YAML file.
The parameter value type is, for example, integer (int), option (option), boolean (boolean), string, time, or the like.
The types of form components are, for example, a number input box (number input), a pull-down box (select box), a button (button), a radio box (radio), a check box (checkbox), a switch (switch), a text input box (text input, which may also be referred to as a string input box), a slide input bar (slide), and the like.
For example, the correspondence between the parameter value type and the type of the form component is shown in table 1 below.
TABLE 1
Parameter value type Types of form components
Shaping type Digital input box or sliding input bar
Character string Text input frame
Boolean type Switch
Options Drop down or single selection
Time point Time selection frame
In one possible implementation of the mapping between the parameter value type and the form type, the server system obtains the identity of the Kubernetes resource from the YAML file, and searches for a correspondence between the identity of the Kubernetes resource and the parameter value type of the Kubernetes resource based on the identity of the Kubernetes resource to obtain the parameter value type corresponding to the identity of the Kubernetes resource. The server system searches the corresponding relation between the type of the parameter value of the Kubernetes resource and the type of the form component based on the type of the parameter value of the Kubernetes resource to obtain the type of the form component, so that the mapping between the parameter value type and the form type is realized.
In another possible implementation manner of mapping between the parameter value type and the form type, the server system obtains the identification of the Kubernetes resource from the YAML file, searches the corresponding relation between the identification of the Kubernetes resource and the form component type based on the identification of the Kubernetes resource, and obtains the form component type, thereby realizing the mapping between the parameter value type and the form type.
As a specific example, please refer to fig. 3, a user inputs a parameter 310 in the YAML editing software interface 300, an identifier of the parameter 310 includes restart policy (meaning a container restart policy), and the server system searches a correspondence between the identifier of the parameter and a parameter value type based on the restart policy, to obtain a parameter value type corresponding to the restart policy as an option; based on the options, the server system searches the corresponding relation between the parameter value type and the type of the form component, obtains the type of the form component corresponding to the options as a drop-down frame, and generates a drop-down frame 410 named as a container restarting strategy in the form 400, so that a user selects Rong Qichong starting strategy in the drop-down frame 410.
As a specific example, please refer to fig. 3, the user inputs a parameter 320 in the YAML editing software interface 300, the identifier of the parameter 320 includes replicas (meaning a pod copy number), and the server system searches for a correspondence between the identifier of the parameter and the parameter value type based on the replicas, so as to obtain that the parameter value type corresponding to the replicas is integer; the server system searches for a correspondence between the type of the parameter value 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 digital input box, so that a digital input box 420 named pod copy number is generated in the form 400, so that the user inputs the value of the pod copy number in the digital input box 420.
As a specific example, please refer to fig. 3, the user inputs a parameter 330 in the YAML editing software interface 300, the identifier of the parameter 330 includes privileged (meaning that the container is operated in the privileged mode), and the server system searches for a correspondence between the identifier of the parameter and the parameter value type based on privileged, so as to obtain that the parameter value type corresponding to privileged is boolean (bootean); based on the options, the server system searches the corresponding relation between the parameter value type and the type of the form component, obtains the type of the form component corresponding to the boolean type as a switch, and generates a switch 430 named as a running container in the privileged mode in the form 400, so that a user can select whether to run the container in the privileged mode by clicking on the switch.
As a specific example, the parameter input by the user is name (meaning is name), and the server system searches the corresponding relation between the identification of the parameter and the parameter value type based on the name to obtain that the parameter value type corresponding to the name is string type (string); based on the character string type, the server system searches the corresponding relation between the parameter value type and the type of the form component to obtain the character input box of the form component corresponding to the character string type, so that a character input box named name is generated, and a user can conveniently input the name in the character input box.
Based on the mapping between the parameter value type and the form component type, the achieved effect includes the following aspects.
First, the probability of configuration errors is further reduced.
Because the type of the parameter value of Kubernetes is considered when the form component is generated, the type of the generated form component is matched with the type of the parameter value of Kubernetes, the type of the form component has a limiting effect on the parameter input by the user, which is equivalent to forcedly limiting the type of the parameter value input by the user to the type of the form component, for example, when the type of the parameter value is an option, the type of the form component is a drop-down box, the user needs to select the parameter value from the option in the drop-down box, and therefore, compared with any parameter value input in a text input box, the range of the parameter value configured by the user is limited, and the configuration error probability is reduced.
Second, improving scalability
The corresponding relation between the identification of the parameter and the parameter value type and the corresponding relation between the parameter value type and the form component type are utilized to realize the functions, when new parameters are needed to be added, the identification of the newly added parameters and the parameter value type are added into the corresponding relation, the form component with the matched type can be generated aiming at the newly added parameters, when the original parameters are needed to be modified, the identification of the parameters and the parameter value type are modified into the corresponding relation, and the original corresponding relation can be modified, so that the maintenance, updating and upgrading costs of the server system are reduced, and the expandability is improved.
Third, improve ease of use
By automatically generating the form component, the threshold of parameter configuration is reduced, so that a user does not need to know the type of parameter value deeply, and the parameter configuration can be completed more efficiently and accurately.
Optionally, in the case that the parameter value type is not found based on the identification of the parameter, the server system obtains a general 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, parameters which are outdated or abandoned, there may not be a correspondence between the identification of the parameters and the parameter value types in the database stored by the server system, and when the user inputs the parameters which are not in the database, a text input box may be generated, so that the user can freely input the values of the parameters in the text input box, which is helpful for realizing graceful degradation and improving compatibility.
Mapping between function two, kubernetes resources and options of form components
In the scenario where Kubernetes are used, since the parameter values of many Kubernetes resources are specific options, non-selectable value errors can result if the user-configured parameter values of Kubernetes do not belong to the set of options allowed by Kubernetes. Based on the above, in one implementation manner of the application, the function of mapping between the parameters of the Kubernetes resource and the options included in the form component is realized, the form component including the option set can be generated based on the identification of the Kubernetes resource, and the option set in the form component is matched with the identification of the Kubernetes resource, so that the range of the value configured by the user is limited in the option set, and the probability of non-selectable value errors is reduced.
In one possible implementation of the mapping between the parameters of the Kubernetes resource and the options of the form component, the server system obtains the identity of the Kubernetes resource from the YAML file, and searches for a correspondence between the identity of the Kubernetes resource and the option set of the parameter value based on the identity of the Kubernetes resource, resulting in the option set corresponding to the identity of the Kubernetes resource. The server system generates a form component based on the set of options, the form component including the set of options. 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. As another example, the form component is a selection button that allows each option selected to be one of the parameter values of the corresponding Kubernetes resource.
As a specific example of implementing the mapping between Kubernetes resources and options of the form component, please refer to fig. 3, the user inputs Kubernetes resources 310 in the YAML editing software interface 300, the identity of Kubernetes resources 310 includes image pull policy (mirror pull policy), the server system obtains image pull policy from the YAML file, and obtains the option set including always, never, if not present, and on failure based on the correspondence between the identity of image pull policy lookup parameters and the option set. In the process of executing YAML file conversion into a form, the server system generates a drop-down box 410 corresponding to the Kubernetes resource 310, wherein the option set in the drop-down box 410 comprises always, a lever, an if not present and an on failure. Where always means that every time an attempt is made to pull an image, if there is no local image or remote image, an attempt is made to pull the latest remote image. The lever indicates that no attempt is made to pull the image, only the local image is used. if not present indicates that pulling a remote image is attempted only if the image does not exist locally. on failure means that pulling a new image is attempted only if the previously used image is erroneous or fails.
As another specific example of implementing the mapping between Kubernetes resources and options of the form component, the server system obtains max-places from the YAML file, where max-places is an identification of a parameter that is a maximum number of Pod allowed to run on the node, the server system obtains a set of options including a maximum number of Pod based on a correspondence between the identification of the max-places lookup parameter and the set of options of parameter values, and the server system generates a drop-down box corresponding to the max-places in the process of executing the conversion of the YAML file into the form, where the drop-down box includes the maximum number of Pod, so that the user can configure the maximum number of Pod in a selective manner from the drop-down box.
Based on the mapping between Kubernetes resources and options of form components, the achieved effect includes the following aspects.
First, the probability of configuration errors is further reduced.
Because the options of the Kubernetes resource parameter values are considered when the form component is generated, the options of the parameter values are mapped with the options of the form component, so that the range of values which can be input by a user in the form component is limited to be within the allowed option set, and the probability of non-selectable value errors is reduced.
Second, improve ease of use
By automatically generating the form component comprising the options, the threshold of parameter configuration is reduced, so that a user does not need to know the options of parameter values deeply, and the parameter configuration can be completed more efficiently and accurately by performing selection operation.
Third, improving scalability
Because the functions are realized by utilizing the identifiers of the parameters and the option sets of the parameter values, when new parameters are needed to be added, the identifiers of the newly added parameters and the option sets of the parameter values are added to the corresponding relation, so that a matched form component can be generated aiming at the newly added parameters, and when the original parameters are needed to be modified, the identifiers of the parameters and the option sets of the parameter values are modified to the corresponding relation, so that the modification can be carried out aiming at the original corresponding relation, thereby reducing the maintenance, updating and upgrading costs of the server system and improving the expandability.
Mapping of threshold ranges of function three, parameter values to threshold ranges of form component allows configuration
In the scenario of using Kubernetes, since the parameter values of many resources in Kubernetes need to meet a set threshold range, if the parameter values configured by the user exceed the threshold range, an overrun error may be caused, which further causes a risk of scheduling failure or resource contention when the scheduler schedules the resources based on the error parameter.
Based on the above, in one implementation manner of the application, mapping between the threshold range of the parameter value and the threshold range of the form component is realized, and the matched form component can be generated based on the threshold range of the parameter value, so that the parameter value input by a user is prevented from exceeding the threshold range, and the risk of overrun errors is reduced.
In one possible implementation of the mapping between the threshold range of the parameter value and the threshold range of the form component allowed configuration, the server system obtains the identification of the Kubernetes resource from the YAML file, and searches for a correspondence between the identification of the Kubernetes resource and the threshold range of the parameter value of the Kubernetes resource based on the identification of the Kubernetes resource, to obtain the threshold range of the parameter value corresponding to the identification of the Kubernetes resource. The server system generates a form component based on the threshold range of parameter values, the form component allowing the configured threshold range to match the threshold range of parameter values. For example, the form component allows the maximum value of the configuration to be the same as the maximum value of the parameter, and the form component allows the minimum value of the configuration to be the same as the minimum value of the parameter.
As a way of acquiring the correspondence between the identification of the parameter and the threshold range of the parameter value, the correspondence between the identification of the parameter and the threshold range of the parameter value is established based on the resource quota of Kubernetes. Resource quota is a configuration in Kubernetes that is used to limit the use of resources in different levels of namespaces, nodes, pod, containers, etc.
As a specific example of implementing the mapping between the threshold range of parameter values and the threshold range allowed to be configured by the form component, the parameter input by the user includes a memory (meaning a memory capacity), and the server system searches for a correspondence between the identity of the parameter and the threshold range of the parameter values based on the memory, so as to obtain a threshold range (such as a memory quota) of the parameter values corresponding to the memory as 2 Gigabytes (GB). The server system generates a digital input box based on the threshold range of parameter values, the maximum value that the digital input box allows to input being 2GB.
Based on the mapping of the threshold range of parameter values to the threshold range that the form component allows to be configured, the achieved effect includes the following aspects.
First, the probability of configuration errors is further reduced.
Because the threshold range of the parameter values of the Kubernetes resource is considered when the form component is generated, the generated form component allows the configured threshold range to be matched with the threshold range of the parameter values, so that the risk of overrun errors is reduced.
Second, improving scalability
Because the functions are realized by utilizing the corresponding relation between the identifications of the parameters and the threshold ranges of the parameter values, when new parameters are needed to be added, the identifications of the newly added parameters and the threshold ranges of the parameter values are added to the corresponding relation, so that a form component with matched types can be generated aiming at the newly added parameters, when the original parameters are needed to be modified, the identifications of the parameters and the threshold ranges of the parameter values are modified to the corresponding relation, and the original corresponding relation can be modified, thereby reducing the maintenance, updating and upgrading costs of the server system and improving the flexibility and the expandability.
Third, improve ease of use
By automatically generating the form component, the threshold of parameter configuration is reduced, so that a user does not need to know the threshold of the parameter value deeply, the parameter configuration can be more efficiently and accurately completed, and the configuration errors and the complicated operation degree of the user are reduced.
Function four, hierarchical relationship mapping
Hierarchical relationships may also be referred to as parent-child relationships, nested relationships, or include relationships to be included. For example, parameter a includes parameter B, which may be referred to as a parent parameter of parameter B, parameter B is a child parameter of parameter a, and parameter a is one level higher than parameter B.
The requirements in the YAML file for the number of indents before parameters are more stringent. Typically, YAML files represent a sub-hierarchy by a indentation of two spaces. For example, parameter B is a subparameter of parameter a, parameter C is a subparameter of parameter B, and when writing a YAML file, it is generally required that parameter B be indented 2 more spaces than parameter a, and parameter C be indented 4 more spaces than parameter a. If the number of indentations in the YAML file is not equal to the number of indentations corresponding to the correct hierarchy of parameters, a hierarchy error may occur, and then an error may be reported, resulting in failure of the Kubernetes to apply the YAML file.
Based on the above, in one implementation manner provided by the application, the function of hierarchical relation mapping is realized, the hierarchical relation among the parameters in the YAML file can be mapped into the hierarchical relation among the parameters in the form, so that the hierarchical relation among the parameters can be visually represented in the interface by the converted form, the hierarchical relation among the parameters is more visual and clear, the hierarchical relation is controlled by strictly controlling the hierarchical relation according to the specific retraction quantity when the YAML file is configured, the probability of configuration failure caused by the hierarchical error once the retraction quantity is wrong is reduced, and the user experience is improved.
In one possible implementation of the hierarchical relationship mapping, the server system obtains a hierarchy of parameters based on the YAML file. The server system searches the corresponding relation between the parameter level and the form component level based on the parameter level, obtains the form component level, and generates the form component with the level characteristic.
Determining a hierarchy of parameters based on the YAML file may include a variety of ways. For example, the hierarchy of parameters is determined based on the number of indents before the parameters in the YAML file. For example, the hierarchy of parameters is determined based on the ratio of the number of indents before the parameters in the YAML file to 2. For example, the YAML file includes parameters in Kubernetes, in which parameter name is a subparameter of parameter metadata, parameter alternatives is a subparameter of parameter spec, the level of parameter metadata is, for example, 1, the level feature of parameter name is, for example, 2, the level of parameter spec is, for example, 1, and the level of parameter alternatives is, for example, 2.
metadata:
name:my-deployment
spec:
replicas:3
The hierarchy of form components in a form may be embodied in a variety of ways. For example, the hierarchy of form components is embodied based on the number of indents before the tag name of the form component. As another example, the hierarchy of form components is embodied based on their height in the form. As another example, the hierarchy of form components is embodied based on the rows in which the form components are located in the form. For another example, whether the form component is in a visible state or a hidden state represents a hierarchy of the form component based on whether the cascading list is in an expanded state; for another example, whether the form component is in a visible state or a hidden state represents the hierarchy of the form component based on whether the cascading list is in a folded state; for another example, the hierarchy of form components is embodied based on the color of the form components; as another example, the hierarchy at which the form component-based tree control is located embodies the hierarchy of the form component. As another example, the hierarchy of form components is embodied based on the groupings in which the form components are located in the form. As another example, the hierarchy of form components includes the distance of the form components from the interface boundary.
The correspondence between the levels of parameters and the levels 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 that the hierarchy of the first parameter and the hierarchy of the second parameter are the same based on the YAML file, and the obtained hierarchy of the first form component is the same as the obtained hierarchy of the second form component, so that the first parameter and the second parameter in the generated form are at the same hierarchy. The server system determines, based on the YAML file, that the first parameter is a sub-parameter of the second parameter (e.g., the first parameter is 1 level lower than the second parameter), and the obtained first form component is a sub-component of the second form component.
In one possible implementation, the hierarchy of parameters in the YAML file is the same as the hierarchy of the corresponding form components in the form. For example, in converting a YAML file into a form, for a parameter in the YAML file, the level at which the parameter is located in the YAML file is determined as the level at which the form component corresponding to the parameter is located in the form. For example, a parameter is at level 3 in the form, and the parameter is shown in the form in the component at level 3. For another example, in converting a form to a YAML file, the level at which a form component is in the form is determined for one form component in the form as the level at which the parameter is in the YAML file.
In another possible implementation, the hierarchy of YAML file parameters is smaller than the hierarchy of corresponding form components in the form. For example, in the process of converting the YAML file into the form, for one parameter in the YAML file, the level at which the parameter is located in the YAML file is determined, and the difference between the level and the set number is taken as the level at which the form component corresponding to the parameter is located in the form. For another example, in the process of converting the YAML file into the form, metadata in the YAML file is displayed at a first level in the form, parameters (such as a kine or version number) before the metadata are displayed through titles in the form, the levels of the parameters before the metadata are not reflected, sub-parameters of the metadata are displayed at a second level in the form, so that important level relations are highlighted, the level relations of the parameters which are not important to be displayed are weakened, and the visual effect of the form is clearer.
Based on the hierarchical relationship mapping, the achieved effects include the following aspects.
First, since the hierarchical relationship between form components is generated by the server system without requiring the user to control the hierarchical relationship by inputting the reduction in the YAML editing software, the probability of the input reduction error causing the hierarchical error is reduced, and the probability of the hierarchical error causing the configuration failure is reduced.
Second, because the hierarchical relationship between the form components is generated based on the hierarchical relationship between the parameters in Kubernetes, the user can understand the relationship between the parameters according to the hierarchical relationship between the form components, such as which parameter is a sub-parameter of which parameter, so that the user can fill out the form more conveniently, thereby improving usability.
As a specific example, referring to fig. 4, parameters 301 and 302 are shown in the YAML editing software interface 300 in fig. 4, where parameter 301 is labels (labels) located at line 6, and parameter 302 is app. Parameter 302 is indented by 2 spaces as compared to parameter 301, indicating that parameter 301 is the parent of parameter 302. After converting the YAML file shown in the interface 300 into a form, please refer to fig. 5, in which the form 400 in fig. 5 includes a text input box 401 and a text input box 402, the text input box 401 is a form component corresponding to the parameter 301, the text input box 402 is a form component corresponding to the parameter 302, the text input box 402 is retracted by a number of amounts compared with the text input box 401, so to speak, the distance between the text input box 402 and the interface boundary is farther than the distance between the text input box 401 and the interface boundary, which means that the text input box 401 is a parent component of the text input box 402, and as can be seen from this example, the parent-child hierarchical relationship between the parameter 301 and the parameter 302 is mapped into the parent-child hierarchical relationship between the text input box 401 and the text input box 402 through hierarchical mapping.
As another specific example, please refer to fig. 4, the interface 300 of the YAML editing software in fig. 4 includes a parameter 301 and a parameter 303, the parameter 303 is an alternatives (notes) located on line 12, the number of indentation spaces of the parameter 303 and the parameter 301 is the same, the level of the parameter 303 and the parameter 301 is the same, after the YAML file shown in the interface 300 is converted into a form, please refer to fig. 5, the parameter 303 is converted into a text input box 403, the number of pixels indented by the text input box 403 and the text input box 401 is the same, it can be said that 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, and the level relationship between the parameter 301 and the parameter 303 is the same as the level relationship between the text input box 401 and the text input box 403 through the level mapping.
As still another specific example, for parameters in 3 Kubernetes of version number, container and volume, the version number is determined to be a subparameter of the container based on the YAML file, and after the YAML file is mapped into a form, an input box of the version number in the form is located below and to the right of an input box of the container, so that a user can see that the version number to be input is the version number of the container instead of the version number of the volume through the positional relationship of the two input boxes.
In one possible implementation manner of acquiring the hierarchy of the parameters based on the YAML file, the server system acquires the identifiers of the parameters based on the YAML file, searches the corresponding relation between the identifiers of the parameters and the hierarchy of the parameters based on the identifiers of the parameters, and obtains the hierarchy of the parameters corresponding to the identifiers of the parameters.
For the data sources of correspondence between the identification of the above-mentioned parameters and the hierarchy of parameters, in one possible implementation, a database is established and maintained, in which the identification of each parameter in Kubernetes and the hierarchy of each parameter are included. In one possible implementation, the hierarchy at which each parameter of the Kubernetes resource is located is obtained using the Kubernetes command line tool kubectl. In another possible implementation, the relationship between the hierarchical structure and parameters of the Kubernetes resource is obtained by looking up the description document on an official document website that accesses Kubernetes.
In another possible implementation of the YAML file acquisition parameter based hierarchy, the server system converts the YAML formatted file into a JavaScript object notation (JavaScript object notation, JSON) formatted file, the JSON formatted file acquisition parameter based hierarchy.
For example, for a parameter in a JSON-format file, the number of colon and the number of brackets before the parameter is obtained are used as the hierarchy of parameters. For another example, parameters in the JSON format are converted into parent parameters, child parameters, forms of child parameters, the number of points before the parameters are obtained as a hierarchy of parameters.
As a specific example, in the JSON format, parameters are bracketed together using brackets { }, and the names of the parameters and the values of the parameters are separated by a colon. Commas are used for separating parameters from each other. For example, the JSON format file includes 2 parameters, a colon and a bracket exist between the key-metadata-based parameter and the key-name-based parameter, and the key-name-based parameter is determined to be a subparameter of the key-metadata. Or in the process of converting the JSON format into the YAML format, a line where the parameter name is located is converted into metadata.
/>
In yet another possible implementation of obtaining a hierarchy of parameters based on a YAML file, the server system obtains the hierarchy of parameters based on a number of indents preceding the parameters in the YAML file. For example, the server system takes the ratio of the number of indents before the parameter to 2 as the hierarchy of parameters.
The above-listed ways of obtaining the various hierarchical features may be performed alone or in combination. For example, the hierarchical features may be obtained by a combination of searching for the correspondence based on the identification of the parameters and parsing the JSON file. For example, the hierarchical features are obtained in the following manner.
Step one, the server system converts the YAML file into a JSON file.
And step two, the server system obtains the first level characteristics of the parameters based on the file in the JSON format.
And thirdly, the server system obtains the identification of the parameter based on the file in the JSON format, searches the corresponding relation between the identification of the parameter and the hierarchy of the parameter based on the identification of the parameter, obtains the second hierarchy characteristic of the parameter, and compares the first hierarchy characteristic with the second hierarchy characteristic.
And step four, 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 level of the parameter.
Step five, if the first level features and the second level features are different, the server system determines that the parameter level is wrong. In the event of a parameter level error, the server system may prompt the user for the parameter level error.
As a specific example, please refer to fig. 4, for the parameter 305 of line 4 in fig. 4, namely, the name (name), the key of the parameter 305 is name, the key of the parent parameter of the parameter 305 is metadata, and the identifier of the parameter 305 is metadata. In the process of executing the third step, the server system obtains the hierarchy of metadata.name as 2 based on the correspondence between the identifier of the metadata.name lookup parameter and the hierarchy of the parameter.
Through the mode described in the first step and the fifth step, not only the level of the parameter can be obtained, but also the parameter level is verified in a comparison mode before the level relation mapping is carried out, so that the accuracy of the parameter level is improved.
Function five, linkage relation mapping
In the Kubernetes scenario, there is an association between configurations between some parameters. For example, the value of parameter a has a limiting effect on the range of values of parameter B. In the case of the value determination of the parameter a, the value of the parameter B needs to be configured to be a specific type of value or a specific option or to be within a specific threshold range, and if the value of the parameter a is not considered by the user in configuring the value of the parameter B, the input value of the parameter B does not satisfy the requirement of the parameter a, which may cause a risk of a configuration error such as invalid configuration operation. The present embodiment defines a relationship in which the configuration of such one parameter is limited to the configuration of the other parameter as a linkage relationship.
As a specific example of a parameter having a linkage relationship, for both the volume type and the authority, if the value of the volume type is configured as a persistent storage volume declaration (persistent volume claim, PVC), the value of the authority needs to be configured as read only (read only) or read write (write read); if the value of the volume type is configured as secret, the value of the rights needs to be configured as a number representing the rights of the file. Conversely, if the volume type value is configured as a PVC and the entitlement value is configured as a number, a parameter configuration error may occur.
The traditional YAML editing software does not combine the use scene of the Kubernetes to carry out checksum error prompt on the linkage relation of the parameters, so that the probability of parameter configuration errors is higher. Based on this, in one possible implementation manner of the present application, the linkage relation between the parameters in the YAML file is mapped into the linkage relation of the form components in the form, so that after the value of the parameter a is configured, the type of the form component corresponding to the parameter B can change along with the value of the parameter a, so that the configuration range of the value of the parameter B can be limited based on the form component, which is equivalent to forcing the user to select and input in a correct manner based on the form component of a specific type, and the probability of the parameter B configuration error is reduced, so that the present application is more easy to use.
The method for mapping the linkage relation is exemplified by taking the first parameter and the second parameter as examples, and the form component corresponding to the first parameter is described as a first form component, the form component corresponding to the second parameter is described as a second form component, the first form component is used for configuring the value of the first parameter, and the second form component is used for configuring the value of the second parameter.
In one possible implementation of the linkage mapping, the server system obtains an identification of the first parameter and a value of the first parameter from the YAML file. The server system searches the corresponding relation between the identification of the first parameter and the identification of the second parameter based on the identification of the first parameter, and obtains the identification of the second parameter. The server system searches for a correspondence between the value of the first parameter, the identification of the second parameter and the candidate value of the second parameter based on the value of the first parameter and the identification of the second parameter, and obtains the candidate value of the second parameter. And the server system searches the corresponding relation between the value type of the second parameter and the type of the second form component based on the candidate value of the second parameter, and obtains the type of the second form component.
As a specific example, the YAML file includes a volume type parameter, and the value is PVC. The server system obtains the authority based on the corresponding relation shown in the volume type lookup table 2-1, so that the parameters with linkage relation with the volume type are determined to be the authority; the server system obtains read-only or read-write based on the corresponding relation shown in the authority and PVC lookup table 2-2, and the server system responds to the matching of the read-only or read-write with the options in the table 2-3 based on the corresponding relation shown in the read-only or read-write lookup table 2-3 to determine that a drop-down frame is generated aiming at the authority, wherein the drop-down frame comprises the read-only or the read-write.
TABLE 2-1
TABLE 2-2
Tables 2 to 3
Value type of second parameter Type of second form component
Options Pull-down frame
Digital number Digital input box
In another possible implementation of the linkage mapping, the server system obtains the identification of the first parameter and the value of the first parameter from the YAML file. The server system searches the corresponding relation between the identification of the first parameter and the identification of the second parameter based on the identification of the first parameter, and obtains the identification of the second parameter. And the server system searches the corresponding relation among the value of the first parameter, the identification of the second parameter and the type of the second form component based on the value of the first parameter and the identification of the second parameter, and obtains the type of the second form component.
As a specific example, the YAML file includes a volume type parameter, and the value is PVC. The server system obtains the authority based on the corresponding relation shown in the volume type lookup tables 2-4, so that the parameters with linkage relation with the volume type are determined to be the authority; the server system obtains a drop-down box based on the correspondence shown in the rights and PVC lookup tables 2-5, so the server system determines to generate a drop-down box for the rights.
Tables 2 to 4
Tables 2 to 5
In another possible implementation of the linkage mapping, the server system obtains the identification of the first parameter and the value of the first parameter from the YAML file. The server system searches for a correspondence among the identification of the first parameter, the value of the first parameter and the candidate value of the second parameter based on the identification of the first parameter and the value of the first parameter, and obtains the candidate value of the second parameter. And the server system searches the corresponding relation between the candidate value of the second parameter and the type of the second form component based on the candidate value of the second parameter to obtain the type of the second form component.
In yet another possible implementation of the linkage mapping, the server system obtains an identification of the first parameter and a value of the first parameter from the YAML file. And the server system searches the correspondence among the identification of the first parameter, the value of the first parameter and the type of the second form component based on the identification of the first parameter and the value of the first parameter, and obtains the type of the second form component.
Based on the linkage relation mapping, the achieved effects include the following aspects.
First, the parameter configuration error probability is further reduced.
When the form component of the second parameter is generated, the value of the first parameter related to the parameter is considered, the type of the generated form component is matched with the relation between the two parameters and the value of the first parameter, which is equivalent to limiting and restricting the value range of the second parameter through the type of the form component, so that the probability of correctly inputting the parameters is improved.
Second, improving scalability
The functions are realized by utilizing the corresponding relation, so that the realization mode is flexible, and the expansion and adjustment are convenient. For example, when the Kubernetes are updated or updated, new parameters or relationships among the new parameters in the Kubernetes can be added to the corresponding relationships to update the functions of the linkage relation mapping, so that the maintenance, updating and upgrading costs of the server system are reduced, and the expandability is improved.
Third, improve ease of use
By automatically generating the form components based on the relationships between the parameters, the threshold for parameter configuration is reduced, so that a user can more efficiently and accurately complete parameter configuration without deeply knowing the relationships between the parameters.
Function six, parameter identification recommendation
In one possible implementation of parameter identification recommendation, during editing of the YAML file by the user, the terminal listens for a parameter input event, and in response to the parameter input event, the terminal obtains the identification of the input parameter, and the terminal sends the identification of the parameter to the server system. The server system receives an identification of a parameter from the terminal. The server system queries in the parameter identification library based on the identification of the parameter to obtain a target parameter identification matched with the identification of the parameter in the parameter identification library, and sends the target parameter identification to the terminal, and the terminal displays the target parameter identification.
By means of the parameter identification recommendation mode, parameter identification to be input can be automatically and intelligently recommended to a user in the process of editing the YAML file by the user, so that operation complexity is further reduced, and the user can recommend the parameter identification in real time when performing input operation, and timeliness is better.
The parameter identification library may also be referred to as a word library. The parameter identification library contains a plurality of possible parameter identifications. For example, the parameter identification library includes identifications of parameters used by the container dispatch system, e.g., the parameter identification library includes keys for all common parameters in Kubernetes.
As one possible implementation of constructing the parameter identification library, the parameter identification library includes an identification of parameters of the resource upon which the container scheduling system schedules the container. For example. The parameter identification library includes an identification of a full amount of parameters of the resource upon which the container scheduling system schedules the container. For example, the server system interacts with the management node of the container scheduling system, and the server system receives the identification of the full amount of parameters sent by the management node of the container scheduling system, and saves the identification of the parameters to the parameter identification library. As another example, the identification of the parameter is obtained from an API description file of the container scheduling system.
As another possible implementation of constructing the parameter identification library, the parameter identification library includes an identification of parameters configured by the user account during the historical time period. For example, when the authorization of the user account is obtained, the server system reads a history configuration log of the user account, the history configuration log records the identification of the parameters configured in the history time period, and the server system stores the identification of the parameters configured in the history time period into the parameter identification library.
As yet another possible implementation manner of constructing the parameter identification library, the parameter identification library includes parameters of which the user account number configuration frequency satisfies the condition in the historical time period. For example, under the condition that the authorization of the user account is obtained, the server system reads a history configuration log of the user account, counts the configuration frequency of the identifier of the configured parameter recorded in the history configuration log, selects the parameter with the configuration frequency arranged in the first k bits or the configuration frequency higher than the set frequency from the identifiers of the configured parameters in the history time period, and stores the identifier of the selected parameter in the parameter identifier library. By the method, the parameter identification can be recommended to the user by combining the parameter configuration habit of the user in the historical time period, so that the complexity of the parameter identification configuration of the user is reduced, and personalized recommendation is realized.
As another possible implementation of constructing the parameter identification library, the parameter identification library includes preference parameter identifications of parameters configured by the user account over a historical period of time. For example, the user may customize the identification of parameters for some personal preference configurations, and the server system may save the preference parameter identification to a parameter identification library. By the method, the personal preference recommendation parameter identification of the user can be combined, so that the complexity of the user configuration parameter identification is reduced, and personalized recommendation is realized.
As a mode of inquiring in the parameter identification library, the server system adopts a fuzzy inquiring mode to inquire in the parameter identification library, and obtains the target parameter identification which satisfies the regular expression with the identification of the parameter in the parameter identification library. Fuzzy queries generally refer to query patterns that construct regular expressions based on some special symbols, operators, and represent matching conditions with the regular expressions. The manner of fuzzy querying allows the search result (e.g., identification of the target parameter) to be not exactly the same as the index upon which the search was based (e.g., identification of the user-entered parameter), such as the search result and the index upon which the search was based satisfying a regular expression. By using the fuzzy query mode, the identification of the target parameter can be searched on a certain probability under the condition that the identification of the parameter input by the user is wrong, so that the identification of the target parameter can be detected and matched more comprehensively, and the accuracy of parameter recommendation is improved.
As a specific example of parameter identification recommendation, the server system receives an identification a of a parameter from the terminal, the parameter identification library includes an identification abc of the parameter, the server system queries in the parameter identification library based on the identification a of the parameter, determines that the identification abc in the parameter identification library matches the identification a, and therefore recommends the identification abc to the user.
In another possible implementation of parameter identification recommendation, the parameter identification to be configured is predicted based on a machine learning algorithm. For example, the parameter identifier configured in the historical time period of the user account is used as a training sample set to train a machine learning model, after the parameter identifier is obtained from the YAML file, the parameter identifier is input into the machine learning model, the target parameter identifier is output through the machine learning model, and the server system recommends the target parameter identifier to the user.
Function seven, parameter error identification
In one possible implementation manner of parameter error identification, during the process of editing the YAML file by the user, the terminal monitors the parameter identification input end event, and in response to the parameter identification input end event, the terminal acquires the identification of the input parameter, and the terminal sends the identification of the parameter to the server system. The server system receives an identification of a parameter from the terminal. The server system queries a target parameter identifier matched with the parameter identifier in the parameter identifier library based on the parameter identifier, and if the parameter identifier matched with the parameter identifier is not queried in the parameter identifier library, for example, if each parameter identifier stored in the parameter identifier library and the parameter identifier received from the terminal do not meet the matching condition, the server system determines that the parameter input may have errors, and the server system sends error prompt information to the terminal, wherein the error prompt information is used for prompting a user to confirm whether the parameter input is wrong. The terminal displays error prompt information.
The parameter identifies that the input end event is triggered, for example, by an operation to input a colon. Specifically, in YAML format files, the keys in a key-value pair are typically separated from the value by a colon. The terminal can monitor the operation of inputting the colon, and in response to the operation of inputting the colon, the terminal acquires the character string before the colon as the identification of the input parameter and sends the identification of the parameter to the server system.
By the method, in the process of editing the YAML file by the user, along with the completion of one-time parameter identification input operation by the user, whether the parameter input by the user has errors or not is identified, and the possible errors are prompted without waiting for the completion of editing the YAML file, so that the real-time error prompt function is realized, the time delay of the error prompt is shorter, and the timeliness is better.
In the case of a YAML editor, in one possible implementation of parameter error recognition, the user enters an identification of a parameter and the value of the parameter in the YAML editor and enters a line feed (line feed means that one entry is complete, e.g., pressing the enter key to feed a line). When the system monitors that the line feed character is input, and errors occur based on the identification of the currently input parameter and the value verification of the parameter, error prompt information is displayed in the YAML editor, and the error prompt information indicates that the input parameter has errors.
In the case of a visual form, in one possible implementation of parameter misidentification, the user enters the value of a parameter in the form in an input box around the identity of the parameter. When the system monitors that the input box loses focus (the loss of focus indicates that the input box is not the input target of a user currently), error occurs based on the identification of the parameter and the value verification of the parameter input in the input box, error prompt information is displayed around the input box, and the error prompt information indicates that the input parameter has error.
Optionally, after the terminal displays the error prompt information, the user may choose to ignore the error prompt information, in which case the server system may create a resource based on the parameters input by the user, and if the creation is successful, update the identification of the parameters input by the user to the parameter identification library. In this way, considering that the matched target parameter identifier is not queried in the parameter identifier library, the fact that the data stored in the parameter identifier library is not complete is probably considered, so that the normal operation of a user is prevented from being blocked while the error is prompted, and the comprehensiveness of the data in the parameter identifier library is improved.
The embodiment shown in fig. 2 focuses on the flow of converting a YAML file into a form, and the embodiment of the present application further provides a method for converting a form into a YAML file, which is illustrated in the following with reference to fig. 6.
Fig. 6 is a flowchart of a form conversion method 500 according to an embodiment of the present application. The method 500 of fig. 6 includes S510 through S550.
S510, the terminal acquires the form.
S520, the terminal sends the form to the server system.
In one possible implementation scenario of the send form, please refer to fig. 3, the terminal displays an interface 400 of YAML editing software, the interface 400 including a button 405. Button 405 is used to trigger the conversion of the form into a YAML file. When a form needs to be converted to a YAML file, the user may click on button 405, triggering a second conversion instruction, which is used to instruct the conversion of the form to a YAML file. The terminal responds to the second conversion instruction, obtains the identification of each form component in the interface 400 and the value in the form component, obtains the form, and sends the form to the server system.
In one possible implementation of sending the form file, the form editing software includes a YAML conversion interface, which is a software implemented communication interface, e.g., the YAML conversion interface is an API, plug-in, or SDK. The terminal 120 invokes the YAML conversion interface by running form editing software, and transmits the YAML file to the server system.
In one possible implementation of transmitting the form, the terminal generates a second request message based on the form and the second conversion instruction; and the terminal sends a second request message to the server system. The second request message includes a form and a second conversion instruction. The second request message is, for example, an HTTP message, and the second request message is, for example, an FTP message, and the second request message is, for example, an SMTP message.
S530, the server system receives the form from the terminal.
In one possible implementation of receiving the form, the server system receives a second request message from the terminal, and the server system obtains the form and the second conversion instruction from the second request message. The server system performs S240 in response to the second conversion instruction.
S540, the server system obtains the YAML file based on the corresponding relation between the parameters of the form and the attributes of the form components.
In one possible implementation, the server system converts the identity of the form component and the value of the form component based on the form. The server system obtains the identification of the parameters of the Kubernetes resource based on the identification of the form component and the correspondence between the identification of the form component and the identification of the parameters of the Kubernetes resource. The server system obtains the values of the parameters of the Kubernetes resource based on the values of the form components. The server system retrieves the YAML file based on the key-value pairs.
In addition, the server system may determine a hierarchy of parameters of the Kubernetes resource based on the identification of the parameters of the Kubernetes resource and a correspondence between the identification of the parameters of the Kubernetes resource and the hierarchy of parameters of the Kubernetes resource. The indentation of the parameters in the YAML file is determined based on the identification of the parameters of the Kubernetes resource, so that the probability of parameter level errors is reduced.
S550, the server system sends the YAML file to the terminal.
The method provided by the embodiment is beneficial to solving the defect of incomplete coverage of the guide type creation parameters by converting the form into the YAML file, realizes automatic generation of the YAML file, and reduces the labor maintenance cost, especially, because the types of the Kubernetes resources and the parameters configured in the Kubernetes resources are too many, the length of the page of the form is limited, the probability that the form contains an input frame corresponding to each parameter in all the parameters in the Kubernetes is lower, and when the parameters are configured through the form, all the parameters in the Kubernetes can be difficult to be covered, and the parameter configuration is not comprehensive. Through the implementation manner, when a user creates the Kubernetes resource configuration file by using the form, if no input box corresponding to the parameters to be configured is found in the form, the form can be converted into the YAML file through the indication system, and the parameters to be configured are input in the YAML file, so that the comprehensiveness of parameter configuration is improved.
Based on the above embodiment of converting from a YAML file to a form and the embodiment of converting from a form to a YAML file, the embodiment of the present application further provides a flow of interconversion between a YAML file and a form, which is illustrated in the following embodiments in conjunction with fig. 7 and fig. 8.
Fig. 7 is a flowchart of a form conversion method 600 according to an embodiment of the present application. The method shown in fig. 7 includes S610 to S691.
S610, the terminal acquires the first form.
The present embodiment relates to modification of form contents, and in order to distinguish descriptions, a form before modification is described using a "first form", and a form after modification is described using a "second form".
S620, the terminal sends the first form to the server system.
S630, the server system receives a first form from the terminal.
S640, the server system obtains a first YAML file based on the corresponding relation between the first form and the Kubernetes resource and the attribute of the form component.
The present embodiment relates to modification of YAML file contents, and in order to distinguish descriptions, a YAML file before modification is described using a "first YAML file", and a YAML file after modification is described using a "second YAML file".
S650, the server system sends the first YAML file to the terminal.
S660, the terminal responds to the modification operation of the first YAML file, and obtains a second YAML file based on the first YAML file and the modified parameters.
For example, the terminal is in the YAML file editor interface with the content of the first YAML file. The user performs a modification operation on the first YAML file. For example, the user enters the newly added parameters in the YAML file editor interface, such as in terms of keys: the value format inputs the identification of the required parameter and the value of the parameter. Alternatively, the user deletes an existing parameter in the first YAML file, or the user updates a value of the parameter of the first YAML file. The terminal obtains a second YAML file based on the first YAML file and the modified parameters in the first YAML file in response to the modification operation.
S670, the terminal transmits the second YAML file to the server system.
S680, the server system receives the second YAML file from the terminal.
S690, the server system obtains a second form based on the corresponding relation between the parameters of the second YAML file and the Kubernetes resource and the attributes of the form component.
As one possible implementation of obtaining the second form, the server system compares the second YAML file with the first YAML file to determine parameters of the Kubernetes resource for which the second YAML file is modified as compared to the first YAML file. The server system searches the corresponding relation between the parameters of the Kubernetes resource and the attributes of the form components based on the modified parameters to obtain the attributes of the form components corresponding to the parameters of the modified Kubernetes resource, and updates the first form based on the attributes of the form components corresponding to the parameters of the modified Kubernetes resource to obtain the second form.
S691, the server system sends the second form to the terminal.
The method provided by the embodiment realizes the mutual conversion between the YAML file and the form, thereby combining the advantages of the mode of editing the YAML file creation and the mode of creating the form, reducing the use threshold of the YAML creation and reducing the probability of incomplete coverage of the guide type creation parameters.
Fig. 8 is a flowchart of a form conversion method 700 according to an embodiment of the present application. The method shown in fig. 8 includes the following steps.
S710, the terminal acquires the first YAML file.
S720, the terminal sends the first YAML file to the server system.
S730, the server system receives the first YAML file from the terminal.
S740, the server system obtains a first form based on the first YAML file and the corresponding relation.
S750, the server system sends the first form to the terminal.
S760, the terminal responds to the modification operation of the first form, and obtains a second form based on the first form and the modified parameters.
S770, the terminal transmits the second form to the server system.
S780, the server system receives the second form from the terminal.
S790, the server system obtains a second YAML file based on the second form and the correspondence.
S791, the server system sends the second YAML file to the terminal.
The method provided by the embodiment realizes the mutual conversion between the YAML file and the form, thereby combining the advantages of the mode of editing the YAML file creation and the mode of creating the form, reducing the use threshold of the YAML creation and reducing the probability of incomplete coverage of the guide type creation parameters.
The step of searching for the various corresponding relations in the above embodiments may be performed by a server system, and the execution subject of the step of searching for the corresponding relations is not limited in this embodiment. The execution body of the search step is illustrated below in connection with the system architecture shown in fig. 1.
In one possible implementation, the correspondence is stored in the memory of the front-end server 140-a. The network interface of the front-end server 140-a receives the YAML file from the terminal and transmits the YAML file to the processor of the front-end server 140-a. The processor of the front-end server 140-a looks up the correspondence saved in the memory based on the received parameters to obtain the attributes of the form component.
In another possible implementation, the correspondence is stored in 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 received parameters in the YAML file, the read request indicating that the attributes of the form component corresponding to the parameters in the YAML file are acquired, and 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, and the processor of the back-end server 140-b searches the corresponding relation stored in the memory of the back-end server 140-b based on the parameters in the received YAML file, so as to obtain the attribute of the form component corresponding to the parameters in the YAML file.
In yet another possible implementation, the correspondence is maintained in a storage system 180 communicatively coupled to the server system. The processor of the back-end server 140-b generates a read request based on the received parameters in the YAML file, the read request indicating that the attributes of the form component corresponding to the parameters in the YAML file are obtained, the processor of the back-end server 140-b indicating that the network interface of the back-end server 140-b send the read request to the storage system 180. The storage system 180 obtains parameters in the YAML file from the read request, looks up the correspondence based on the parameters in the YAML file, obtains the attributes of the form components, and sends the attributes of the form components to the back-end server 140-b.
The YAML file in the various embodiments listed above may be used to instruct the container dispatch system to deploy the container. As an exemplary application scenario for a YAML file, in connection with the architecture shown in fig. 1, the server system 140 sends a request message to the container scheduling system 190, the request message including the YAML file and an application (apply) instruction, the apply instruction instructing the application of the YAML file for resource configuration. The controller of the container dispatch system 190 obtains the YAML file and the apply instruction from the request message, configures resources based on the resource parameters in the YAML file in response to the apply instruction, and manages the containerized application deployed by the user 101 using the configured resources. As a specific example, the parameters of the resources configured by the user in editing the YAML file or form include the number of copies of the container, 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 in accordance with the number of copies and assigns a specified name and a specified type of volume to the pod copies.
The above embodiments are illustrated below in connection with an example.
The following example provides a system architecture for implementing a visualization form based on Angular.
Angular is a TypeScript-based development platform for building modern Web applications. Angular employs a model-view-control (MVC) style architecture to help developers easily manage and organize the logical layers of an application. Components of the Angular architecture include a browser (Web browser), template, component, module (module), bi-directional data binding (data binding), and dependency injection (dependency injection) the browser refers to a Web browser that a user uses to access a website, the Web browser being used to display an interface of an application, thereby presenting a view of the application to the user. the template refers to an HTML file used to represent views in an application. the template is used to generate an interface for the application. The component corresponds to a controller for managing and organizing the logic of the application. modules are a container of components that are used to assemble and organize the various parts of an application.
Two-way data binding (data binding) is a technique for automatically associating a model (model) with a view (view), which can automatically synchronize data in the model into the view and automatically respond to user input operations in the view. This can make code writing simpler and more efficient.
For example, referring to fig. 9, fig. 9 is a schematic diagram of a system architecture according to an embodiment of the present application, where the system architecture shown in fig. 9 includes an editor template 910, a form template 920, a form inter-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.
An editor template is a template of an HTML file. The editor template is used to define a view of the editor for displaying the editor at the browser side. The editor is used to edit the YAML file. In one possible implementation, the editor template is created by an Angular template. An Angular template is an HTML file that describes the structure and style of the build interface. The Angular template contains instructions, bindings, and template expressions for Angular. The Angular template serves as a layer of view for the entire Angular application, which is useful for building dynamic applications.
The form template is a template of an HTML file. The form template is used to define a view of the form to display the form at the browser end. In one possible implementation, the form template is created by an Angular template.
The form inter-rotation module is used for converting the editor template into a form template and converting the form template into the editor template. The form inter-conversion module comprises a hierarchical relation management module, a linkage relation management module, a parameter intelligent identification service and other services.
The hierarchical relationship management module is used for processing hierarchical relationships in the Kubernetes resource configuration file. For example, the Kubernetes resource configuration file is a depoyment file, the resource is a pod, the pod can be configured in the depoyment file, and the hierarchical relationship management module can manage the hierarchical relationship between the depoyment and the pod.
The linkage relation management module is used for processing parameters related to linkage in the Kubernetes resource configuration file. For example, parameters for which there is a linkage relationship include a volume type and a default authority, and when the value of the volume type is set to PVC, the value of the default authority needs to be set to read-only or read-write; when the value of the volume type is set to Secret, the value of the default authority needs to be set to a number representing the authority of the file.
The parameter error intelligent recognition service is used for recommending parameters based on the full parameter key library managed by the resource management center.
The parameter error intelligent recognition service is also used for comparing the input parameter with the reference parameter so as to carry out parameter error recognition prompt. The reference parameter is, for example, a preset parameter, a standard parameter or a parameter in history data. The parameter comparison method is to compare the input parameter with the reference parameter in the dimensions of spelling, name, type, format, range, value, etc.
The resource management center is used for managing resources required by the form inter-conversion module when YAML files and forms are inter-converted. For example, the resources managed by the resource management center include resource configuration files of Kubernetes under different scenes, a full amount of Kubernetes parameter key value library, a correspondence based on when mapping between a parameter value type and a form component type is implemented, a correspondence based on when mapping between a parameter value option and a form component option is implemented, a correspondence based on when linkage mapping is implemented, and a correspondence based on when mapping between a threshold range of parameter values and a threshold range allowed to be configured by the form component is implemented. The Kubernetes parameter key library includes key-value pairs of parameters common in Kubernetes.
Referring to fig. 10, fig. 10 is a flowchart illustrating a method for converting YMAL files into a form according to an embodiment of the present application, where the method shown in fig. 10 includes the following steps.
S810, the user performs an input operation in an editor displayed in the browser, thereby inputting the contents of the YAML file.
S820, the user clicks a button for converting to a form displayed in the editor, triggering an instruction for converting the YAML file to a form. The terminal running the browser responds to the conversion instruction, generates an HTTP request based on the YAML file input in the browser, and sends the HTTP request to the form inter-conversion module, wherein the HTTP request comprises the YAML file and the conversion instruction.
And S830, the form inter-conversion module responds to the conversion instruction, analyzes the YAML file and sends the YAML file to the hierarchical relationship management module and the linkage relationship management module.
S840, the hierarchical relationship management module processes the hierarchical relationships between the parameters in the YAML file, and converts the YAML file into a visual form containing the hierarchical relationships based on the hierarchical relationships between the parameters in the YAML file.
S850, the linkage relation management module processes linkage relations among parameters in the YAML file, converts the YAML file into a visual form containing the linkage relations based on the linkage relations of the parameters in the YAML file, and performs linkage display at the front end.
S860, the parameter error recognition module performs fuzzy query on the parameter keys which cannot be recognized, and recommends the query result to the form for the user to modify and select.
S870, the hierarchical relationship management module returns the form template including the hierarchical relationship to the browser.
S880, the browser renders a form template including the hierarchical relationship.
S890, the linkage relation management module returns the form template comprising the linkage relation to the browser.
S811, the browser renders a form template comprising linkage relations.
S812, the linkage relation management module returns error prompt information and recommended parameters.
S813, the browser renders a form template comprising error prompt information and recommended parameters.
The individual elements of the architecture shown in fig. 9 are described in further detail below.
The editor template is implemented based on a front-end plug-in code editor (code editor). Specifically, the system obtains document object model (Document Object Model, DOM) elements, which are converted into YAML editing software using the codemirror. YAML editing software and a web front-end component realize data bidirectional transfer through bidirectional data binding.
DOM is a standard model representing a document such as HTML that represents the entire document as a tree structure of nodes, each representing an element, attribute, text, or annotation. DOM elements are used to represent elements in a Web page.
One possible implementation of editor interaction with a user is for the editor template (template) to interact through a bi-directional data binding web front end component (component). For example, the browser acts as a (view) layer, rendering the editor on the page, such that the browser presents a view of the editor. The user edits the YAML file through an editor displayed in the browser, and inputs parameters at the modification. The browser (or view) sends the modified parameters to the web front-end component (component) through bi-directional data binding. After the web front-end component obtains the data from the resource configuration center (module), the web front-end component renders the data onto the page through the browser, and typically, the web front-end component (component) sends a submit request (post) to the back-end server through an interface that invokes a Service (module Service), the post request including the YAML file entered in the editor, the post request indicating creation of the resource configuration file.
For example, referring to FIG. 11, FIG. 11 illustrates an architecture in which an editor interacts with a user.
The architecture shown in fig. 11 includes four components, web browser, template, component, module.
A Web browser (Web browser) refers to client software that a user uses to access a Web application, such as Google Chrome or Mozilla Firefox, and the like. The Angular application may be accessed by a browser, entered with a uniform resource locator (Uniform Resource Locator, URL) or jumped to a different page by a hyperlink. The Web browser is responsible for parsing and rendering HTML, CSS, and JavaScript code, presenting a user interface.
Templates (templates) are used to describe how data is displayed and how the user interacts. The template defines a view of a component, and is a piece of HTML code that contains the structure, style, and behavior of the component. The template acts as a data driven role, binding the data of the component and the view of the component so that when the data of the component changes, the template automatically updates the view. Templates may be used to define user interfaces for applications. The templates may contain binding expressions, structure instructions, attribute instructions, etc. to enable the functionality of dynamically generating and updating HTML elements.
A component (component) is a basic building block in an application, which encapsulates some relevant data and behavior, and is associated with a template for generating a part of the user interface. A component may contain other components and may interact with other components by way of input-output attributes, event bindings, and the like. The component is a container for organizing and controlling the interfaces and logic of the application. The component typically contains a template, a controller (e.g., a class), and styles. The component is logic for handling user interactions and data display and may be divided into a plurality of sub-components that form an organic whole.
Modules (modules) are used to organize and manage the different parts of the application. The module may be a page, a function module, or a root module of the entire application. The modules provide a componentization mode for the application program, and each module can be independently developed and deployed, so that the maintenance and expansion of codes are facilitated.
For the relationship between the above four components, the component typically contains one template, and a portion of the user interface may be generated by the template. A component may interact with other components in ways that define input-output properties, event bindings, and the like. A component typically belongs to a certain module and can be declared, exported, and imported in the module. Templates typically contain binding expressions that can reference data in the component and can dynamically update HTML elements based on changes in the data. Modules may import other modules and export components, services, etc. may be used in the imported modules. For example, an application includes a plurality of modules in which components and services are defined. Each component has a template that defines a view of the component. When a user interacts with an application, the component will respond according to the template. Meanwhile, the components can be assembled with other components to form a component tree. In this way, flexible management and extension of applications is facilitated, and code multiplexing and decoupling is facilitated.
The form template is a visual form unidirectional guide, and the form template is visually displayed after being analyzed through key value pairs which can be set by the Kubernetes resource. The principle and architecture of the form template are the same as the editor template.
The form interconversion module is used for realizing interconversion between the YAML file received from the editor and the visual form.
For example, referring to fig. 12, fig. 12 shows a specific flow of the form interconversion module to implement interconversion between the YAML file and the form, where the flow includes the following steps.
S310, inputting a form template into the form.
S321, the form inter-conversion module analyzes the form to obtain the JSON file. The JSON file includes a plurality of key-value pairs. Each key-value pair corresponds to a form component, the key (key) of the key-value pair is the name of the form component, and the value (value) of the key-value pair is the value entered in the form component.
As one possible implementation of parsing the form, the form inter-conversion module obtains names in each form component in the form throughout. The form inter-rotation module obtains the values entered in each form component. The form inter-conversion module stores the name and the input value of the same form component into the key and the value of the key value pair respectively to obtain the key value pair.
As a specific example of the parsing form, one form includes one text box and one drop-down box therein. The text box is named pod name (pod name), the value input in the text box is abc, the name of the drop-down box is mirror pull strategy (image pull policy), and the option selected in the drop-down box is always. The form inter-conversion module obtains the name of the text box and the value input in the text box, and forms the name of the text box and the value input in the text box into a key value pair corresponding to the text box, wherein the format of the key value pair is, for example, pod name: abc.
The form inter-rotation module obtains the name of the drop-down frame and the options selected in the drop-down frame, and composes the name of the drop-down frame and the options selected in the drop-down frame into a key value pair corresponding to the drop-down frame, where the format of the key value pair is image pull policy, for example: always.
S322, the form inter-conversion module converts the JSON file into a YAML file.
For example, the form inter-conversion module reads key value pairs in the JSON file as JSON objects, converts the JSON objects into data in YAML format using a programming language supporting YAML format, such as python, java, etc., writes the converted data in YAML format into a new YAML file, and overlays or creates one YAML file.
S323, the form inter-conversion module outputs the YAML file to be displayed in an editor.
S350, inputting YAML files by the form inter-conversion module.
S361, the form inter-conversion module converts the YAML file into a JSON file.
S362, the form inter-conversion module obtains the key value pairs containing the hierarchical relationship from the JSON file.
S363, the form inter-conversion module searches the corresponding relation between the parameter value type provided by the resource management center and the form component type based on the key value pair.
In one possible implementation, the form inter-rotation module looks up a full-scale key library of parameters of the Kubernetes resource based on the key-value pairs, obtaining keys in the key library that match keys in the key-value pairs. The form inter-conversion module searches the corresponding relation between the key of the parameter and the parameter value type based on the searched key to obtain the parameter value type. And searching the corresponding relation between the parameter value type and the type of the form component based on the parameter value type to obtain the type of the form component. In the case where the type of the form component is found, S364-a described below is performed, and in the case where the type of the form component is not found, S364-b described below is performed.
S364-a, the form inter-conversion module acquires the types of the form components in the corresponding relation so as to generate a form based on the types of the form components.
For example, if the key of the parameter input by the user and the parameter value type are already stored in the full-quantity key library of the parameter of the Kubernetes resource, through the above searching process, the key of the parameter input by the user can be matched with the parameter value type stored in the library, which is helpful for determining the form component matched with the parameter value type, so that the type of the form component accords with the characteristic of the parameter more, and the type of the form component is more accurate.
S364-b, the form inter-conversion module obtains a default form component (such as a text input box) as a form type.
S365, the form inter-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.
S366, the form inter-conversion module outputs the form.
The hierarchical relation management module is used for processing the JSON file, obtaining the hierarchical relation among the parameters from the JSON file, and generating a visual form containing the hierarchical relation based on the hierarchical relation among the parameters.
The linkage relation management module is used for processing linkage relation among parameters in the Kubernetes, identifying key value pairs with linkage relation through linkage relation mapping managed by the resource management center, and automatically adding linkage logic.
The parameter error intelligent identification service is used for carrying out fuzzy query based on the parameter value input by the user to obtain a recommended parameter value. The parameter error intelligent recognition service is also used for comparing the parameter value input by the user with the recommended parameter value so as to recognize whether the parameter value input by the user is an available parameter value.
The embodiments are described below using a simplified front-end engineering example. Front-end engineering in the following example is used to implement web applications for form and YAML interconversions.
Illustratively, the front-end engineering directory structure is as follows.
The meaning of the above directory structure is explained below.
The components represent components of the deposit application in the form of a folder whose path includes src/app/components. The components include YAML editing software (editors) and forms (forms). YAML editing software comprises an HTML file, a TS file and an SCSS file. HTML file editor.component.html is used to save HTML templates for YAML editing software. TS file editor.component.ts is used to save the TypeScript code of the editor component. The TS file editor.component.ts is a component, and the TS file editor.component.ts and the HTML file editor.component.html are subjected to bidirectional data binding. The SCSS file editor.component.scs is used to save the placement location and style of DOM elements in the editor. HTML file form. The TS file form. Component. TS is used to save typeScript code of the form. The document form component. Scss is used to save the placement location and style of DOM elements of form components in the form. TS file form. The TS file form. Component. TS and the HTML file form. Component. HTML are subjected to bidirectional data binding.
services are used to host services in applications and provide form and YAML conversion, hierarchical relationship processing, linkage relationship processing, and error recognition. The data to be processed in the TS file form.component.ts and the TS file editor.component.ts are processed by executing the services. The services include TS file transform.service.ts, TS file layer.service.ts, TS file binding.service.ts, and TS file paramerrer.service.ts. TS file transformation.service.ts is used to implement the conversion between YAML and JSON. TS file layer.service.ts is used to implement the processing of hierarchical relationships. TS file binding.service.ts is used to implement the handling of linkage relations. TS file paramerrer.service.ts is used to implement the service of parameter error recognition.
The modules are used to store the resources required by the services when performing operations. The resources that modules store are, for example, JSON files. For example, modules include JSON file key value. JSON, JSON file key form. JSON, JSON file layer. JSON, and JSON file binding. JSON. JSON file key value. JSON is used to configure key-value pairs in YAML. JSON file key form. JSON is used to configure key-value pairs in the form. JSON file layer. JSON is used to configure the hierarchy of parameters. JSON file binding. JSON is used to configure the linkage relationship of parameters. These JSON files can be provided to operators or developers who can upgrade and maintain forms and editors by modifying JSON files and adding newly added parameters.
The following is an example in connection with a forward scenario. The forward scene represents a scene in which the function of the application is tested by inputting the correct parameters.
The wizard creates a page flow for providing creation of a visual form. The user selects a creation type in a page on which a form is displayed. Loading a form template of a type selected by a user by the system; and the system generates a form comprising a hierarchical relationship, a linkage relationship, form type matching and a verification rule according to the JSON file corresponding to the form template. The form includes guide information, parameter interpretation and high risk cues. The user fills in the form according to the form prompt. The user clicks the ok button, triggering the creation instruction of the configuration file. The terminal running the browser sends a creation request. During this time, if the user finds that the parameters do not meet the requirements, the user may click on the form turn YAML button displayed in the form, triggering an instruction to convert the form into a YAML file. The system converts the form into a YAML file in response to the conversion instructions, and presents the YAML file to a user via YAML editing software. The user follows the key in the YAML editing software: the format of value inputs the required parameters and then the user clicks a button for converting the form displayed in the editor to yacl, triggering an instruction to convert the form to yacl file. The system responds to the conversion instruction, obtains the newly added parameters input in the YAML editing software, converts the YAML file containing the newly added parameters into a form, and displays the form in the page, so that the newly added parameters input before the user can see the page are displayed in the form of a visual form. If the key of the newly added parameter is matched with the corresponding relation between the key of the parameter and the form type, the system generates a form component based on the type of the form component corresponding to the key of the parameter, so that the form type is more accurate. If the key of the newly added parameter is not matched with the corresponding relation between the key of the parameter and the form component type, a text input box is generated by default to configure the parameter.
The following describes a scenario for creating a configuration file of Kubernetes based on YAML editing software.
The system realizes YAML editing software based on a code minor plug-in. A YAML editing software interface is displayed in the browser. The user selects a creation type; loading a built-in YAML template by the system; the user executes the adding operation in the editor and inputs the required parameters; the YAML editing software checks the correctness of the parameters; the user clicks to send a create request. During this time, if the user finds that the parameters are unfamiliar, the user may click on the YAML steering button in the interface. This time division is divided into two cases:
and 1. If the built-in template comprises DOM elements corresponding to the parameter types input by the user, the system generates DOM elements corresponding to the parameter types.
And 2, if no DOM element corresponding to the parameter type input by the user exists in the built-in template, the system generates the DOM element according to the attribute and the text input frame. The attribute is a key of the parameter, and the text input box is used for inputting the value of the text. And, in the conversion process, the prompting of possible misspelling of parameters can be performed according to the fuzzy search technology.
Through the embodiment, firstly, the advantages of the YAML file and the visual form are complemented. Due to the combination of the two modes, the use threshold of YAML creation is reduced, and the probability of incomplete coverage of the wizard-type creation parameters is also reduced.
Secondly, an automatic generation scheme of creating a form through a YAML < - > JSON < - > form component < - > guide is realized, and the manpower maintenance cost is reduced.
Third, the error rate of creating the Kubernetes resource is reduced by front-end controlling the range of values of the Kubernetes resource.
Fourth, the parameter linkage process is automatically processed, thereby reducing invalid redundancy parameters.
Fifth, automatically processing the parameter hierarchy relation, and enhancing the use experience.
The embodiment of the application also provides a form conversion device, as shown in fig. 13, including:
the receiving module is used for receiving a first configuration file and a first conversion instruction from the terminal, wherein the first conversion instruction indicates that the first configuration file is converted into a first form; the conversion module is used for responding to the first conversion instruction and converting the first configuration file into a first form; and the sending module is used for sending the first form to the terminal.
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, the attribute of the first form component matching the first parameter;
a first form is obtained based on the attributes of the first form component, the first form including the first form component.
In one possible implementation, the attribute of the first form component includes at least one of a hierarchy of the first form component in the first form, a type of the first form component, an option in the first form component, a range of values of the first form component, or a hierarchical relationship between the first form component and a second form component in the first form;
the attribute of the first form component matches the first parameter, including at least one of:
the hierarchy of the first form component in the first form matches the hierarchy of the first parameter in the configuration file; or alternatively, the process may be performed,
the type of the first form component is matched with the value type of the first parameter; or alternatively, the process may be performed,
the options in the first form component include candidate values for the first parameter; or alternatively, the process may be performed,
the value range of the first form component falls into the value range of the first parameter; or alternatively, the process may be performed,
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.
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:
in the case where the first parameter and the second parameter have the same hierarchy, the first form component and the second form component are in the same row or the same column; alternatively, 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 boundary is the same as the distance between the second form component and the interface boundary; alternatively, the first form component is the same size as the second form component; or alternatively, the process may be performed,
In the case where the hierarchy of the first parameter is higher than the hierarchy of the second parameter, the first form component and the second form component are in different rows or different columns; alternatively, 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; alternatively, the first form component has a size that is greater than the size of the second form component; alternatively, a second form component is nested within the first form component; or the first form component is in an unfolding state, the second form component is in a visible state, the first form component is in a folding state, and the second form component is in a hiding state.
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 value type of the first parameter is integer, and the type of the first form component is a digital input box or a sliding input bar; or alternatively, the process may be performed,
the value type of the first parameter is a character string, and the type of the first form component is a text input box; or alternatively, the process may be performed,
the value type of the first parameter is Boolean type, and the type of the first form component is a switch; or alternatively, the process may be performed,
The value type of the first parameter is an option, and the type of the first form component is a drop-down frame, a single selection frame or a single selection frame; or alternatively, the process may be performed,
the value type of the first parameter is a point in time and the type of the first form component is a time selection box.
In one possible implementation, the configuration file includes an identification of the first parameter, and the conversion module is configured to perform at least one of:
acquiring a hierarchy of the first parameter based on the identification of the first parameter and a first corresponding relation, wherein the first corresponding relation comprises the identification of the first parameter and the hierarchy of the first parameter; obtaining a hierarchy of first form components based on the hierarchy of first parameters; or alternatively, the process may be performed,
obtaining a hierarchy of the first parameter based on a number of indents before identification of the first parameter in the configuration file or a number of target characters before identification of the first parameter, the target characters including at least one of a colon, a dot number, or a bracket; obtaining a hierarchy of first form components based on the hierarchy of first parameters; or alternatively, the process may be performed,
obtaining the type of the first form component based on the identification of the first parameter and a second corresponding relation, wherein the second corresponding relation comprises the identification of the first parameter and the type of the first form component; or alternatively, the process may be performed,
obtaining a value type of the first parameter based on the identification of the first parameter and a third corresponding relation, wherein the third corresponding relation comprises the identification 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 corresponding relation, wherein the fourth corresponding relation comprises the value type of the first parameter and the type of the first form component; or alternatively, the process may be performed,
Obtaining a candidate value of the first parameter based on the identification of the first parameter and a fifth corresponding relation, wherein the fifth corresponding relation comprises the identification of the first parameter and the candidate value of the first parameter; obtaining an option in the first form component based on the candidate value of the first parameter, the option in the first form component including the candidate value of the first parameter; or alternatively, the process may be performed,
obtaining a threshold value of the first parameter based on the identification of the first parameter and a sixth corresponding relation, wherein the sixth corresponding relation comprises the identification of the first parameter and the threshold value of the first parameter; obtaining a value range of the first form component based on a threshold value of the first parameter; or alternatively, the process may be performed,
the threshold value of the first parameter is obtained from the first configuration file, and the value range of the first form component is obtained based on the threshold value of the first parameter.
In one possible implementation, the configuration file includes a first parameter of Kubernetes resource, a conversion module, configured to obtain an attribute of a second form component based on the first parameter and a seventh corresponding relation, where the seventh corresponding relation includes the first parameter and a second parameter of Kubernetes resource, the second form component is configured to configure the second parameter, and the attribute of the second form component is matched with the second parameter; the first form is obtained 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.
In one possible implementation, the configuration file includes a value of the first parameter, and the conversion module is configured to obtain a value type of the second parameter of the Kubernetes resource based on the value of the first parameter and a seventh correspondence, where the seventh correspondence includes 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 an eighth corresponding relation, wherein the eighth corresponding relation comprises 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 corresponding relation, obtaining a candidate value of the second parameter of the Kubernetes resource, wherein the seventh corresponding relation comprises the value of the first parameter and the candidate value of the second parameter; obtaining an option in the second form component based on the candidate value of the second parameter, the option in the second form component including the candidate value of the second parameter; or, based on the value of the first parameter and a seventh corresponding relation, obtaining a value range of a second parameter of the Kubernetes resource, wherein the seventh corresponding relation comprises the value of the first parameter and the value range of the second parameter; and obtaining the value range of the second form component based on the value range of the second parameter, wherein the value range of the second form component falls into the value range of the second parameter.
In one possible implementation, the configuration file includes an identification of the first parameter, and the apparatus further includes:
the query module is used for querying in a parameter identification library based on the identification of the first parameter, and the parameter identification library is used for storing the identification of the correct spelling of at least one parameter of the Kubernetes resource;
the recommendation module is used for recommending the target parameter identification in response to the fact that the target parameter identification meeting the fuzzy matching condition with the identification of the first parameter is inquired in the parameter identification library; or alternatively, the process may be performed,
and the output module is used for responding that each parameter identifier in the parameter identifier library is not matched with the identifier of the first parameter, outputting prompt information, and indicating that the spelling of the identifier of the first parameter is wrong.
In one 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 also used for sending the second configuration file.
The conversion module, the receiving module and the transmitting module can be realized by software or can be realized by hardware. Illustratively, the implementation of the conversion module is described next by taking the conversion module as an example. Similarly, the implementation of the receiving module and the transmitting module may refer to the implementation of the converting module.
Modules as an example of a software functional unit, the conversion module may include code that runs on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container, among others. Further, the above-described computing examples may be one or more. For example, the translation module may include code that runs on multiple hosts/virtual machines/containers. It should be noted that, multiple hosts/virtual machines/containers for running the code may be distributed in the same region (region), or may be distributed in different regions. Further, multiple hosts/virtual machines/containers for running the code may be distributed in the same availability zone (availability zone, AZ) or may be distributed in different AZs, each AZ comprising a data center or multiple geographically close data centers. Wherein typically a region may comprise a plurality of AZs.
Also, multiple hosts/virtual machines/containers for running the code may be distributed in the same virtual private cloud (virtual private cloud, VPC) or in multiple VPCs. In general, one VPC is disposed in one region, and a communication gateway is disposed in each VPC for implementing inter-connection between VPCs in the same region and between VPCs in different regions.
Modules as an example of hardware functional units, the conversion module may include at least one computing device, such as a server or the like. Alternatively, the conversion module may be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (programmable logic device, PLD), etc. The PLD may be implemented as a complex program logic device (complex programmable logical device, CPLD), a field-programmable gate array (FPGA), a general-purpose array logic (generic array logic, GAL), or any combination thereof.
Multiple computing devices included in the conversion module may be distributed in the same region or may be distributed in different regions. The plurality of computing devices included in the conversion module may be distributed in the same AZ or may be distributed in different AZ. Also, the plurality of computing devices included in the conversion module may be distributed in the same VPC, or may be distributed in a plurality of VPCs. Wherein the plurality of computing devices may be any combination of computing devices such as servers, ASIC, PLD, CPLD, FPGA, and GAL.
The present application also provides a computing device 800. As shown in fig. 14, the computing device 800 includes: bus 802, processor 804, memory 806, and communication interface 808. Communication between processor 804, memory 806, and communication interface 808 is via bus 802. Computing device 800 may be a server or a terminal device. Embodiments of the application are not limited in the number of processors, memories in computing device 800.
Bus 802 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one line is shown in fig. 14, but not only one bus or one type of bus. Bus 804 may include a pathway for transferring information among the various components of computing device 800 (e.g., memory 806, processor 804, communication interface 808).
The processor 804 may include any one or more of a central processing unit (central processing unit, CPU), a graphics processor (graphics processing unit, GPU), a Microprocessor (MP), or a digital signal processor (digital signal processor, DSP).
The memory 806 may include volatile memory (RAM), such as random access memory (random access memory). The processor 804 may also include non-volatile memory (ROM), such as read-only memory (ROM), flash memory, a mechanical hard disk (HDD), or a solid state disk (solid state drive, SSD).
The memory 806 has stored therein executable program code that is executed by the processor 804 to implement the functions of the aforementioned receiving module, converting module, and transmitting module, respectively, to thereby implement a method of converting a configuration file into a form. That is, the memory 806 has instructions stored thereon for performing a method of converting a configuration file into a form.
Communication interface 803 enables communication between computing device 800 and other devices or communication networks using a transceiver module such as, but not limited to, a network interface card, transceiver, etc.
The embodiment of the application also provides a computing device cluster. The cluster of computing devices includes at least one computing device. The computing device may 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 may also be a terminal device such as a desktop, notebook, or smart phone.
As shown in fig. 15, the computing device cluster includes at least one computing device 800. The same instructions for performing the method of converting a configuration file into a form may be stored in memory 806 in one or more computing devices 800 in a cluster of computing devices.
In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also each have stored therein a portion of instructions for performing the method of converting a configuration file into a form. In other words, a combination of one or more computing devices 800 may collectively execute instructions for performing the method of converting a configuration file into a form.
The memory 806 in different computing devices 800 in a cluster of computing devices may store different instructions for performing part of the functionality of the form conversion system, respectively. That is, the instructions stored by the memory 806 in the different computing devices 800 may implement the functionality of one or more of a receiving module, a converting module, and a transmitting module.
In some possible implementations, one or more computing devices in a cluster of computing devices may be connected through a network. Wherein the network may be a wide area network or a local area network, etc. Fig. 16 shows one possible implementation. As shown in fig. 16, two computing devices 800A and 800B are connected by a network. Specifically, the connection to the network is made through a communication interface in each computing device. In this type of possible implementation, instructions to perform the functions of the conversion module are stored in memory 806 in computing device 800A. Meanwhile, instructions to perform the functions of a receiving module and a transmitting module are stored in the memory 806 in the computing device 800B.
The manner of connection between clusters of computing devices shown in fig. 16 may be in consideration of the large amount of data that is required to be stored in order to convert the configuration file provided by the present application into a form, and thus, in consideration of the functionality implemented by the conversion module being performed by computing device 800A.
The functionality of computing device 800A shown in fig. 16 may also be performed by multiple computing devices 800. Likewise, the functionality of computing device 800B may also be performed by multiple computing devices 800.
The embodiment of the application also provides another computing device cluster. The connection between computing devices in the computing device cluster may be similar with reference to the connection of the computing device cluster of fig. 15 and 16. In contrast, the same instructions for performing the profile conversion to form method may be stored in memory 806 in one or more computing devices 800 in the computing device cluster.
In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also each have stored therein a portion of the instructions for performing the method of converting a configuration file into a form. In other words, a combination of one or more computing devices 800 may collectively execute instructions for performing the method of converting a configuration file into a form.
It should be noted that the memory 806 in different computing devices 800 in a cluster of computing devices may store different instructions for performing part of the function of converting a configuration file into a form. That is, the instructions stored in the memory 806 of the different computing devices 800 may implement the functionality of one or more of the means of the receiving module, the converting module, and the transmitting module.
Embodiments of the present application also provide a computer program product comprising instructions. The computer program product may be a software or program product containing instructions capable of running on a computing device or stored in any useful medium. The computer program product, when run on at least one computing device, causes the at least one computing device to perform a method of converting a configuration file into a form, or a method of converting a form into a configuration file.
The embodiment of the application also provides a computer readable storage medium. Computer readable storage media can be any available media that can be stored by a computing device or data storage device such as a data center containing one or more available media. Usable media may be magnetic media (e.g., floppy disks, hard disks, magnetic tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state disk), among others. The computer-readable storage medium includes instructions that instruct a computing device to perform a method of converting a configuration file into a form, or instruct a computing device to perform a method of converting a configuration file into a form.
It should be noted that, in the present description, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different manner from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. For the system or device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant points refer to the description of the method section.
It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (12)

1. A form conversion method, the method comprising:
the terminal displays an interface, wherein the interface comprises an editing area and a first conversion button;
the terminal acquires a first configuration file based on the input operation triggered by the editing area;
the terminal responds to the operation triggered by the first conversion button and sends the first configuration file and a first conversion instruction to a server, wherein the first conversion instruction indicates that the first configuration file is converted into a first form;
the server responds to the first conversion instruction and converts the first configuration file into a first form;
And the server sends the first form to the terminal.
2. The method of claim 1, wherein the configuration file includes a first parameter of a Kubernetes resource, and wherein converting the first configuration file into the first form comprises:
obtaining an attribute of a first form component based on the first parameter, wherein the first form component is used for configuring the first parameter, and the attribute of the first form component is matched with the first parameter;
a first form is obtained based on the attributes of the first form component, the first form including the first form component.
3. The method of claim 2, wherein the attribute of the first form component comprises at least one of a hierarchy of the first form component in the first form, a type of the first form component, an option in the first form component, a range of values of the first form component, or a hierarchical relationship between the first form component and a second form component in the first form;
the attribute of the first form component matches the first parameter, including at least one of:
the hierarchy of the first form component in the first form matches the hierarchy of the first parameter in the configuration file; or alternatively, the process may be performed,
The type of the first form component matches the value type of the first parameter; or alternatively, the process may be performed,
the options in the first form component include candidate values for the first parameter; or alternatively, the process may be performed,
the value range of the first form component falls into the value range of the first parameter; or alternatively, the process may be performed,
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 of claim 3, wherein 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, comprising at least one of:
in the case where the first parameter and the second parameter have the same hierarchy, the first form component and the second form component are in the same row or the same column; alternatively, 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 boundary is the same as the distance between the second form component and the interface boundary; alternatively, the first form component is the same size as the second form component; or alternatively, the process may be performed,
In the case where the first parameter is higher in level than the second parameter, the first form component and the second form component are in different rows or different columns; alternatively, 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; alternatively, the first form component has a size that is greater than the size of the second form component; alternatively, the second form component is nested within the first form component; or the first form component is in an unfolding state, the second form component is in a visible state, the first form component is in a folding state, and the second form component is in a hiding state.
5. A method according to claim 3, wherein the type of the first form component matches the value type of the first parameter, comprising at least one of:
the value type of the first parameter is integer, and the type of the first form component is a digital input box or a sliding input bar; or alternatively, the process may be performed,
the value type of the first parameter is a character string, and the type of the first form component is a text input box; or alternatively, the process may be performed,
The value type of the first parameter is Boolean, and the type of the first form component is a switch; or alternatively, the process may be performed,
the value type of the first parameter is an option, and the type of the first form component is a drop-down frame, a single selection frame or a single selection frame; or alternatively, the process may be performed,
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 the claims 2 to 5, characterized in that the configuration file comprises an identification of the first parameter, the obtaining of the properties of the first form component based on the first parameter comprises at least one of:
obtaining a hierarchy of the first parameter based on the identification of the first parameter and a first correspondence, wherein the first correspondence comprises the identification of the first parameter and the hierarchy of the first parameter; obtaining a hierarchy of the first form component based on the hierarchy of the first parameter; or alternatively, the process may be performed,
obtaining a hierarchy of the first parameter based on a number of indents before identification of the first parameter or a number of target characters before identification of the first parameter in the configuration file, the target characters including at least one of a colon, a dot number, or a bracket; obtaining a hierarchy of the first form component based on the hierarchy of the first parameter; or alternatively, the process may be performed,
Obtaining the type of the first form component based on the identification of the first parameter and a second corresponding relation, wherein the second corresponding relation comprises the identification of the first parameter and the type of the first form component; or alternatively, the process may be performed,
obtaining a value type of the first parameter based on the identification of the first parameter and a third corresponding relation, wherein the third corresponding relation comprises the identification 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 corresponding relation, wherein the fourth corresponding relation comprises the value type of the first parameter and the type of the first form component; or alternatively, the process may be performed,
obtaining a candidate value of the first parameter based on the identification of the first parameter and a fifth corresponding relation, wherein the fifth corresponding relation comprises the identification of the first parameter and the candidate value of the first parameter; obtaining an option in the first form component based on the candidate value of the first parameter, wherein the option in the first form component comprises the candidate value of the first parameter; or alternatively, the process may be performed,
obtaining a threshold value of the first parameter based on the identification of the first parameter and a sixth corresponding relation, wherein the sixth corresponding relation comprises the identification 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 alternatively, the process may be performed,
And 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.
7. The method of any of claims 1 to 6, wherein the profile includes a first parameter of a Kubernetes resource, the converting the first profile to a first form comprising:
obtaining an attribute of a second form component based on the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the first parameter and a second parameter of the Kubernetes resource, the second form component is used for configuring the second parameter, and the attribute of the second form component is matched with the second parameter;
a first form is obtained 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.
8. The method of claim 7, wherein the configuration file includes values of the first parameter, and wherein the obtaining the attribute of the second form component based on the first parameter and the seventh correspondence includes at least one of:
Obtaining a value type of a second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises 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 an eighth corresponding relation, wherein the eighth corresponding relation comprises the value type of the second parameter and the type of the second form component; or alternatively, the process may be performed,
obtaining a candidate value of the second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the value of the first parameter and the candidate value of the second parameter; obtaining an option in the second form component based on the candidate value of the second parameter, the option in the second form component comprising the candidate value of the second parameter; or alternatively, the process may be performed,
obtaining a value range of a second parameter of the Kubernetes resource based on the value of the first parameter and a seventh corresponding relation, wherein the seventh corresponding relation comprises the value of the first parameter and the value range of the second parameter; and obtaining the value range of the second form component based on the value range of the second parameter, wherein the value range of the second form component falls into the value range of the second parameter.
9. The method of any one of claims 1 to 8, wherein the profile includes an identification of the first parameter, the method further comprising:
inquiring in a parameter identification library based on the identification of the first parameter, wherein the parameter identification library is used for storing identification of correct spelling of at least one parameter of the Kubernetes resource;
recommending the target parameter identification in response to the fact that the target parameter identification meeting the fuzzy matching condition with the identification of the first parameter is queried in the parameter identification library; or alternatively, the process may be performed,
and outputting prompt information in response to each parameter identifier in the parameter identifier library not being matched with the identifier of the first parameter, wherein the prompt information indicates that the spelling of the identifier of the first parameter is wrong.
10. The method according to any one of claims 1 to 9, wherein after the server sends the first form to the terminal, the method further comprises:
the terminal displays the first form and the second conversion button;
the terminal responds to the modification operation of the first form to obtain a second form modified based on the first form;
The terminal responds to the operation triggered by the second conversion button and sends the second form and a second conversion instruction to a server, wherein the second conversion instruction indicates that the second form is converted into a second configuration file;
the server responds to the second conversion instruction and converts the second form into a second configuration file;
and the server sends the second configuration file to the terminal.
11. A form conversion method, the method comprising:
the method comprises the steps that a server receives a first configuration file from a terminal and a first conversion instruction, wherein the first conversion instruction indicates that the first configuration file is converted into a first form;
the server responds to the first conversion instruction and converts the first configuration file into a first form;
and the server sends the first form to the terminal.
12. A server comprising at least one processor and at least one memory, the at least one memory having computer program instructions stored therein; the at least one processor executes the computer program instructions to cause the server to perform the method of claim 11.
CN202310747036.5A 2023-06-21 2023-06-21 Form conversion method and server Pending CN116956825A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310747036.5A CN116956825A (en) 2023-06-21 2023-06-21 Form conversion method and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310747036.5A CN116956825A (en) 2023-06-21 2023-06-21 Form conversion method and server

Publications (1)

Publication Number Publication Date
CN116956825A true CN116956825A (en) 2023-10-27

Family

ID=88457390

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310747036.5A Pending CN116956825A (en) 2023-06-21 2023-06-21 Form conversion method and server

Country Status (1)

Country Link
CN (1) CN116956825A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149175A (en) * 2023-10-31 2023-12-01 北京凌云雀科技有限公司 Graphical display method, device, equipment and medium for YAML construction

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149175A (en) * 2023-10-31 2023-12-01 北京凌云雀科技有限公司 Graphical display method, device, equipment and medium for YAML construction
CN117149175B (en) * 2023-10-31 2024-01-19 北京凌云雀科技有限公司 Graphical display method, device, equipment and medium for YAML construction

Similar Documents

Publication Publication Date Title
US10491552B2 (en) Inserting content into an application from an online synchronized content management system
CN112437917B (en) Natural language interface for databases using autonomous agents and thesaurus
US20210027203A1 (en) Action suggestions for user-selected content
JP6279153B2 (en) Automatic generation of N-grams and concept relationships from language input data
CN102521230B (en) For the result type that data with good conditionsi show
CN102368262B (en) Method and equipment for providing searching suggestions corresponding to query sequence
CN100587658C (en) Task-based interface capable of searching control template function
CN102520841B (en) Collection user interface
CN100449485C (en) Information processing apparatus and information processing method
US20070244691A1 (en) Translation of user interface text strings
CN111026319B (en) Intelligent text processing method and device, electronic equipment and storage medium
US20110022635A1 (en) Method and System to Formulate Queries With Minivisuals
CN109960721A (en) Multiple Compression based on source contents constructs content
CN113535165A (en) Interface generation method and device, electronic equipment and computer readable storage medium
CN116956825A (en) Form conversion method and server
US11669513B2 (en) Structured data collection, presentation, validation and workflow management
KR20200040813A (en) Create search result-based listings in a single view
US20190250892A1 (en) Integrating application features into a platform interface based on application metadata
KR20110070724A (en) Apparatus and method for search open api and generation mashup block skeleton code
CN111427577A (en) Code processing method and device and server
CN113568923A (en) Method and device for querying data in database, storage medium and electronic equipment
US20170193119A1 (en) Add-On Module Search System
US9189249B2 (en) Method for automatically defining icons
US11893365B2 (en) Semantic design system
US20120117449A1 (en) Creating and Modifying an Image Wiki Page

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination