CN115357369B - CRD application integration calling method and device in k8s container cloud platform - Google Patents

CRD application integration calling method and device in k8s container cloud platform Download PDF

Info

Publication number
CN115357369B
CN115357369B CN202211290188.9A CN202211290188A CN115357369B CN 115357369 B CN115357369 B CN 115357369B CN 202211290188 A CN202211290188 A CN 202211290188A CN 115357369 B CN115357369 B CN 115357369B
Authority
CN
China
Prior art keywords
crd
resource
container
information
controller
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
CN202211290188.9A
Other languages
Chinese (zh)
Other versions
CN115357369A (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.)
Zhejiang Lab
Original Assignee
Zhejiang Lab
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 Zhejiang Lab filed Critical Zhejiang Lab
Priority to CN202211290188.9A priority Critical patent/CN115357369B/en
Publication of CN115357369A publication Critical patent/CN115357369A/en
Application granted granted Critical
Publication of CN115357369B publication Critical patent/CN115357369B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses a CRD application integration calling method and device in a k8s container cloud platform, wherein a container application resource object is defined based on a k8s CRD module, and the container application resource object comprises control information and resource information; constructing other CRD resource registration mechanisms, registering other CRD resource information, storing controller information of the CRD resource information, refreshing and reading the controller information, and operating controllers of other CRD resources in a reflection mode, so that the controllers of a plurality of other CRD resources can be operated on the minimum unit for operating the controllers; deploying the controller in K8s, submitting control information and resource information of other registered CRD resources by a user, executing a control logic by the system according to the control information, submitting a corresponding computing task to a K8s container cloud platform according to the resource information, and processing the computing task by the controller of the other registered CRD resources; thereby achieving the purpose of reducing the occupation of resources.

Description

