CN115328496A - File generation method and device - Google Patents

File generation method and device Download PDF

Info

Publication number
CN115328496A
CN115328496A CN202210982835.6A CN202210982835A CN115328496A CN 115328496 A CN115328496 A CN 115328496A CN 202210982835 A CN202210982835 A CN 202210982835A CN 115328496 A CN115328496 A CN 115328496A
Authority
CN
China
Prior art keywords
resource
parameters
pipeline
tekton
kubernets cluster
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
CN202210982835.6A
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202210982835.6A priority Critical patent/CN115328496A/en
Publication of CN115328496A publication Critical patent/CN115328496A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a file generation method which can be applied to the financial field or other fields. The method comprises the following steps: and acquiring a pipeline parameter and an environment parameter of the kubernets cluster. And then, processing the pipeline parameters and the environmental parameters of the kubernets cluster to obtain resource parameters meeting the definition of tekton resources. After obtaining the resource parameters that conform to the tekton resource definition, a resource definition file may be generated based on the resource parameters. The resource definition file may be used to deploy applications on a kubernets cluster. Therefore, by the scheme of the embodiment of the application, the resource definition file can be automatically generated, and compared with the method that a user writes the resource definition file, the efficiency of obtaining the resource definition file is improved.

Description

File generation method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a file generation method and apparatus.
Background
tekton is an open-source kubernets native persistent Integration (CI) CI/Continuous Delivery (CD) system, and can provide a flexible and powerful capability to deploy applications based on kubernets (K8S for short). Implementation of the tekton deployment application requires declaring tekton's custom resources using yaml files, and building deployment of one application requires writing multiple yaml files.
Currently, the time required to write a yaml file is costly, which results in inefficient deployment of applications using tekton, and therefore a solution is urgently needed to solve the above problems.
Disclosure of Invention
In order to solve the above technical problem, an embodiment of the present application provides a file generation method and apparatus.
In a first aspect, an embodiment of the present application provides a file generation method, where the method includes:
acquiring a pipeline parameter and an environment parameter of a kubernets cluster;
obtaining a resource parameter according with tekton resource definition based on the pipeline parameter and the environment parameter;
and generating a resource definition file based on the resource parameters.
Optionally, generating a resource definition file based on the resource parameter includes:
and generating the resource definition file based on the resource parameters and preset system parameters.
Optionally, the method further includes:
defining a tekton pipeline component on the kubernets cluster based on the resource definition file and generating a tekton pipeline;
running the tekton pipeline on the kubernets cluster to implement application deployment.
Optionally, the obtaining of the pipeline parameter includes:
and acquiring the pipeline parameters input by a user through a man-machine interaction interface.
Optionally, the obtaining an environmental parameter of the kubernets cluster includes:
acquiring a designated target kubernets cluster;
and acquiring the environmental parameters of the target kubernets cluster.
In a second aspect, an embodiment of the present application provides a file generating apparatus, where the apparatus includes:
the acquisition unit is used for acquiring a pipeline parameter and an environment parameter of the kubernets cluster;
a determining unit, configured to obtain a resource parameter that conforms to the tekton resource definition based on the pipeline parameter and the environment parameter;
and the first generation unit is used for generating a resource definition file based on the resource parameters.
Optionally, the first generating unit is configured to:
and generating the resource definition file based on the resource parameters and preset system parameters.
Optionally, the apparatus further comprises:
a defining unit for defining tekton pipeline components on the kubernets cluster based on the resource definition file;
a second generation unit for generating a tekton pipeline;
an operation unit, configured to operate the tekton pipeline on the kubernets cluster, so as to implement application deployment.
Optionally, the obtaining the pipeline parameter includes:
and acquiring the pipeline parameters input by a user through a man-machine interaction interface.
Optionally, the obtaining the environmental parameter of the kubernets cluster includes:
acquiring a designated target kubernets cluster;
and acquiring the environmental parameters of the target kubernets cluster.
Compared with the prior art, the embodiment of the application has the following advantages:
the embodiment of the application provides a file generation method, which can be executed by a server side and a client side. The method comprises the following steps: and acquiring the pipeline parameters and the environmental parameters of the kubernets cluster. And then, processing the pipeline parameters and the environmental parameters of the kubernets cluster to obtain resource parameters meeting the definition of tekton resources. After the resource parameters that conform to the tekton resource definition are obtained, a resource definition file may be generated based on the resource parameters. The resource definition file may be used to deploy applications on a kubernets cluster. Therefore, by the scheme of the embodiment of the application, the resource definition file can be automatically generated, and compared with the method that a user writes the resource definition file, the efficiency of obtaining the resource definition file is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a file generation method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a file generation apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Through research, the inventor of the application finds that tekton is an open-source kubernets native continuous integration CI/CD system, and can provide flexible and powerful capability to deploy applications based on kubernets. the implementation of the tekton deployment application requires declaring tekton's custom resources using yaml files, and the building of a deployment application requires writing multiple yaml files.
Currently, yaml files can be written by gorgeous personnel to take advantage of the capabilities provided by tekton to deploy applications based on kubernets. The time and cost required for the research and development personnel to write the yaml file are high, so that the efficiency of using tekton to deploy the application is low, and a scheme capable of solving the problems is urgently needed.
In view of this, the present application provides a file generation method and apparatus.
Various non-limiting embodiments of the present application are described in detail below with reference to the accompanying drawings.
Exemplary method
Referring to fig. 1, the figure is a schematic flowchart of a file generation method provided in an embodiment of the present application. The file generation method shown in fig. 1 may be executed by a terminal device or a server, and the embodiment of the present application is not particularly limited. In the following description, the method is illustrated by the first apparatus as an example.
In this embodiment, the method may include, for example, the steps of: S101-S103.
S101: and acquiring a pipeline parameter and an environment parameter of the kubernets cluster.
The pipeline parameters mentioned in the embodiments of the present application include, but are not limited to: the application to be configured corresponds to product information, production line information, pipeline type, internet Protocol (IP) address of the running server, and other information.
In one example, the user may input the pipeline parameter through the human-computer interaction interface, and accordingly, in the specific implementation, "obtaining the pipeline parameter" may obtain the pipeline parameter input by the user through the human-computer interaction interface.
In yet another example, the pipeline parameter may be pre-configured in the first device in a file form, and accordingly, the "obtaining pipeline parameter" may read the file including the pipeline parameter when implementing specifically, so as to obtain the pipeline information.
In the embodiment of the present application, the environmental parameters of the kubernets cluster include, but are not limited to, an IP address of the kubernets cluster, a version number of the kubernets cluster, a type of the kubernets cluster, and a kubernets resource definition parameter.
In one example, a user may input an environmental parameter of the kubernets cluster through the human-computer interaction interface, and accordingly, in the specific implementation, "obtaining the environmental parameter of the kubernets cluster" may obtain the environmental parameter of the kubernets cluster input by the user through the human-computer interaction interface.
In yet another example, a kubernets cluster to deploy an application may be specified, such as specifying a target kubernets cluster to deploy an application. Accordingly, after determining the target kubernets cluster, the first device may automatically obtain the environmental parameters of the target kubernets cluster. In one example, the first device may read a configuration file of the target kubernets cluster to obtain environmental parameters of the target kubernets cluster.
S102: and obtaining a resource parameter which accords with the tekton resource definition based on the pipeline parameter and the environment parameter.
After the pipeline parameters and the environmental parameters are obtained, resource parameters conforming to the tekton resource definition can be obtained based on the pipeline parameters and the environmental parameters. In one example, the pipeline parameters and the environment parameters may be processed according to a definition specification defined by the tekton resource definition to obtain resource parameters that conform to the tekton resource definition.
In one example, it is contemplated that the resource parameters for the tekton resource definition may include fixed system parameters in addition to pipeline parameters and environmental parameters of the kubernets cluster. Therefore, in one example, in a specific implementation, S102 may generate the resource definition file based on the resource parameter and a preset system parameter. For example, the pipeline parameter, the environment parameter, and the preset system parameter may be processed according to a definition specification of the tekton resource definition, so as to obtain a resource parameter conforming to the tekton resource definition.
In one example, the fixed system parameters may refer to system parameters that define the runtime of the tekton pipeline, which may include, for example: application Programming Interface (API) version, run steps, resource identification, metadata, and the like.
S103: and generating a resource definition file based on the resource parameters.
After the resource parameters conforming to the tekton resource definition are obtained, a resource definition file may be generated based on the resource parameters conforming to the tekton resource definition. In one example, the resource definition file may be generated based on a preset resource definition file template and the resource parameters, for example. For example, the resource parameters may be populated into the template, thereby generating the resource definition file. The resource definition file mentioned here may be, for example, the aforementioned yaml file.
In one example, after obtaining the resource definition file, application deployment may be implemented based on the resource definition file. In one particular example, tekton pipeline components may be defined on the kubernets cluster based on the resource definition file and a tekton pipeline may be generated. Further, the tekton pipeline is run on the kubernets cluster to implement application deployment. Regarding the specific implementation of "defining a tekton pipeline component on the kubernets cluster based on the resource definition file and generating a tekton pipeline", a conventional pipeline component definition and pipeline generation manner may be adopted, and will not be described in detail herein.
In one example, after the application is deployed, the operation condition of the pipeline may be monitored to obtain a pipeline operation log, so as to analyze the operation condition of the application based on the pipeline log in a subsequent step.
According to the above description, the resource definition file can be automatically generated by using the scheme of the embodiment of the application, and compared with the method that a user writes the resource definition file, the efficiency of obtaining the resource definition file is improved.
Exemplary device
Based on the method provided by the above embodiment, the embodiment of the present application further provides an apparatus, which is described below with reference to the accompanying drawings.
Referring to fig. 2, the figure is a schematic structural diagram of a file generation apparatus according to an embodiment of the present application. The apparatus 200 may specifically include, for example: an acquisition unit 201, a determination unit 202, and a first generation unit 203.
An obtaining unit 201, configured to obtain a pipeline parameter and an environment parameter of a kubernets cluster;
a determining unit 202, configured to obtain a resource parameter meeting the tekton resource definition based on the pipeline parameter and the environment parameter;
a first generating unit 203, configured to generate a resource definition file based on the resource parameter.
Optionally, the first generating unit 203 is configured to:
and generating the resource definition file based on the resource parameters and preset system parameters.
Optionally, the apparatus further comprises:
a defining unit for defining tekton pipeline components on the kubernets cluster based on the resource definition file;
a second generation unit for generating a tekton pipeline;
an operation unit, configured to operate the tekton pipeline on the kubernets cluster, so as to implement application deployment.
Optionally, the obtaining the pipeline parameter includes:
and acquiring the pipeline parameters input by a user through a man-machine interaction interface.
Optionally, the obtaining the environmental parameter of the kubernets cluster includes:
acquiring a specified target kubernets cluster;
and acquiring the environmental parameters of the target kubernets cluster.
Since the apparatus 200 is an apparatus corresponding to the method provided in the above method embodiment, and the specific implementation of each unit of the apparatus 200 is the same as that of the above method embodiment, for the specific implementation of each unit of the apparatus 200, reference may be made to the description part of the above method embodiment, and details are not repeated here.
It should be noted that the file generation method and apparatus provided by the present invention can be used in the financial field or other fields. For example, the method can be applied to application deployment scenes in the financial field. Other fields are any fields other than the financial field, for example, the field of computer technology. The above is merely an example, and does not limit the application field of the file generation method and apparatus provided by the present invention.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A method of file generation, the method comprising:
acquiring a pipeline parameter and an environment parameter of a kubernets cluster;
obtaining a resource parameter which accords with tekton resource definition based on the production line parameter and the environment parameter;
and generating a resource definition file based on the resource parameters.
2. The method of claim 1, wherein generating a resource definition file based on the resource parameters comprises:
and generating the resource definition file based on the resource parameters and preset system parameters.
3. The method of claim 1, further comprising:
defining a tekton pipeline component on the kubernets cluster based on the resource definition file and generating a tekton pipeline;
running the tekton pipeline on the kubernets cluster to implement application deployment.
4. The method of claim 1, wherein obtaining pipeline parameters comprises:
and acquiring the pipeline parameters input by a user through a man-machine interaction interface.
5. The method of claim 1, wherein obtaining environmental parameters of a kubernets cluster comprises:
acquiring a designated target kubernets cluster;
and acquiring the environmental parameters of the target kubernets cluster.
6. A file generation apparatus, characterized in that the apparatus comprises:
the acquisition unit is used for acquiring pipeline parameters and environmental parameters of the kubernets cluster;
a determining unit, configured to obtain a resource parameter that conforms to the tekton resource definition based on the pipeline parameter and the environment parameter;
and the first generation unit is used for generating a resource definition file based on the resource parameters.
7. The apparatus of claim 6, wherein the first generating unit is configured to:
and generating the resource definition file based on the resource parameters and preset system parameters.
8. The apparatus of claim 6, further comprising:
a defining unit for defining tekton pipeline components on the kubernets cluster based on the resource definition file;
a second generation unit for generating a tekton pipeline;
an operation unit, configured to operate the tekton pipeline on the kubernets cluster, so as to implement application deployment.
9. The apparatus of claim 6, wherein the fetching of pipeline parameters comprises:
and acquiring the pipeline parameters input by a user through a man-machine interaction interface.
10. The apparatus of claim 6, wherein the obtaining environmental parameters of the kubernets cluster comprises:
acquiring a specified target kubernets cluster;
and acquiring the environmental parameters of the target kubernets cluster.
CN202210982835.6A 2022-08-16 2022-08-16 File generation method and device Pending CN115328496A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210982835.6A CN115328496A (en) 2022-08-16 2022-08-16 File generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210982835.6A CN115328496A (en) 2022-08-16 2022-08-16 File generation method and device

