CN115081395B - Kubernetes-based visual form and YAML bidirectional conversion method and device - Google Patents

Kubernetes-based visual form and YAML bidirectional conversion method and device Download PDF

Info

Publication number
CN115081395B
CN115081395B CN202210999207.9A CN202210999207A CN115081395B CN 115081395 B CN115081395 B CN 115081395B CN 202210999207 A CN202210999207 A CN 202210999207A CN 115081395 B CN115081395 B CN 115081395B
Authority
CN
China
Prior art keywords
yaml
supported
visual form
visual
structure body
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.)
Active
Application number
CN202210999207.9A
Other languages
Chinese (zh)
Other versions
CN115081395A (en
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.)
Jiangsu Boyun Technology Co ltd
Original Assignee
Jiangsu Boyun Technology 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 Jiangsu Boyun Technology Co ltd filed Critical Jiangsu Boyun Technology Co ltd
Priority to CN202210999207.9A priority Critical patent/CN115081395B/en
Publication of CN115081395A publication Critical patent/CN115081395A/en
Application granted granted Critical
Publication of CN115081395B publication Critical patent/CN115081395B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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

Abstract

The application relates to a Kubernetes-based visual form and YAML two-way conversion method and device, belonging to the technical field of cloud computing, wherein the method comprises the following steps: receiving configuration information based on a first visual form generated by using the first YAML object to obtain a second visual form; deleting key values supported by the visual form in the first YAML object based on the first switching request; constructing the second visual form into a data structure body of a YAML structure, and combining the data structure body with the YAML object structure body without key values to obtain a second YAML object; generating a form structure by using a key value supported by a visual form in a second YAML object based on a second switching request, and deleting the key value in the second YAML object; merging the YAML object structural body and the form structural body after key value elimination; the problem that the resource allocation efficiency and the resource allocation of complex projects cannot be considered at the same time can be solved; the flexibility is improved.

Description