CRD application integration calling method and device in k8s container cloud platform
Technical Field
The invention relates to the technical field of k8s container cloud platforms and CRDs (cloud reference devices) thereof, in particular to a CRD application integration calling method and device in a k8s container cloud platform.
Background
kubernets (k 8s for short) is a container arrangement engine of Google open source, and supports automatic deployment, large-scale scalable and application containerization management. The advent of kubernets greatly simplifies the deployment, operation and maintenance difficulty of large-scale systems. It is currently a large-scale application in the industry, and is the first choice for the container arrangement engine. Meanwhile, with the popularity of the cloud native concept, kubernets, as a cloud native operating system, become a preferred operating platform for cloud native applications.
Cloud native applications run in kubernets, and users can deploy based on built-in deployment, stateful, and the like. Meanwhile, considering various kinds of applications, kubernets provides a CRD (custom resource definition) solution for dealing with applications that are not suitable for deployment through built-in resources. The user can customize the resources through the CRD and then deploy the application through the customized resources.
At present, CRD (cross-domain diagnostics) applications deployed on kubernets are more and more widespread, calling among applications is more and more frequent, and particularly, applications in a pipline mode and a DAG (direct access) mode mostly need to use other resources in the kubernets to process tasks. The method comprises the steps that deployment of applications is achieved based on a CustomResourceDefinition technology of kubernets, each CRD not only needs to give definition of CustomResourceDefinition, but also needs to run a contoller program, one contoller program generally runs in one pod in the kubernets, functions of the contoller programs are similar, interaction is conducted between the kubernets client and an api server, states of running resources are monitored, and adjustment is made. The more CRD applications deployed, the more computing resources are occupied, and the maintenance cost is also increased.
Disclosure of Invention
In order to solve the defects of the prior art, the resource control of a called party is realized in an interface expansion mode, the centralized management of a CRD controller is realized through a registration mechanism, and finally, when a plurality of custom resources are required to be deployed in kubernets, the aims of reducing the maintenance cost and reducing the resource occupation are realized, the invention adopts the following technical scheme:
a CRD application integration calling method in a k8s container cloud platform comprises the following steps:
step S1: constructing a container CRD application system, defining a container application conterminagrappication Resource object based on a self-defined Resource definition CRD module of a container arrangement engine k8s, wherein the container application conterminagrappication Resource object comprises control information and Resource information, and the Resource information is used for referring to other CRD resources; defining a controller, namely a container application, controlling an execution step of a calculation task according to the type of control information, and calling other CRD (Resource description) resources according to Resource information to complete the calculation task;
step S2: in the container CRD application system, a registration mechanism of other CRD resources is constructed, information of other CRD resources uploaded by a user is acquired and registered, controller information of the registered other CRD resources is stored and refreshed, the stored controller information is read, and controllers of other CRD resources are operated in a reflection mode, so that a plurality of controllers of other CRD resources can be operated on a minimum unit pod for operating the controllers. After registering other CRDs, the user can write the file of the resource request, and the execution of the task is completed by the cooperation of the container CRD application and the CRD application registered on the container CRD application. The controller of the container CRD application system and the controllers of other registered CRD applications are integrated into the same system, all CRD control logics are operated in the same unit pod, and the registered applications can be operated in kubernets without being separately deployed;
and step S3: deploying a controller of the container application to a K8s container cloud platform, submitting a yaml configuration file by a user, wherein the yaml configuration file comprises control information and Resource information of other registered CRD resources, executing control logic according to the control information after monitoring the yaml configuration file by the controller of the container CRD application system, submitting a corresponding computing task to the K8s container cloud platform according to the Resource information, and processing the computing task by the controller of the other registered CRD resources.
Further, in the step S1, the control information includes types of step fields steps, pipeline fields pipeline, directed acyclic graph fields DAG, and the like, a controller, a container application, completes control logic according to the control information, when the step fields steps are started, the corresponding resources run the resource nodes in parallel, and the resource nodes are submitted to the k8S container cloud platform in parallel; when the pipeline field pipeline is started, scheduling execution is carried out according to the resource node sequence defined in the pipeline field pipeline, and the resource nodes are submitted to a k8s container cloud platform step by step; when the directed acyclic graph field DAG is started, constructing an execution sequence of the resource nodes according to the dependency relationship in the directed acyclic graph field DAG; the Resource node is the user-defined Resource and/or other CRD resources represented by the Resource information.
And further, executing the computing task according to the content of the Resource node, wherein for the computing task of the container type, a minimum unit pod is started in the k8s container cloud platform to execute the task, and for the computing task of the Resource type, other registered CRD resources are started in the k8s container cloud platform to execute the task according to the type of the Resource information.
Further, the step 2 comprises the following steps:
step S2.1: the method comprises the following steps of constructing an interface and acquiring CRD application information uploaded by a user through the interface, wherein the steps of: registering CRD source information, CRD definition file, resource object content declaration file type. Go and CRD controller file;
step S2.2: storing and verifying CRD application information;
step S2.3: generating a resource template, namely, a resource template, including resource object definition information, according to the uploaded resource object content declaration file type.go, and generating subclasses of a plurality of resource templates when a plurality of CRD applications are uploaded;
step S2.4: and when the CRD is registered, synchronously refreshing the associated container map, reading the CRD controller files stored by the associated container map, and operating the controller in a reflection mode, so that a plurality of sub-controllers of other registered CRD resources can be operated on the minimum unit pod for operating the controller.
Further, in step S2.1, an interface is set in the controller, and an agent is set for the minimum unit pod, so that the interface runs on the minimum unit pod where the controller is located, and is exposed to the outside through the service component of k 8S.
Further, in step S2.3, the resource object definition information includes a type.go file of the resource object content declaration, and when the user uses the file, writing the yaml configuration file may use field information given in the type.go of the CRD.
Further, in step S2.3, the resource template generated also includes other control information, and the addition, deletion, modification and check are set in a manner of interface expansion, so that through the interface, not only can registration be completed, but also user-defined service logic can be realized, and the purpose of user-defined control can be achieved.
Further, the step S3 includes the steps of:
step S3.1: a user writes a yaml configuration file, the type of the yaml configuration file is container application, and the yaml configuration file comprises control information and Resource information of other registered resources;
step S3.2: a controller of the container CRD application system monitors the yaml configuration file and controls the execution sequence of the calculation tasks according to the control information;
step S3.3: for a container type computing task, starting a minimum unit pod to execute the task in a k8s container cloud platform;
step S3.4: and for the Resource type computing task, starting other registered CRD resources in the k8s container cloud platform to execute the task according to the type of the Resource information.
Further, in step S3.4, the controller parses the Resource type calculation task into a Resource template, creates an add/delete modification task, submits Resource object information of other registered CRD resources in the Resource template, and the controller of the other registered CRD resources processes the calculation task; and/or when the resource template contains other control information customized by the user, the control logic uploaded by the user needs to be loaded and processed.
A CRD application integration calling device in a k8s container cloud platform comprises a memory and one or more processors, wherein executable codes are stored in the memory, and when the one or more processors execute the executable codes, the CRD application integration calling device is used for realizing the CRD application integration calling method in the k8s container cloud platform.
The invention has the advantages and beneficial effects that:
the invention firstly realizes a container CRD application, integrates other CRD applications into the container CRD in a registration mode, and realizes the function combination of two CRD resources in one pod for operation. The method mainly relates to the integration of two parts, namely the integration of CRD API object declaration and the integration of CRD controller function. However, in the conventional CRD application a, to call the CRD application B to complete the task, the application a and the application B need to be deployed in a customresource definition technical manner of kubernets, respectively. In kubernets, a pod needs to be started for each CRD application to run its controller program. As the kinds of CRD applications are more, the more pod is used to run the CRD controller program, the more computing resources are occupied. After the integration scheme of the invention is adopted, other types of CRD applications are registered in the container CRD application through providing a registration interface, so that the aim of operating the registered controller programs of other CRDs in the pod for operating the container CRD controller program is fulfilled. This allows control of multiple CRD applications in one pod. After the CRD integrated calling method is adopted, not only is the resource occupation reduced, but also the format of the yaml configuration file written by a user is more friendly.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Fig. 2 is a flowchart of the operation of the container CRD in the embodiment of the present invention.
Fig. 3 is a flowchart of the operation of the program when the container is integrated according to the embodiment of the present invention.
Fig. 4 is a processing flow diagram after the system integrates multiple CRD applications in the embodiment of the present invention.
Fig. 5 is a schematic diagram of the structure of the device of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
As shown in fig. 1, a CRD application integration calling method in a k8s container cloud platform includes the following steps:
step S1: constructing a container CRD application system, defining a CRD module based on the self-defined Resource of a container arranging engine k8s, and defining a container application ContainerApplication Resource object which comprises control information and Resource information, wherein the Resource information is used for referring to other CRD resources; defining a controller, namely a container application controller, controlling the execution step of the calculation task according to the type of the control information, and calling other CRD resources to complete the calculation task according to Resource information;
the control information comprises step fields (steps), pipeline fields (pipeline) and directed acyclic graph fields (DAG), a controller (controller) of the container application completes control logic according to the control information, when the step fields (steps) are started, corresponding resources run resource nodes in parallel, and the resource nodes are submitted to a k8s container cloud platform in parallel; when the pipeline field pipeline is started, scheduling execution is carried out according to the resource node sequence defined in the pipeline field pipeline, and the resource nodes are submitted to a k8s container cloud platform step by step; when the directed acyclic graph field DAG is started, constructing an execution sequence of the resource nodes according to the dependency relationship in the directed acyclic graph field DAG; the Resource nodes are other CRD resources represented by the self-defined resources and/or Resource information.
And executing computing tasks according to the content of the Resource nodes, wherein for the computing tasks of the container type, a minimum unit pod is started in the k8s container cloud platform to execute the tasks, and for the computing tasks of the Resource type, other registered CRD resources are started in the k8s container cloud platform to execute the tasks according to the type of the Resource information.
In the embodiment of the present invention, a container CRD application is developed based on a customresource definition technology of kubernets, as shown in fig. 2, for describing a life cycle of the whole container CRD, specifically as follows:
firstly, defining a Resource object named as ContainearrApplication in kubernets, submitting a CustomResourceDefinition definition named as ContainerApplication, then writing the detailed content of the ContainearrApplication Resource object, internally giving several fields such as steps, pipeline, DAG and the like as control fields, and simultaneously giving the field of Resource as the reference of other CRD resources
Figure 45727DEST_PATH_IMAGE001
Submitting the definition through a client of the kubernets, the kubernets will store the definition in the etcd.
After the resource object is defined, it is necessary to implement a control logic for the resource object, and implement a custom controller named as conteierapphcation-controller, and at this time, it is necessary to give specific contents of the resource object, and write conteierapphcation _ type go, which includes the following contents:
Figure 697288DEST_PATH_IMAGE002
go needs to be written after the specific content of the resource object is defined, so that clients of kubernets can know the API object of the conterminedrappplication type.
The next step is to realize the control logic of the controller, and the main function of the controller is to make corresponding control logic according to the resources submitted by the user through the communication between the client and the kubernets. The control logic is as follows: if the contents are of a Steps type, starting corresponding resource parallel operation nodes, and submitting the nodes to kubernets in parallel; scheduling and executing the content of the pipeline type according to the node sequence defined in the pipeline, submitting the nodes to kubernets step by step, and submitting the next node after the previous node is executed; for the DAG type application, the dependency relationship between the nodes needs to be guaranteed, an execution sequence is built according to the dependency relationship, and the internal nodes are executed according to the dependency relationship built by the Dependencies in the type. The specific running node can be a custom Resource such as job, container and the like, and can also be other CRD resources represented by a Resource field; the execution node content is the content of the task type, for a Container task in the task, a pod execution task is started in kubernets through a client, and for a task of the Resource type, other CRD application tasks registered on the system are submitted to the kubernets according to the Resource type.
The function of the controller is mainly the control logic of the container, and does not relate to the calling logic of the container to the child container registered thereon, and the control logic of the container itself is implemented specifically according to the function, for example: for a pipeline type application, each node in the pipeline represents an execution step, and may need to call other types of resources to execute, and the container CRD controller needs to control the execution sequence of the nodes in the pipeline.
Step S2: in the container CRD application system, a registration mechanism of other CRD resources is constructed, information of other CRD resources uploaded by a user is acquired and registered, controller information of the registered other CRD resources is stored and refreshed, the stored controller information is read, and controllers of other CRD resources are operated in a reflection mode, so that a plurality of controllers of other CRD resources can be operated on a minimum unit pod for operating the controllers, after the other CRDs are registered, the user can write a file of a resource request, and the execution of a task is completed by cooperation of the container CRD application and the CRD application registered on the container CRD application. The controller of the container CRD application system and the controllers of other registered CRD applications are integrated into the same system, all CRD control logics are operated in the same unit pod, and the registered applications can be operated in kubernets without being separately deployed;
in the embodiment of the present invention, a specific implementation process for registering another CRD application is specifically given in conjunction with fig. 3. In this step, the development of the restful interface needs to be completed, the user completes the registration process through the restful interface, and also needs to implement the definition of an interface class, the user defines the control logic of the container CRD to the CRD application registered thereon by the method of implementing the interface, if the control logic is not defined, the system executes the add-delete-check operation by default. And finally, the registration and life cycle management work of the CRD controller program to be registered is completed, so that the operation of the registered CRD controller can be completed in the pod where the container CRD controller is located, and the effect of effectively reducing the resource reuse is achieved.
Other CRDs here must be developed based on CustomResourceDefinition technology, and can be independently deployed in CRD applications of kubernets.
Specifically, step S2 includes the steps of:
step S2.1: the method for constructing the interface and acquiring the CRD application information uploaded by the user through the interface comprises the following steps: registering CRD source information, CRD definition file, resource object content declaration file type. Go and CRD controller file;
and setting an interface in the controller and setting an agent for the minimum unit pod, so that the interface runs in the minimum unit pod where the controller is located and is exposed to the outside through the service component of k8 s.
In the embodiment of the invention, a Restful interface needs to be developed, so that a user can complete the registration of the CRD application by accessing the API interface. An API (application programming interface) named as register CRD (client CRD) is developed in the contacts application-controller, but due to the characteristics of kubernets, the port opened in the pod cannot be accessed outside the cluster, so that service resources need to be written and used as a proxy of the pod, so that the Restful interface runs in the pod where the contacts application-controller is located, and is exposed to the outside in a node port or LoadBalancer mode of the service of kubernets. In addition thereto, the ingress means can be used to provide access to the outside.
Service is an abstraction of a group of Pod, although Pod can directly reach through IP in a cluster, the Pod is unstable and may be frequently dead, and the cluster restarts a Pod, which is a new Pod, and its IP address changes, which is not favorable for client access. In order to solve the problem, kubernetes introduces a Service component, the Service access modes created for the Kubernetes are stable from the beginning of the Pod creation to the artificial deletion, namely the access IP of the Kubernetes is unchanged, and then the Kubernetes is matched with the DNS Service built in the cluster, so that a client can access to a target Pod by using the unchanged Service name or the Service IP, and the Service also realizes a simple load balancing function.
The access port needs to upload the data of some CRD applications, which mainly includes the source information such as version, name, etc. for registering CRD, and the content such as CRD definition file, resource object content declaration file type.
As shown in table 1, the field information that the call interface must upload is listed.
Table 1 calling CRD information uploaded by interface
Figure DEST_PATH_IMAGE003
In addition, the control field and the corresponding control logic program can be uploaded.
Step S2.2: storing and verifying CRD application information;
in the embodiment of the invention, after the data is uploaded through the interface, the zip compressed packet needs to be decompressed and stored in the fixed directory, and the directory needs to mount the persistent pv. Meanwhile, a configmap resource is created in kubernets and used for storing information just uploaded by a user and a decompressed directory address of a zip code compressed packet. And simultaneously, the integrity of the data and the record in the configmap are detected in the step, the detected content mainly comprises the integrity of the uploaded information, whether the code address is accurate or not, whether repeated registration is performed or not is checked in the configmap, and the registration failure information is returned for version conflict and data loss. The configmap is mounted to the pod corresponding to the content application-controller in a mounting manner, so that the configmap can be operated in the pod.
The client submits the CustomResourceDefinition definition file of the CRD application to be registered to the kubernets cluster for operation, so that the CRD application can be used through the api interface of the kubernets.
Step S2.3: generating a resource template, namely, a resource template, including resource object definition information, according to the uploaded resource object content declaration file type.go, and generating subclasses of a plurality of resource templates when a plurality of CRD applications are uploaded;
the resource object definition information contains a type.go file of resource object content declaration, and when the user uses the resource object definition information, the field information given in the type.go of the CRD can be used for writing the yaml configuration file.
The generated resource template also contains other control information, and the increase, deletion, modification and check are set in an interface expansion mode, so that not only can registration be completed, but also user-defined service logic can be realized through the interface, and the purpose of user-defined control is achieved.
In the embodiment of the invention, a ResourceTemplate node definition is generated according to the uploaded content of the CRDType, the ResourceTemplate adopts an object-oriented inheritance mode, if a plurality of CRD applications are uploaded, subclasses of a plurality of ResourceTemplates can be generated, and other control variables can be added to the field information except type. Go, the field information given in CRD type can be used when the user is using it to write a yaml file.
Specifically, resource template type information is generated according to the uploaded information of the type.go file of the sub-CRD, so that when a user uses the resource template, the resource object definition information of the type.go file of the CRD can be used for writing yaml files, and other control variables can be added to the resource template besides the field information of the type.go.
If the resource template information is generated, other control fields are added, and the control fields need to be correctly processed in a context application-controller class, so that a user-defined control method needs to be realized, the design is carried out in an interface expansion mode, and a user needs to realize the business logic of adding, deleting, modifying and checking, so that the purpose of user-defined control is achieved.
Besides the function of registering the third party CRD, the functions of adding, deleting, modifying, checking and the like also need to be provided correspondingly, and the functions all need to provide services externally in the form of a restful interface, so that a user can complete not only registration but also other item operations such as CRD application deletion and the like through an api interface.
Step S2.4: storing CRD controller files of other registered CRD resources into an associated container map, wherein the associated container map stores all CRD controller files of the registered CRD resources, when the CRD is registered, the associated container map is synchronously refreshed, the CRD controller files stored by the associated container map are read, and a controller is operated in a reflection mode, so that a plurality of sub-controllers of the other registered CRD resources can be operated on a minimum unit pod for operating the controller;
in the embodiment of the invention, the controller registration part of the CRD stores the related function code information of the controller of the registered CRD into a map, the map stores the controller information of all the registered CRDs, when one CRD is registered, synchronous refreshing is needed, at this time, the controller information in the map is read, the code of the controller is operated in a reflection mode, mainly a newController method is operated, an object is returned, and then the run method is operated. In this way, a plurality of child CRD controllers registered thereon can be run in a pod running the conterminedrappliction-controller. And adding a logic function for controlling the state of the registered resource, updating the configmap to complete registration, and otherwise, returning registration failure.
And step S3: deploying a controller of the container application to a K8s container cloud platform, submitting a yaml configuration file by a user, wherein the yaml configuration file comprises control information and Resource information of other registered CRD resources, executing control logic according to the control information after monitoring the yaml configuration file by the controller of the container CRD application system, submitting a corresponding computing task to the K8s container cloud platform according to the Resource information, and processing the computing task by the controllers of the other registered CRD resources.
In the embodiment of the invention, after the control function and the registration function development of the contact application-controller are completed, the control function and the registration function need to be deployed to kubernets next step, and for this reason, a user uses the functional flow of the system, packs the container CRD controller with complete written functions into a mirror image and deploys the mirror image to the kubernets; specifically, a docker file needs to be written according to the code and the operating environment, and then a docker mirror image is constructed. And then submitting the content application-controller to a kubernets system in a deployment form, so that the development of the content application CRD is completed, and the system is used in the next step.
The user creates resources by writing yaml containing the registered CRD application, and after the yaml file is submitted to kubernets, the Controller program of the container CRD application performs corresponding processing according to the control flow. The user writes a resource creation file of the yaml type, the kind type is connection, the content in the resource field of the execution node is the use of CRD resource registered by the user, after the system is submitted, the connection-controller program monitors the content of the user yaml file and executes related codes according to the control logic, the resource field in the node represents the object operation for registering CRD, the corresponding submission task is sent to kubernets, and the controller program of the registered CRD performs corresponding processing.
The processing flow of the user submitting task specifically comprises the following steps:
step S3.1: a user writes a yaml configuration file, the type of the yaml configuration file is container application, and the yaml configuration file comprises control information and Resource information of other registered resources;
in the embodiment of the present invention, a user writes a xml file, the type of kind is contact application, the content in the field resource is the use of CRD registered by the user, and the following example gives the content of a xml file:
Figure 539342DEST_PATH_IMAGE004
step S3.2: a controller of the container CRD application system monitors the yaml configuration file and controls the execution sequence of the calculation tasks according to the control information;
in the embodiment of the invention, after the system is submitted, the content application-controller program monitors the content of the user xml file and controls logic to execute node tasks in parallel according to the step node information.
Step S3.3: for a container type computing task, starting a minimum unit pod to execute the task in a k8s container cloud platform;
in the embodiment of the invention, if the task-1 task is a container type, a pod is started in kubernets to run, in the example, a python script is run, and a digital addition is calculated.
Step S3.4: for the Resource type computing task, starting other registered CRD resources in a k8s container cloud platform to execute the task according to the type of Resource information;
the controller analyzes the Resource type calculation task into a Resource template, creates an adding, deleting, modifying and searching task, submits Resource object information of other registered CRD resources in the Resource template to a k8s container cloud platform, and processes the calculation task by the controller of the other registered CRD resources; and/or when the resource template contains other control information customized by the user, the control logic uploaded by the user needs to be loaded and processed.
In the embodiment of the invention, for the task-2 task, if the task is a resource type node, the controller program can analyze the content of the node into a resource template, and then analyze whether the resource template has a user-defined field, if so, the processing logic uploaded by the user needs to be loaded for realization and processing according to the kind attribute value. If not, the creation, deletion, addition and modification tasks submit the CRD object information in the resourceTemplate to kubernets. For MyCRDJob type resources, the relevant control logic has been started in the contact application-controller by registering CRD, so the registered controller program will make corresponding processing, this task is to start a pod and run the perl command.
Specifically, as shown in fig. 4, from the perspective of using the system, the submission of the yaml file containing the sub-application declaration is described, then the container CRD controller parses the information, the container CRD controller invokes the control logic of the targeted sub-resource, and the sub-CRD controller completes the synchronization operation of the final resource.
Through the above description, for an application that needs to call other CRDs to complete a task, for example, an application of a pipeline type, a pipeline definition may be declared in a containerppplication CRD, each step in the pipeline declares to call other CRD applications to complete a computation task, after a user submits task content through a xml file, a controller of the containerppplication may control nodes in the pipeline to execute step by step according to a written control logic, a corresponding CRD task may be created through a kubernets client when a single node executes, and then the controller of the corresponding CRD performs corresponding processing, so that the whole scheduling process may be completed in the same pod, thereby effectively saving computation resources, and simultaneously expanding a control manner.
Meanwhile, the temporality of the pod content is considered, data needs to be persisted, and information such as registered CRD related files needs to be persisted, so that the registered CRD content can be automatically added when the pod is re-created, and the purpose of system robustness is achieved.
Corresponding to the embodiment of the CRD application integration calling method in the k8s container cloud platform, the invention also provides an embodiment of a CRD application integration calling device in the k8s container cloud platform.
Referring to fig. 5, the CRD application integration calling apparatus in a k8s container cloud platform according to an embodiment of the present invention includes a memory and one or more processors, where the memory stores executable codes, and when the one or more processors execute the executable codes, the one or more processors are configured to implement the CRD application integration calling method in the k8s container cloud platform according to the foregoing embodiment.
The embodiment of the CRD application integration calling device in the k8s container cloud platform can be applied to any equipment with data processing capability, and the any equipment with data processing capability can be equipment or devices such as computers. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for running through the processor of any device with data processing capability. From a hardware aspect, as shown in fig. 5, the present invention is a hardware structure diagram of any device with data processing capability where a CRD application integration calling apparatus in a k8s container cloud platform is located, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 5, in an embodiment, any device with data processing capability where the apparatus is located may also include other hardware according to an actual function of the any device with data processing capability, which is not described herein again.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement without inventive effort.
The embodiment of the invention also provides a computer-readable storage medium, wherein a program is stored on the computer-readable storage medium, and when the program is executed by a processor, the CRD application integration calling method in the k8s container cloud platform in the embodiment is realized.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any data processing capability device described in any of the foregoing embodiments. The computer readable storage medium may also be any external storage device of a device with data processing capabilities, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the computer readable storage medium may include both an internal storage unit and an external storage device of any data processing capable device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing-capable device, and may also be used for temporarily storing data that has been output or is to be output.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A CRD application integration calling method in a k8s container cloud platform is characterized by comprising the following steps:
step S1: constructing a container CRD application system, defining a container application conterminagrappication Resource object based on a self-defined Resource definition CRD module of a container arrangement engine k8s, wherein the container application conterminagrappication Resource object comprises control information and Resource information, and the Resource information is used for referring to other CRD resources; defining a controller, namely a container application controller, controlling the execution step of the calculation task according to the type of the control information, and calling other CRD resources to complete the calculation task according to Resource information;
step S2: in the container CRD application system, constructing a registration mechanism of other CRD resources, acquiring information of other CRD resources uploaded by a user, registering the information, storing and refreshing controller information of the registered other CRD resources, reading the stored controller information, and operating the controllers of the other CRD resources in a reflection mode, so that the controllers of a plurality of other CRD resources can be operated on a minimum unit pod for operating the controllers;
and step S3: deploying a controller of the container application to a K8s container cloud platform, submitting a yaml configuration file by a user, wherein the yaml configuration file comprises control information and Resource information of other registered CRD resources, controlling the execution steps of the computing tasks according to the control information after monitoring the yaml configuration file by the controller of the container CRD application system, submitting the corresponding computing tasks to the K8s container cloud platform according to the Resource information, and calling the controllers of the other registered CRD resources to process the computing tasks.
2. The CRD application integration calling method in the k8s container cloud platform according to claim 1, characterized in that: in the step S1, the control information comprises step fields steps, pipeline fields pipeline and directed acyclic graph fields DAG, a controller of the container application completes control logic according to the control information, when the step fields steps are started, corresponding resources run resource nodes in parallel, and the resource nodes are submitted to a k8S container cloud platform in parallel; when the pipeline field pipeline is started, scheduling execution is carried out according to the resource node sequence defined in the pipeline field pipeline, and the resource nodes are submitted to a k8s container cloud platform step by step; when a directed acyclic graph field DAG is started, constructing an execution sequence of resource nodes according to a dependency relationship in the directed acyclic graph field DAG; the Resource node is the user-defined Resource and/or other CRD resources represented by the Resource information.
3. The CRD application integration calling method in the k8s container cloud platform according to claim 2, characterized in that: and executing the computing task according to the content of the Resource node, wherein for the computing task of the container type, a minimum unit pod is started in the k8s container cloud platform to execute the task, and for the computing task of the Resource type, other registered CRD resources are started in the k8s container cloud platform to execute the task according to the type of the Resource information.
4. The CRD application integration calling method in the k8s container cloud platform according to claim 1, characterized in that: the step 2 comprises the following steps:
step S2.1: the method for constructing the interface and acquiring the CRD application information uploaded by the user through the interface comprises the following steps: registering CRD source information, CRD definition file, resource object content declaration file type. Go and CRD controller file;
step S2.2: storing and verifying CRD application information;
step S2.3: go according to the resource object content declaration file type of uploading, generate resource template ResourceTemplate, include resource object definition information, when uploading multiple CRD applications, generate subclasses of multiple resource templates ResourceTemplate;
step S2.4: and when the CRD is registered, synchronously refreshing the associated container map, reading the CRD controller file stored by the associated container map, and operating the controller in a reflection mode, so that a plurality of sub-controllers of other registered CRD resources can be operated on a minimum unit pod of a controller connection-controller for operating the container application.
5. The CRD application integration calling method in the k8s container cloud platform according to claim 4, wherein: in step S2.1, an interface is set in the controller, and an agent is set for the minimum unit pod, so that the interface runs on the minimum unit pod where the controller is located, and is exposed to the outside through the service component of k 8S.
6. The CRD application integration calling method in the k8s container cloud platform according to claim 4, wherein: in step S2.3, the resource object definition information includes a type.
7. The CRD application integration calling method in the k8s container cloud platform according to claim 4, wherein: in step S2.3, the resource template generated also includes other control information, and the addition, deletion, modification and check are set in an interface expansion manner.
8. The CRD application integration calling method in the k8s container cloud platform according to claim 1, characterized in that: the step S3 includes the steps of:
step S3.1: a user writes a yaml configuration file, the type of the yaml configuration file is container application, and the yaml configuration file comprises control information and Resource information of other registered resources;
step S3.2: a controller of the container CRD application system monitors the yaml configuration file and controls the execution sequence of the calculation tasks according to the control information;
step S3.3: for a container type computing task, starting a minimum unit pod to execute the task in a k8s container cloud platform;
step S3.4: and for the Resource type computing task, starting other registered CRD resources in the k8s container cloud platform to execute the task according to the type of the Resource information.
9. The CRD application integration calling method in the k8s container cloud platform according to claim 8, wherein: in the step S3.4, the controller parses the Resource type calculation task into a Resource template, creates an add/delete modification task, submits Resource object information of other registered CRD resources in the Resource template to a k8S container cloud platform, and processes the calculation task by the controller of the other registered CRD resources; and/or when the resource template contains other control information customized by the user, the control logic uploaded by the user needs to be loaded and processed.
10. A device for calling CRD application integration in a k8s container cloud platform, comprising a memory and one or more processors, wherein the memory stores executable codes, and the one or more processors execute the executable codes to implement a method for calling CRD application integration in a k8s container cloud platform according to any one of claims 1 to 9.
CN202211290188.9A 2022-10-21 2022-10-21 CRD application integration calling method and device in k8s container cloud platform Active CN115357369B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211290188.9A CN115357369B (en) 2022-10-21 2022-10-21 CRD application integration calling method and device in k8s container cloud platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211290188.9A CN115357369B (en) 2022-10-21 2022-10-21 CRD application integration calling method and device in k8s container cloud platform