Publications (1)

Publication Number Publication Date
CN115328496A true CN115328496A (en) 2022-11-11

Family

ID=83922885

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210982835.6A Pending CN115328496A (en) 2022-08-16 2022-08-16 File generation method and device

Country Status (1)

Country Link
CN (1) CN115328496A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117806654A (en) * 2024-03-01 2024-04-02 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method
CN117806654B (en) * 2024-03-01 2024-06-07 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117806654A (en) * 2024-03-01 2024-04-02 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method
CN117806654B (en) * 2024-03-01 2024-06-07 杭州云掣科技有限公司 Tekton-based custom cloud native DevOps pipeline system and method

Similar Documents

Publication Publication Date Title
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
CN109542399B (en) Software development method and device, terminal equipment and computer readable storage medium
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
US9892122B2 (en) Method and apparatus for determining a range of files to be migrated
US11151089B2 (en) Compression of log data using pattern recognition
US20200134046A1 (en) Compression of Log Data Using Field Types
US8849947B1 (en) IT discovery of virtualized environments by scanning VM files and images
US20200210829A1 (en) Network off-line model processing method, artificial intelligence processing device and related products
CN107526623B (en) Data processing method and device
CN104965731A (en) Data processing method and electronic terminal
CN114531477A (en) Method and device for configuring functional components, computer equipment and storage medium
CN111984259A (en) Interface creating method, device, equipment and storage medium
CN115001967A (en) Data acquisition method and device, electronic equipment and storage medium
CN110874216B (en) Complete code generation method, device, equipment and storage medium
CN110795353A (en) Debugging method, device and equipment for fast application and storage medium
CN115328496A (en) File generation method and device
CN114443294B (en) Big data service component deployment method, system, terminal and storage medium
CN114461595A (en) Method, device, medium and electronic equipment for sending message
CN106161050B (en) Problem resource indicating device and problem resource indicating method
CN113779122A (en) Method and apparatus for exporting data
US8495033B2 (en) Data processing
CN113065072A (en) Data processing method and system for community marketing management
CN111026466A (en) File processing method and device, computer readable storage medium and electronic equipment
CN113297158B (en) Cloud security product management method, device, equipment and storage medium
CN109388536B (en) Data collection method and device

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