Kubernetes-based visual form and YAML bidirectional conversion method and device
Technical Field
The application relates to a Kubernetes-based visual form and YAML bidirectional conversion method and device, and belongs to the technical field of cloud computing.
Background
Currently, enterprises and developers commonly use kubernets to host applications and services. However, YAML distribution is directly used in most of the usage methods in terms of traffic volume, user volume, and traffic scene.
The way resources are published using YAML is typically: the developer edits the YAML configuration file for resource publishing.
However, the learning cost and trial and error cost of YAML are high for users who do not know the code development, and the direct use of YAML is less flexible in some special scenes (e.g., production environment and more configured environment), which may result in some release hidden troubles and risks.
Disclosure of Invention
The application provides a Kubernetes-based visual form and YAML bidirectional conversion method, which can solve the problems that the configuration efficiency and the configuration of complex projects cannot be considered and the flexibility is poor when the resource configuration is carried out only through YAML or only through the visual form. Based on this, this application provides the following technical scheme:
in one aspect, a kubernets-based visualization form and YAML bidirectional conversion method is provided, and the method includes:
under the condition that a resource creating request is obtained, obtaining a first YAML object corresponding to a visual form, wherein the resource creating request is used for requesting the configuration of a target resource by using the visual form;
generating and displaying a first visualization form using the first YAML object and associating a unique identifier of the first YAML object with the first visualization form;
receiving configuration information input by a user based on the first visual form to obtain a second visual form;
under the condition that a first switching request is obtained, deleting key values supported by a visualization form in the first YAML object to obtain a YAML object structure body after the supported key values are removed, wherein the first switching request is used for requesting to switch from the visualization form to the YAML object to configure the target resource;
constructing the second visual form into a data structure body with a YAML structure, and combining the data structure body with the YAML object structure body to obtain a second YAML object;
under the condition that a second switching request is obtained, generating a form structure body by using a key value supported by a visual form in the second YAML object, and deleting the key value supported by the visual form in the second YAML object to obtain the YAML object structure body without the supported key value; the second switching request is used for requesting to switch from the YAML object to the visual form to configure the target resource;
and combining the YAML object structure body without the supported key values with the form structure body to obtain a form structure body corresponding to a third visual form.
Optionally, deleting a key value supported by a visualization form in the first YAML object, or deleting a key value supported by a visualization form in the second YAML object, to obtain a YAML object structure from which the supported key value is removed, including:
determining, in the first YAML object or the second YAML object, a hierarchy, a key, and an index entry associated with the supported key value;
deleting the supported key values, the associated hierarchy, keys, and index entries.
Optionally, deleting the key values supported by the visualization form in the second YAML object to obtain the YAML object structure from which the supported key values are removed, where the method includes:
and for each key value supported by the visual form in the second YAML object, deleting the key value after the key value is successfully backfilled in a third visual form in a recursive mode.
Optionally, in the case that the second handover request is acquired, the method further includes:
performing page rendering on the third visual form by using the form structure body corresponding to the second YAML object;
monitoring whether the second YAML object is converted into the third visual form or not in a callback mode;
and stopping the page rendering when the completion is finished.
Optionally, the merging the data structure with the YAML object structure comprises:
and mounting the data structure under the corresponding configuration item in the YAML object structure.
Optionally, the merging the YAML object structure without the supported key values with the form structure includes:
and mounting the YAML object structure body without the supported key values to a configuration item corresponding to the form structure body.
Optionally, after the merging the YAML object structure from which the supported key values are removed and the form structure to obtain a form structure corresponding to a third visual form, the method further includes:
responding to a publishing request of a target resource, and converting a YAML object associated with a publishing form into the publishing form in a YAML object corresponding to the target resource; the YAML objects that are not associated with the release form are retained in the YAML character string of the YAML object.
Optionally, the generating and displaying a first visualization form by using the first YAML object includes setting a target key value in a batch YAML structure, and the generating and displaying a first visualization form by using the first YAML object includes:
and converting the target key values into a plurality of configuration items in the first visual form according to the setting mode.
Optionally, in the case of acquiring the resource creation request, before acquiring the first YAML object corresponding to the visualization form, the method further includes:
and declaring initialization YAML objects of various types of resources in Kubernets in a closure environment, wherein the initialization YAML objects comprise first YAML objects corresponding to visualization forms corresponding to the target resources.
In another aspect, there is provided an apparatus for bidirectional conversion of visual forms and YAML based on kubernets, the apparatus comprising:
the system comprises an object acquisition module, a resource creation module and a resource management module, wherein the object acquisition module is used for acquiring a first YAML object corresponding to a visual form under the condition of acquiring a resource creation request, and the resource creation request is used for requesting the configuration of target resources by using the visual form;
the form display module is used for generating and displaying a first visual form by using the first YAML object and associating the unique identifier of the first YAML object with the first visual form;
the information receiving module is used for receiving configuration information input by a user based on the first visual form to obtain a second visual form;
the first switching module is used for deleting a key value supported by a visualization form in the first YAML object to obtain a YAML object structure body after the supported key value is removed under the condition that a first switching request is obtained, wherein the first switching request is used for requesting to switch from the visualization form to the YAML object to configure the target resource;
the first construction module is used for constructing the second visual form into a data structure body of a YAML structure, and combining the data structure body with the YAML object structure body to obtain a second YAML object;
the second switching module is used for generating a form structure by using the key values supported by the visual form in the second YAML object under the condition of acquiring a second switching request, and deleting the key values supported by the visual form in the second YAML object to obtain the YAML object structure after the supported key values are removed; the second switching request is used for requesting switching from the YAML object to the visual form to configure the target resource;
and the second construction module is used for combining the YAML object structure body without the supported key values and the form structure body to obtain a form structure body corresponding to a third visual form.
The beneficial effect of this application includes at least: through the bidirectional conversion between the visual form and the YAML object, the problem that the configuration efficiency and the configuration of complex projects cannot be considered when the resource configuration is carried out only through the YAML or the resource configuration is carried out only through the visual form can be solved; because the user can flexibly and bidirectionally convert the visual form and the YAML object according to the configuration requirement, the efficiency of resource configuration can be improved, the configuration of complex projects can be realized, and the flexibility of resource configuration can be improved.
In addition, after the YAML is switched, configuration items which are not supported by the visual form are added into the YAML, and after the YAML is switched back to the form, additional configuration items can still be stored, so that the consistency of data in the bidirectional switching process can be ensured.
In addition, all successfully backfilled key values are removed from the YAML structure of the second YAML object in a recursive mode, and the consistency of synchronization after the key values are modified in the form can be guaranteed.
In addition, by initializing the visualization form by directly reading the first YAML object, nothing can be filled in the visualization form.
The foregoing description is only an overview of the technical solutions of the present application, and in order to make the technical solutions of the present application more clear and clear, and to implement the technical solutions according to the content of the description, the following detailed description is made with reference to the preferred embodiments of the present application and the accompanying drawings.
Drawings
FIG. 1 is a flow diagram of a method for Kubernetes-based visualization form and YAML two-way transformation provided by one embodiment of the present application;
fig. 2 is a block diagram of an apparatus for bidirectional conversion of a Kubernetes-based visualization form and YAML according to an embodiment of the present application.
Detailed Description
The following detailed description of embodiments of the present application will be made with reference to the accompanying drawings and examples. The following examples are intended to illustrate the present application but are not intended to limit the scope of the present application.
First, a number of terms referred to in the present application will be described.
Container scheduling service (Kubernetes/k 8 s): the cloud computing platform is responsible for managing and scheduling container services, and is a de facto standard for container scheduling and management in the field of cloud computing at present.
YAML: the method is a format with high readability and used for expressing data serialization. YAML is a markup language that is commonly used as a profile. YAML is similar in syntax to other high-level languages and may simply express data forms such as lists, hash tables, scalars, and the like. YAML is suitable for use in expressing or editing data structures, various profiles. The profile suffix for YAML is.yml or.yaml.
Visualization form: including collections of visual User Interface (UI) components such as various types of input boxes, selection boxes, check boxes, and the like.
In a conventional resource configuration mode based on Kubernetes, a user can perform configuration through a visual form. However, only one-way conversion of the visualization form to YAML can be achieved. At this time, because the content of the configuration items supported by the visualized form is limited, the configuration items covered by the YAML after the initial conversion are also limited.
Meanwhile, in the case of the one-way conversion, if the user adds a part allocation to the YAML, the conversion back to the visual form is not possible, and therefore, some complicated configurations cannot be operated through the visual form.
Meanwhile, when the configuration items are more, the form is often processed in steps, and at this time, under the condition that the form is not completely filled, the filling condition of the form content cannot be reproduced after the form is converted into the YAML, so that the experience is not friendly.
Meanwhile, no matter the mode of singly using YAML to carry out resource allocation or the mode of using a visual form to carry out resource allocation, the effect of taking both flexibility and simplification into consideration cannot be achieved in a single scene.
Based on the technical problem, the application provides a Kubernetes-based method for bidirectionally converting a visual form and YAML, the bidirectional conversion between the visual form and YAML can be realized by using the conversion mode, the update iteration of a platform system is usually not fast in iteration speed of k8s, the visual form cannot cover all configuration items, and some highly complex configuration items are not easy to visually render, the bidirectional conversion in the application can ensure that the form is converted back without losing the configuration items after a user inputs the configuration items which are not contained in the YAML, the use process is flexible and convenient, the flexible and easy dual experience is simplified, the use learning cost is reduced, and meanwhile, the flow and the realization of learning k8s and YAML can be accelerated.
The Kubernetes-based visualization form and the YAML bidirectional conversion method provided by the present application are described in detail below. The following embodiments are described by taking as an example that the method is used in an electronic device having a display function and supporting configuration of each resource in kubernets, and the electronic device includes but is not limited to: a computer, a tablet computer, a notebook computer, etc., and the implementation manner of the electronic device is not limited in this embodiment.
Fig. 1 is a flowchart of a method for bidirectional conversion between a kubernets-based visualization form and YAML according to an embodiment of the present application. The method at least comprises the following steps:
step 101, in the case of acquiring a resource creation request, acquiring a first YAML object corresponding to a visualization form, where the resource creation request is used to request configuration of a target resource using the visualization form.
The first YAML object includes configuration items needed to initiate visualization form creation. The first YAML object was declared in Kubernets beforehand. Specifically, under the condition that the resource creation request is obtained, before the first YAML object corresponding to the visualization form is obtained, initialization YAML objects of various types of resources in kubernets are declared in a closure environment, and the initialization YAML objects include the first YAML object corresponding to the visualization form corresponding to the target resource. In other words, the first YAML object is a subset of the initialized YAML objects.
Wherein, the various resources also include but are not limited to: service (service) resources, container (pod) resources, etc. in kubernets, the present embodiment does not limit the types of various resources.
Illustratively, the first YAML object includes, but is not limited to, the following configuration information: the YAML structure of the corresponding resource, the unique identification (which is used for being associated with the visual form and is set as the read-only attribute through defineProperty), and the setting mode of the specific key value in the YAML structure in batch processing.
Wherein, the defineProperty is a method for setting a read-only property in JavaScript.
Specifically, acquiring a first YAML object corresponding to the visualized form includes: the first YAML object is synchronously acquired by the distributor when the visualization form is created.
Step 102, generate and display a first visualization form using the first YAML object, and associate the unique identifier of the first YAML object with the first visualization form.
The first visual form is an initialization form when the target resource is configured. I.e. the visualization form that is displayed when the target resource is configured for the first time. In this application, the visualization form includes a plurality of configuration items and a configuration box corresponding to each configuration item, where the configuration box is used for a user to input configuration information corresponding to the configuration item, and the configuration box includes, but is not limited to: a drop-down box, a check box, an input box, etc., and the present embodiment does not limit the type of the configuration box.
After the first visualization form is initialized, the unique identifier of the first YAML object is assigned to the first visualization form so as to associate the unique identifier of the first YAML object with the first visualization form.
Optionally, in a case where the first YAML object includes a setting manner of a target key value in the batch YAML structure, generating and displaying the first visualization form using the first YAML object includes: and converting the target key values into a plurality of configuration items in the first visual form according to a setting mode.
And 103, receiving configuration information input by a user based on the first visual form to obtain a second visual form.
The second visual form is the first visual form with the configuration information. In other words, the second visual form and the first visual form have the same unique identification.
And 104, deleting the key values supported by the visual form in the first YAML object under the condition of acquiring the first switching request to obtain the YAML object structure body after the supported key values are removed.
The first switch request is used to request a switch from the visualization form to the YAML object for configuration of the target resource. The first switch request may be generated by a user trigger during or upon completion of the user manipulation of the first visualization form. Illustratively, a switching control is arranged in a display page of the first visual form, and the first switching request is generated when a triggering operation acting on the switching control is received.
Specifically, deleting the key values supported by the visualization form in the first YAML object to obtain the YAML object structure body without the supported key values, including: in the first YAML object, determining hierarchy, keys and index items associated with the supported key values; the supported key values, associated hierarchies, keys, and indexing items are deleted.
And 105, constructing the second visual form into a data structure body with a YAML structure, and combining the data structure body with the YAML object structure body to obtain a second YAML object.
Specifically, the electronic device stores in advance a conversion relationship between the form structure of the visual form and the data structure of the YAML structure, and the electronic device constructs the second visual form as the data structure of the YAML structure using the conversion relationship.
In this embodiment, the second YAML object is generated without using the first YAML object for constructing the first visual form, but the data structure body of the YAML structure is reconstructed by using the second visual form, and for the key value that cannot be converted into the first visual form being directly merged with the data structure body, the consistency between the YAML structure and the visual form can be ensured. Such as: and if the form object of the first visual form is provided with the configuration customized in the YAML by the user, and the first visual form does not support the configuration, combining the customized configuration with the regenerated data structure body.
Specifically, merging the data structure with the YAML object structure includes: the data structure is mounted under the corresponding arrangement item in the YAML object structure.
The unique identifier of the second YAML object is the unique identifier of the first YAML object.
And step 106, under the condition that the second switching request is obtained, generating a form structure by using the key values supported by the visualization form in the second YAML object, and deleting the key values supported by the visualization form in the second YAML object to obtain the YAML object structure without the supported key values.
The second switching request is used for requesting switching from the YAML object to the visual form to configure the target resource. The second switching request may be generated by the user during the resource configuration by YAML or when the configuration is completed. Illustratively, a switching control is provided in the configuration page of YAML, and the second switching request is generated upon receiving a trigger operation acting on the switching control.
Deleting key values supported by the visualization form in the second YAML object, wherein the key values comprise: in the second YAML object, determining hierarchy, key and index items associated with the supported key values; the supported key values, associated hierarchies, keys, and indexing items are deleted.
Specifically, deleting the key values supported by the visualization form in the second YAML object to obtain the YAML object structure without the supported key values, including: and for each key value supported by the visual form in the second YAML object, deleting the key value after the key value is successfully backfilled in the third visual form in a recursive mode. In this way, all successfully backfilled key values are removed from the YAML structure of the second YAML object in a recursive manner, and the consistency of synchronization after the key values are modified in the form can be ensured.
At this time, under the condition that a second switching request is obtained, page rendering is carried out on a third visual form by using a form structure body corresponding to a second YAML object; and in the rendering process, backfilling key values supported by the visualization form in the third visualization form. Then, whether the second YAML object is converted into a third visual form is monitored in a callback mode; and stopping page rendering when the page rendering is finished.
The third visual form is converted from the second YAML object, and the unique identifier of the third visual form is the unique identifier of the second YAML object.
And step 107, combining the YAML object structure body without the supported key values with the form structure body to obtain a form structure body corresponding to a third visual form.
Merging the YAML object structure body without the supported key values with the form structure body, comprising the following steps: and mounting the YAML object structure without the supported key values under the configuration item corresponding to the form structure. Thus, if the key values which are not supported by the form and are self-defined by the user exist after the form is removed, the complete structure of the form is reserved and mounted under the form structure. In the process of converting the form into the YAML, if the additional configuration items exist, the configuration items are recursively merged with the form structure generated by the form content, and the correctness of the configuration structure in the YAML is ensured.
Optionally, after the YAML object structure from which the supported key values are removed is merged with the form structure to obtain the form structure corresponding to the third visual form, the method further includes:
responding to a publishing request of a target resource, and converting the YAML object associated with the publishing form into the publishing form in the YAML object corresponding to the target resource; YAML objects that are not associated with a release form are retained in the YAML string of the YAML object. At this time, when a user prepares to publish a plurality of different types of resources in YAML, the YAML object associated with the form is converted into the form, and the unassociated YAML object is marked and then retained in the YAML character string, so that the information of the form configuration and the information of the YAML configuration can be consistent.
In summary, the method for bidirectional conversion between the visualized form and the YAML based on kubernets according to this embodiment can solve the problem that the configuration efficiency and the configuration of the complex project cannot be considered when the resource configuration is performed only through the YAML or only through the visualized form through the bidirectional conversion between the visualized form and the YAML object; because the user can flexibly and bidirectionally convert the visual form and the YAML object according to the configuration requirement, the efficiency of resource configuration can be improved, the configuration of complex projects can be realized, and the flexibility of resource configuration can be improved.
Meanwhile, a bidirectional conversion mode is used, so that the visual form and the YAML can be converted back and forth, the updating iteration of the platform system is not fast in iteration speed of k8s, the visual form cannot cover all configuration items, some highly complex configuration items are not easy to visually render, the bidirectional conversion can ensure that the form is converted back to avoid losing the configuration after a user inputs the configuration items which are not contained in the YAML, the use process is flexible and convenient, the dual experience of flexibility and simplicity and easiness in use are considered, the use learning cost is greatly reduced, and the technology is also a flow and implementation for accelerating the learning of k8s and YAML.
In addition, after the YAML is switched, configuration items which are not supported by the visual form are added into the YAML, and after the YAML is switched back to the form, additional configuration items can still be stored, so that the consistency of data in the bidirectional switching process can be ensured.
In addition, all the successfully backfilled key values are removed from the YAML structural body of the second YAML object in a recursive mode, and the consistency of synchronization after the key values are modified in the form can be ensured.
In addition, by initializing the visualization form by directly reading the first YAML object, nothing can be filled in the visualization form.
FIG. 2 is a block diagram of an apparatus for bidirectional transformation of visual forms and YAML based on Kubernets according to an embodiment of the present application. The device at least comprises the following modules: an object acquisition module 210, a form display module 220, an information receiving module 230, a first switching module 240, a first construction module 250, a second switching module 260, and a second construction module 270.
An object obtaining module 210, configured to obtain a first YAML object corresponding to a visualization form when a resource creation request is obtained, where the resource creation request is used to request that a visualization form is used to configure a target resource;
a form display module 220, configured to generate and display a first visualization form using the first YAML object, and associate a unique identifier of the first YAML object with the first visualization form;
an information receiving module 230, configured to receive configuration information input by a user based on the first visual form, to obtain a second visual form;
a first switching module 240, configured to delete a key value supported by a visual form in the first YAML object under a condition that a first switching request is obtained, so as to obtain a YAML object structure from which the supported key value is removed, where the first switching request is used to request switching from the visual form to the YAML object to perform configuration of the target resource;
the first constructing module 250 is configured to construct the second visualization form into a data structure of a YAML structure, and merge the data structure with the YAML object structure to obtain a second YAML object;
a second switching module 260, configured to, in a case that a second switching request is obtained, generate a form structure using a key value supported by a visualization form in the second YAML object, and delete the key value supported by the visualization form in the second YAML object, to obtain a YAML object structure from which the supported key value is removed; the second switching request is used for requesting switching from the YAML object to the visual form to configure the target resource;
the second building module 270 is configured to merge the YAML object structure without the supported key values with the form structure, so as to obtain a form structure corresponding to a third visual form.
For relevant details reference is made to the above-described embodiments.
It should be noted that: the Kubernetes-based visual form and YAML bidirectional conversion device provided in the above embodiment is only illustrated by the division of the above functional modules when performing Kubernetes-based visual form and YAML bidirectional conversion, and in practical applications, the above function allocation may be completed by different functional modules according to needs, that is, the internal structure of the Kubernetes-based visual form and YAML bidirectional conversion device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus for bidirectional conversion between a visualized form and YAML based on kubernets provided in the foregoing embodiment and the method embodiment for bidirectional conversion between a visualized form and YAML based on kubernets belong to the same concept, and details of a specific implementation process thereof are given in the method embodiment, and are not described herein again.
Optionally, the present application further provides a computer readable storage medium, in which a program is stored, the program being loaded and executed by a processor to implement the kubernets-based visualization form and YAML bidirectional conversion method of the above method embodiment.
Optionally, the present application further provides a computer product including a computer readable storage medium, in which a program is stored, the program being loaded and executed by a processor to implement the kubernets-based visualization form and the YAML bidirectional conversion method of the above method embodiment.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A Kubernetes-based visual form and YAML bidirectional conversion method is characterized by comprising the following steps:
under the condition that a resource creating request is obtained, obtaining a first YAML object corresponding to a visual form, wherein the resource creating request is used for requesting the configuration of a target resource by using the visual form;
generating and displaying a first visual form using the first YAML object, and associating a unique identifier of the first YAML object with the first visual form;
receiving configuration information input by a user based on the first visual form to obtain a second visual form;
under the condition that a first switching request is obtained, deleting key values supported by a visualization form in the first YAML object to obtain a YAML object structure body after the supported key values are removed, wherein the first switching request is used for requesting to switch from the visualization form to the YAML object to configure the target resource;
constructing the second visual form into a data structure body with a YAML structure, and combining the data structure body with the YAML object structure body to obtain a second YAML object;
under the condition that a second switching request is obtained, generating a form structure body by using a key value supported by a visual form in the second YAML object, and deleting the key value supported by the visual form in the second YAML object to obtain the YAML object structure body without the supported key value; the second switching request is used for requesting switching from the YAML object to the visual form to configure the target resource;
and combining the YAML object structure body without the supported key values with the form structure body to obtain a form structure body corresponding to a third visual form.
2. The method of claim 1, wherein deleting key values supported by a visualization form in the first YAML object or deleting key values supported by a visualization form in the second YAML object to obtain a YAML object structure without the supported key values comprises:
determining, in the first YAML object or the second YAML object, a hierarchy, a key, and an index entry associated with the supported key value;
deleting the supported key values, the associated hierarchy, keys, and index entries.
3. The method of claim 1, wherein deleting key values supported by a visualization form in the second YAML object to obtain a YAML object structure after removing the supported key values comprises:
and for each key value supported by the visual form in the second YAML object, deleting the key value after the key value is successfully backfilled in a third visual form in a recursive mode.
4. The method according to claim 3, wherein in case of acquiring a second handover request, the method further comprises:
performing page rendering on the third visual form by using the form structure body corresponding to the second YAML object;
monitoring whether the second YAML object is converted into the third visual form or not in a callback mode;
and stopping page rendering when the page rendering is finished.
5. The method of claim 1 wherein merging the data structure with the YAML object structure comprises:
and mounting the data structure under the corresponding configuration item in the YAML object structure.
6. The method of claim 1, wherein the merging the YAML object structure after removing the supported key values with the form structure comprises:
and mounting the YAML object structure body without the supported key values to a configuration item corresponding to the form structure body.
7. The method of claim 1, wherein after the merging the YAML object structure from which the supported key values are removed and the form structure to obtain a form structure corresponding to a third visual form, the method further comprises:
responding to a publishing request of a target resource, and converting a YAML object associated with a publishing form into the publishing form in a YAML object corresponding to the target resource; the YAML objects that are not associated with the release form are retained in the YAML character string of the YAML object.
8. The method of claim 1 wherein the first YAML object comprises a set of target key values in a batch YAML structure, and wherein generating and displaying a first visualization form using the first YAML object comprises:
and converting the target key values into a plurality of configuration items in the first visual form according to the setting mode.
9. The method according to any one of claims 1 to 8, wherein, in the case of obtaining the resource creation request, before obtaining the first YAML object corresponding to the visualization form, further comprising:
and declaring initialization YAML objects of various types of resources in Kubernets in a closure environment, wherein the initialization YAML objects comprise first YAML objects corresponding to visualization forms corresponding to the target resources.
10. An apparatus for bidirectional conversion of visual forms and YAML based on Kubernetes, the apparatus comprising:
the system comprises an object acquisition module, a resource creation module and a resource management module, wherein the object acquisition module is used for acquiring a first YAML object corresponding to a visual form under the condition of acquiring a resource creation request, and the resource creation request is used for requesting the configuration of a target resource by using the visual form;
the form display module is used for generating and displaying a first visual form by using the first YAML object, and associating the unique identifier of the first YAML object with the first visual form;
the information receiving module is used for receiving configuration information input by a user based on the first visual form to obtain a second visual form;
the first switching module is used for deleting a key value supported by a visualization form in the first YAML object to obtain a YAML object structure body after the supported key value is removed under the condition that a first switching request is obtained, wherein the first switching request is used for requesting to switch from the visualization form to the YAML object to configure the target resource;
the first construction module is used for constructing the second visual form into a data structure body of a YAML structure, and combining the data structure body with the YAML object structure body to obtain a second YAML object;
the second switching module is used for generating a form structure by using key values supported by the visual form in the second YAML object under the condition of acquiring a second switching request, and deleting the key values supported by the visual form in the second YAML object to obtain a YAML object structure from which the supported key values are removed; the second switching request is used for requesting switching from the YAML object to the visual form to configure the target resource;
and the second construction module is used for combining the YAML object structure body after the supported key values are removed and the form structure body to obtain a form structure body corresponding to a third visual form.
CN202210999207.9A 2022-08-19 2022-08-19 Kubernetes-based visual form and YAML bidirectional conversion method and device Active CN115081395B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210999207.9A CN115081395B (en) 2022-08-19 2022-08-19 Kubernetes-based visual form and YAML bidirectional conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210999207.9A CN115081395B (en) 2022-08-19 2022-08-19 Kubernetes-based visual form and YAML bidirectional conversion method and device