Publications (2)

Publication Number Publication Date
CN115357369A CN115357369A (en) 2022-11-18
CN115357369B true CN115357369B (en) 2023-03-24

Family

ID=84008678

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211290188.9A Active CN115357369B (en) 2022-10-21 2022-10-21 CRD application integration calling method and device in k8s container cloud platform

Country Status (1)

Country Link
CN (1) CN115357369B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737173A (en) * 2023-08-11 2023-09-12 华控清交信息科技(北京)有限公司 Service integration method and device on k8s container cluster and electronic equipment
CN117112500B (en) * 2023-10-17 2024-01-26 天津市天河计算机技术有限公司 Resource management method, device, equipment and storage medium
CN117608810B (en) * 2024-01-18 2024-04-30 腾讯科技(深圳)有限公司 Service processing method, device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113687912A (en) * 2021-07-30 2021-11-23 济南浪潮数据技术有限公司 Container cluster management method, device and system, electronic equipment and storage medium
CN115202874A (en) * 2022-07-07 2022-10-18 浪潮云信息技术股份公司 Method and storage medium for scheduling data transmission system resources based on declarative API

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10855531B2 (en) * 2018-08-30 2020-12-01 Juniper Networks, Inc. Multiple networks for virtual execution elements
CN113326107A (en) * 2020-02-28 2021-08-31 中科星图股份有限公司 Kubernetes cluster-based periodic task scheduling method and electronic equipment
CN111614490B (en) * 2020-04-29 2022-11-11 北京金山云网络技术有限公司 Management system and method for managed container cluster based on top-level container cluster
US11422846B2 (en) * 2020-07-20 2022-08-23 Vmware, Inc. Image registry resource sharing among container orchestrators in a virtualized computing system
US11550641B2 (en) * 2020-07-24 2023-01-10 Red Hat, Inc. Extending the kubernetes API in-process
CN114020448A (en) * 2021-09-29 2022-02-08 浪潮电子信息产业股份有限公司 Cloud resource arranging method, device, equipment and storage medium
CN114374692A (en) * 2021-12-02 2022-04-19 浪潮云信息技术股份公司 Method and system for realizing multi-container cluster management
CN113886055B (en) * 2021-12-07 2022-04-15 中国电子科技集团公司第二十八研究所 Intelligent model training resource scheduling method based on container cloud technology
CN113934711B (en) * 2021-12-16 2022-03-15 天津南大通用数据技术股份有限公司 Method for automatically deploying gbase8s cluster
CN114938371A (en) * 2022-05-11 2022-08-23 浪潮云信息技术股份公司 Cloud edge cooperative data exchange service implementation method and system based on cloud originality

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113687912A (en) * 2021-07-30 2021-11-23 济南浪潮数据技术有限公司 Container cluster management method, device and system, electronic equipment and storage medium
CN115202874A (en) * 2022-07-07 2022-10-18 浪潮云信息技术股份公司 Method and storage medium for scheduling data transmission system resources based on declarative API

Also Published As

Publication number Publication date
CN115357369A (en) 2022-11-18

Similar Documents

Publication Publication Date Title
CN115357369B (en) CRD application integration calling method and device in k8s container cloud platform
CN111984269A (en) Method for providing application construction service and application construction platform
WO2021164367A1 (en) Container mirror image providing method, container mirror image loading method, and related device and system
CN109614167B (en) Method and system for managing plug-ins
WO2022037612A1 (en) Method for providing application construction service, and application construction platform, application deployment method and system
CN111984270A (en) Application deployment method and system
US10949216B2 (en) Support for third-party kernel modules on host operating systems
CN114077423A (en) Airport APP development container architecture based on mobile cross-platform
CN112364897B (en) Distributed training method and device, storage medium and electronic equipment
CN110688174A (en) Container starting method, storage medium and electronic device
US7721278B2 (en) Modular server architecture for multi-environment HTTP request processing
CN117075930B (en) Computing framework management system
CN112230857B (en) Hybrid cloud system, hybrid cloud disk application method and data storage method
CN112214388A (en) Memory monitoring method, device, equipment and computer readable storage medium
CN115686932B (en) Backup set file recovery method and device and computer equipment
CN117041111A (en) Vehicle cloud function test method and device, electronic equipment and storage medium
CN116382713A (en) Method, system, device and storage medium for constructing application mirror image
CN116401014A (en) Service release method, device, storage medium and server
CN115714706A (en) Access acceleration system and method based on embedded H5, storage medium and electronic equipment
CN112445595B (en) Multitask submission system based on slurm computing platform
CN113867776A (en) Method and device for publishing middle station application, electronic equipment and storage medium
CN114356520A (en) Running method, device, equipment, storage medium and program product of micro application
CN114816445A (en) System platform architecture, function publishing method and device, platform and storage medium
CN116501449B (en) Method and system for managing container files in cloud primary environment
CN117170738B (en) Method, system, equipment and storage medium for interaction of Python and Fortran

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