Publications (2)

Publication Number Publication Date
CN115081395A CN115081395A (en) 2022-09-20
CN115081395B true CN115081395B (en) 2022-11-01

Family

ID=83245087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210999207.9A Active CN115081395B (en) 2022-08-19 2022-08-19 Kubernetes-based visual form and YAML bidirectional conversion method and device

Country Status (1)

Country Link
CN (1) CN115081395B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131184A (en) * 2020-09-18 2020-12-25 四创科技有限公司 Method for realizing standardized input and output of model and interface thereof
CN112181648A (en) * 2020-09-22 2021-01-05 中国科学院软件研究所 Configuration-driven lightweight hybrid infrastructure platform and data processing method
US20210064644A1 (en) * 2019-08-30 2021-03-04 Google Llc Yaml configuration modeling

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7904801B2 (en) * 2004-12-15 2011-03-08 Microsoft Corporation Recursive sections in electronic forms

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210064644A1 (en) * 2019-08-30 2021-03-04 Google Llc Yaml configuration modeling
CN112131184A (en) * 2020-09-18 2020-12-25 四创科技有限公司 Method for realizing standardized input and output of model and interface thereof
CN112181648A (en) * 2020-09-22 2021-01-05 中国科学院软件研究所 Configuration-driven lightweight hybrid infrastructure platform and data processing method

Also Published As

Publication number Publication date
CN115081395A (en) 2022-09-20

Similar Documents

Publication Publication Date Title
CN111666526B (en) Page generation method, device, equipment and storage medium
CN106708480B (en) Management platform implementation method and device
CN111639287A (en) Page processing method and device, terminal equipment and readable storage medium
CN109634490B (en) List display method, device, equipment and storage medium
CN109375901A (en) Interface message management method, device, computer equipment and storage medium
CN108279882B (en) Framework generation method, device, equipment and computer readable medium
CN114064024A (en) Method, apparatus, device, storage medium, and program product for developing micro-application
CN104750472A (en) Resource bundle management method and device of terminal application
WO2023051125A1 (en) Structured data version management method, apparatus, and related device
CN106371869B (en) IEC61850 configuration software implementation method for bay level equipment of intelligent substation
EP4300303A1 (en) Animation resource information processing method and apparatus, device, medium and product
CN114594927A (en) Low code development method, device, system, server and storage medium
CN112395117B (en) Data processing method, system and storage medium
CN114153473A (en) Module integration method, device, storage medium and electronic equipment
CN115081395B (en) Kubernetes-based visual form and YAML bidirectional conversion method and device
CN114816170A (en) Rule scheme generation method, device, medium and electronic equipment
CN110311826B (en) Network equipment configuration method and device
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
Fujima Building a meme media platform with a JavaScript MVC framework and HTML5
CN115629763A (en) Target code generation method and NPU instruction display method and device
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN114237824A (en) Fault positioning method and device, computer readable medium and electronic equipment
CN115202643A (en) Icon resource deleting method and device, electronic equipment and medium
CN112199075B (en) Intelligent information processing method and framework system based on micro-service
CN114281539A (en) Resource allocation method, system and storage medium

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
GR01 Patent grant
GR01 Patent grant