CN116009898A - State determination method, device, equipment and medium for K8s deployment task - Google Patents
State determination method, device, equipment and medium for K8s deployment task Download PDFInfo
- Publication number
- CN116009898A CN116009898A CN202211716947.3A CN202211716947A CN116009898A CN 116009898 A CN116009898 A CN 116009898A CN 202211716947 A CN202211716947 A CN 202211716947A CN 116009898 A CN116009898 A CN 116009898A
- Authority
- CN
- China
- Prior art keywords
- determining
- target
- task
- state
- directed acyclic
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 230000004044 response Effects 0.000 claims abstract description 15
- 238000004590 computer program Methods 0.000 claims description 3
- 239000002699 waste material Substances 0.000 abstract description 7
- 238000004891 communication Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 5
- 238000012544 monitoring process Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 101100409014 Rhizobium meliloti (strain 1021) ppdK gene Proteins 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 125000002015 acyclic group Chemical group 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The application provides a state determining method, a state determining device, electronic equipment and a storage medium of a K8s deployment task, wherein the method comprises the steps of determining an initial directed acyclic graph of a target deployment task based on deployment dependency relations of a plurality of resources of the target deployment task; determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph; determining the task state of the target resource node through the working thread; and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error, thereby determining the target resource node submitted to the working thread according to the directed acyclic graph determined by the deployment dependency relationship of a plurality of resources, and determining the task state of the target resource node through the working thread, and avoiding the waste of computing resources caused when all the resource nodes are synchronously monitored in state.
Description
Technical Field
The application relates to the technical field of K8s, in particular to a state determining method, device, equipment and medium for K8s deployment tasks.
Background
This section is intended to provide a background or context for embodiments of the present application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
In general, the deployment of a software deployment task on K8s (Kubernetes) is formed by creating a plurality of K8s resources, when a user starts a software deployment task, it is a difficult task to efficiently acquire the state of the deployment task, and if a traditional multi-line Cheng Fangan is adopted, the state monitoring is performed on each related resource of the task synchronously, which can cause the waste of computing resources; if the number of threads in the thread pool is reduced, the real-time performance of the state check is affected, and the task execution efficiency is reduced.
Disclosure of Invention
In view of this, an object of the present application is to provide a state determining method, apparatus, electronic device and storage medium for a K8s deployment task.
Based on the above objects, the present application provides a method for determining the state of a K8s deployment task, including:
determining an initial directed acyclic graph of a target deployment task based on deployment dependency relationships of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes;
determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph;
determining the task state of the target resource node through the working thread;
and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error.
Based on the same inventive concept, the exemplary embodiments of the present application further provide a state determining apparatus for a K8s deployment task, including:
the first determining module is used for determining an initial directed acyclic graph of the target deployment task based on deployment dependency relations of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes;
a second determining module for determining a target resource node submitted to the work thread from the plurality of resource nodes based on the initial directed acyclic graph;
a third determining module for determining a task state of the target resource node through the working thread;
and the marking module is used for responding to the fact that the task state of the target resource node is determined to be completed in error, terminating the state determination of the target deployment task and marking the state of the target deployment task as error.
Based on the same inventive concept, the exemplary embodiments of the present application also provide an electronic device, including a memory, a processor, and a computer program stored on the memory and executable by the processor, where the processor implements the state determining method of the K8s deployment task as described above when executing the program.
Based on the same inventive concept, the present exemplary embodiments also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the state determining method of the K8s deployment task as described above.
From the above, it can be seen that the state determining method, apparatus, electronic device and storage medium for a K8s deployment task provided by the present application determine an initial directed acyclic graph of a target deployment task based on deployment dependency relationships of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes; determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph; determining the task state of the target resource node through the working thread; and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error, thereby determining the target resource node submitted to the working thread according to the directed acyclic graph determined by the deployment dependency relationship of a plurality of resources, and determining the task state of the target resource node through the working thread, when determining that the task state of the target resource node is completed in error, immediately terminating the state determination of the target deployment task, and avoiding the waste of computing resources caused by synchronous state monitoring of all the resource nodes.
Drawings
In order to more clearly illustrate the technical solutions of the present application or related art, the drawings that are required to be used in the description of the embodiments or related art will be briefly described below, and it is apparent that the drawings in the following description are only embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort to those of ordinary skill in the art.
Fig. 1 is a flow chart of a state determining method of a K8s deployment task according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for determining the status of a K8s deployment task according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for determining a status of a K8s deployment task according to an embodiment of the present application;
FIG. 4 is a schematic diagram of the structure of a target directed acyclic graph according to an embodiment of the application;
fig. 5 is a schematic structural diagram of a state determining device for a K8s deployment task according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a specific electronic device according to an embodiment of the present application.
Detailed Description
The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are presented merely to enable one skilled in the art to better understand and practice the present application and are not intended to limit the scope of the present application in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
According to the embodiment of the application, a state determining method, a state determining system, electronic equipment and a storage medium of a K8s deployment task are provided.
In this document, it should be understood that any number of elements in the drawings is for illustration and not limitation, and that any naming is used only for distinction and not for any limitation.
The principles and spirit of the present application are explained in detail below with reference to several representative embodiments thereof.
Summary of The Invention
In general, a software Deployment task is deployed on K8s (Kubernetes) and is formed by a plurality of K8s resource creation, and because there is a great deal of data and status dependence between resource creation, for example, in K8s, after a replyment resource is successfully created, a replyset resource is created to control the number of Pod, when the replyset resource is successfully created, the Pod resource starts to be created, and the number of Pod is eventually equal to the number of copies configured on the replyset resource, and if these dependence relationships cannot be accurately defined, the current intermediate stage of the Deployment task cannot be accurately acquired. Meanwhile, when a user starts a deployment task of software, it is also a difficult task to obtain the state of the deployment task efficiently, if the conventional multi-line Cheng Fangan is adopted to monitor the state of each related resource of the task synchronously, the waste of computing resources is caused, for example, when the Replicaset resource and the Pod resource are deployed simultaneously, if the Replicaset resource is wrong, the Pod resource is inevitably caused to be wrong, and if the Replicaset resource and the state of the Pod resource are monitored simultaneously, the waste of monitoring the Pod resource is possibly caused, and if the number of threads of a thread pool is reduced, the real-time performance of state inspection is affected, and the task execution efficiency is reduced.
In order to solve the above problems, the present application provides a method for determining a state of a K8s deployment task, which specifically includes:
determining an initial directed acyclic graph of a target deployment task based on deployment dependency relationships of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes; determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph; determining the task state of the target resource node through the working thread; and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error, thereby determining the target resource node submitted to the working thread according to the directed acyclic graph determined by the deployment dependency relationship of a plurality of resources, and determining the task state of the target resource node through the working thread, when determining that the task state of the target resource node is completed in error, immediately terminating the state determination of the target deployment task, and avoiding the waste of computing resources caused by synchronous state monitoring of all the resource nodes. In addition, the resource nodes of the deployment task are sequentially subjected to state judgment according to the sequence of the directed acyclic graph, so that the intermediate state of the state judgment of the resource of the deployment task can be obtained.
Having described the basic principles of the present application, various non-limiting embodiments of the present application are specifically described below.
Application scene overview
In some specific application scenarios, the state determination method of the K8s deployment task can be applied to various platforms or systems for designing K8 s.
The state determining method of the K8s deployment task according to the exemplary embodiment of the present application is described below in connection with a specific application scenario. It should be noted that the above application scenario is only shown for the convenience of understanding the spirit and principles of the present application, and embodiments of the present application are not limited in any way in this respect. Rather, embodiments of the present application may be applied to any scenario where applicable.
Exemplary method
Referring to fig. 1, an embodiment of the present application provides a state determining method for a K8s deployment task, where the method includes the following steps:
s101, determining an initial directed acyclic graph of a target deployment task based on deployment dependency relationships of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes.
In specific implementation, referring to fig. 2, an initial directed acyclic graph of a target deployment task is shown in a dashed box, and the directed acyclic graph in fig. 2 has 5 resource nodes in total, each resource node corresponds to a resource of a deployment task, and each resource node has a dependency relationship on its parent node.
In some embodiments, determining an initial directed acyclic graph of a target deployment task based on deployment dependencies of a plurality of resources of the target deployment task specifically includes:
acquiring deployment dependency relationships of a plurality of resources of the target deployment task, and determining arrangement positions of each resource in the plurality of resources in the initial directed acyclic graph based on the deployment dependency relationships;
wherein each resource corresponds to a resource node in the initial directed acyclic graph.
In specific implementation, firstly, the deployment dependency relationship of a plurality of resources of the target deployment task is acquired, the dependency relationship indicates the state judgment priority of each resource, namely, the arrangement position of each resource in the initial directed acyclic graph, and optionally, the higher the priority of the corresponding resource is, the higher the priority of the resource node is, and the priority of the resource node is required to be judged in advance.
S102, determining a target resource node submitted to a working thread from the plurality of resource nodes based on the initial directed acyclic graph.
When the method is implemented, after the initial directed acyclic graph is obtained, a target resource node submitted to a working thread is determined from the plurality of resource nodes according to the initial directed acyclic graph. The target resource node is the resource node which needs to judge the task state at present.
It should be noted that, the target resource node may change continuously with the continuous progress of the deployment task, for example, in fig. 2, the ingress and the service belong to the current two target resource nodes, and in the initial directed acyclic graph in the right dashed box in fig. 3, the depth belongs to the current target resource node.
In some embodiments, determining a target resource node submitted to the worker thread from a plurality of resource nodes based on the initial directed acyclic graph, specifically includes:
judging the state of each resource node in turn from the starting node in the initial directed acyclic graph;
in response to determining that the current resource node has no parent node or that both of its parent nodes have completed the task state, the current resource node is determined to be the target resource node.
In implementation, referring to fig. 2, since the start node has completed determining the task state, the ingress and service belong to the current two target resource nodes.
S103, determining the task state of the target resource node through the working thread.
In implementation, after determining a target resource node, determining a task state of the target resource node through a working thread.
In some embodiments, the target resource node is a plurality; determining, by the worker thread, a task state of the target resource node, including:
and respectively distributing the target resource nodes to a plurality of working threads, and independently determining the task state of one target resource node through each working thread.
In specific implementation, referring to fig. 2, the ingress and the service belong to two current target resource nodes, so that a working thread 1 and a working thread 2 are respectively allocated to the two target resource nodes, then the task state of the ingress is determined by the working thread 1, and the task state of the service is determined by the working thread 2.
In some embodiments, determining, by the worker thread, a task state of the target resource node specifically includes:
determining resource checking logic corresponding to the target resource node; the resource checking logic comprises logic based on K8s event judgment and logic based on Apiserver judgment;
and determining the task state of the target resource node through the working thread and based on the resource checking logic corresponding to the target resource node.
In particular, the resource check logic of different resource nodes may be different, and in general, the resource check logic of a resource node determines the task node state based on an event of k8s or a query to an Apiserver, for example, the check logic of an access node determines whether an access resource is successfully created at k8s through an Apiserver, and the check logic of a Service node determines whether a Service resource is successfully created at k8s through an Apiserver, and the check logic of a devioy task node determines whether an event created by a devioyment resource is sent out by acquiring an event of k8 s. After determining the resource check logic corresponding to the target resource node, the worker thread may determine the task state of the target resource node using the corresponding resource check logic.
S104, in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error.
When the task state of the target resource node is determined to be the completion of the error, the state determination of the target deployment task is terminated, namely, the task state judgment is not performed on other unfinished resource nodes, and the state of the target deployment task is marked as the error. Optionally, the task state of the resource node generally includes: incomplete, normal complete, and erroneous complete. Optionally, after marking the state of the target deployment task as error, the error identifier is returned to the upper layer caller.
In some embodiments, after determining the task state of the target resource node by the worker thread, the method further comprises:
determining whether the target resource node needs to generate a sub directed acyclic graph in response to determining that the task state of the target resource node is normally completed;
in response to determining that the target resource node needs to generate a sub-directed acyclic graph, a new target directed acyclic graph is generated based on the sub-directed acyclic graph and the initial directed acyclic graph.
In particular, when a task is deployed, depending sub-resources of many resources cannot be determined, for example, only after a replyment resource is successfully created, the k8s system creates a replyment resource for the replyment resource to control the number of Pods, and when an initial directed acyclic graph is determined, it is unclear whether the replyment resource can be successfully created, so that sub-resource nodes of the replyment resource node cannot be directly added in the initial directed pentacyclic graph. And when the task state of the target resource node is determined to be normal through the working thread, whether a sub-resource node corresponds to the target resource node or not after the target resource node, namely whether a sub-resource depending on the target resource exists or not can be determined. Therefore, when the task state of the target resource node is determined to be normal, it is further determined whether the target resource node needs to generate a sub-directed acyclic graph, and when the target resource node does not need to generate a sub-directed acyclic graph, a next target resource node is directly determined, and task state judgment is performed on the next target resource node. Referring to fig. 3, when the task states of both the ingress and service nodes are normally completed, the node is determined to be the next target resource node, and the task state of the node is determined by the working thread. When the target resource node is determined to need to generate a sub-directed acyclic graph, a new target directed acyclic graph is generated according to the sub-directed acyclic graph and the initial directed acyclic graph. Optionally, the process of generating the new target directed acyclic graph inserts a sub directed acyclic graph at a corresponding position of the initial directed acyclic graph, referring to fig. 4, which is a new target directed acyclic graph generated, and the target directed acyclic graph in fig. 4 is a directed acyclic graph formed by inserting sub directed acyclic graphs, i.e. replicaset, podA and podB, into the initial directed acyclic graph in fig. 2.
In some embodiments, after generating a new target directed acyclic graph based on the child directed acyclic graph and the initial directed acyclic graph, the method further comprises:
determining a next target resource node submitted to the worker thread from a plurality of resource nodes based on the target directed acyclic graph.
When the method is implemented, after a new target directed acyclic graph is generated, the next target resource node submitted to the working thread is determined from a plurality of resource nodes according to the target directed acyclic graph. Referring to fig. 4, in comparison with fig. 2, in fig. 4, when it is determined that the task state of the duplicate node is normally completed, the task state is not directly skipped to the end node, but the task state is sequentially determined from the duplicate node, and the task state is not skipped to the end node until the task states of podA and podB are also normally completed.
In some embodiments, after determining the task state of the target resource node by the worker thread, the method further comprises:
and marking the state of the target deployment task as successful in response to determining that the task states of all the resource nodes are normally completed.
And when the task states of all the resource nodes are determined to be normally completed, marking the states of the target deployment tasks as successful. Optionally, after marking the state of the target deployment task as successful, the successful identifier is returned to the upper layer caller.
According to the state determining method for the K8s deployment task, an initial directed acyclic graph of a target deployment task is determined based on deployment dependency relations of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes; determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph; determining the task state of the target resource node through the working thread; and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error, thereby determining the target resource node submitted to the working thread according to the directed acyclic graph determined by the deployment dependency relationship of a plurality of resources, and determining the task state of the target resource node through the working thread, when determining that the task state of the target resource node is completed in error, immediately terminating the state determination of the target deployment task, and avoiding the waste of computing resources caused by synchronous state monitoring of all the resource nodes. In addition, the resource nodes of the deployment task are sequentially subjected to state judgment according to the sequence of the directed acyclic graph, so that the intermediate state of the state judgment of the resource of the deployment task can be obtained.
Exemplary apparatus
Based on the same inventive concept, the application also provides a state determining device of the K8s deployment task, which is applied to a container cloud platform system based on K8s and OpenStack, and corresponds to the method of any embodiment.
Referring to fig. 5, the state determining device of the K8s deployment task includes:
a first determining module 201, configured to determine an initial directed acyclic graph of a target deployment task based on deployment dependencies of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes;
a second determination module 202 that determines a target resource node from the plurality of resource nodes that is submitted to a worker thread based on the initial directed acyclic graph;
a third determining module 203, configured to determine, by using the worker thread, a task state of the target resource node;
and a marking module 204, responsive to determining that the task state of the target resource node is completed with an error, terminating the state determination of the target deployment task and marking the state of the target deployment task as error.
For convenience of description, the above system is described as being functionally divided into various modules, respectively. Of course, the functions of each module may be implemented in the same piece or pieces of software and/or hardware when implementing the present application.
The system of the foregoing embodiment is configured to implement the state determining method of the corresponding K8s deployment task in any foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Based on the same inventive concept, the application also provides an electronic device corresponding to the method of any embodiment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the state determining method of the K8s deployment task of any embodiment when executing the program.
Fig. 6 shows a more specific hardware architecture of an electronic device according to this embodiment, where the device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 implement communication connections therebetween within the device via a bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 1020 may store an operating system and other application programs, and when the embodiments of the present specification are implemented in software or firmware, the associated program code is stored in memory 1020 and executed by processor 1010.
The input/output interface 1030 is used to connect with an input/output module for inputting and outputting information. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
It should be noted that although the above-described device only shows processor 1010, memory 1020, input/output interface 1030, communication interface 1040, and bus 1050, in an implementation, the device may include other components necessary to achieve proper operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The electronic device of the foregoing embodiment is configured to implement the state determining method of the corresponding K8s deployment task in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Exemplary program product
Based on the same inventive concept, corresponding to any of the above embodiments of the method, the present application further provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the state determining method of the K8s deployment task according to any of the above embodiments.
The computer readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be used to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the foregoing embodiments are used to make the computer execute a state determining method of a K8s deployment task according to any one of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which are not described herein.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the application (including the claims) is limited to these examples; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the present application, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure the embodiments of the present application. Furthermore, the devices may be shown in block diagram form in order to avoid obscuring the embodiments of the present application, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform on which the embodiments of the present application are to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the application, it should be apparent to one skilled in the art that embodiments of the application can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the present application has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The present embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalents, improvements and/or the like which are within the spirit and principles of the embodiments are intended to be included within the scope of the present application.
Claims (11)
1. The method for determining the state of the K8s deployment task is characterized by comprising the following steps of:
determining an initial directed acyclic graph of a target deployment task based on deployment dependency relationships of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes;
determining a target resource node submitted to a worker thread from the plurality of resource nodes based on the initial directed acyclic graph;
determining the task state of the target resource node through the working thread;
and in response to determining that the task state of the target resource node is completed in error, terminating the state determination of the target deployment task, and marking the state of the target deployment task as error.
2. The method of claim 1, wherein determining the initial directed acyclic graph of the target deployment task based on deployment dependencies of a plurality of resources of the target deployment task comprises:
acquiring deployment dependency relationships of a plurality of resources of the target deployment task, and determining arrangement positions of each resource in the plurality of resources in the initial directed acyclic graph based on the deployment dependency relationships;
wherein each resource corresponds to a resource node in the initial directed acyclic graph.
3. The method according to claim 1, wherein determining a target resource node from a plurality of resource nodes that is submitted to a worker thread based on the initial directed acyclic graph, comprises:
judging the state of each resource node in turn from the starting node in the initial directed acyclic graph;
in response to determining that the current resource node has no parent node or that both of its parent nodes have completed the task state, the current resource node is determined to be the target resource node.
4. The method of claim 1, wherein the target resource node is a plurality of; determining, by the worker thread, a task state of the target resource node, including:
and respectively distributing the target resource nodes to a plurality of working threads, and independently determining the task state of one target resource node through each working thread.
5. The method according to claim 1, wherein determining, by the worker thread, a task state of the target resource node, comprises:
determining resource checking logic corresponding to the target resource node; the resource checking logic comprises logic based on K8s event judgment and logic based on Apiserver judgment;
and determining the task state of the target resource node through the working thread and based on the resource checking logic corresponding to the target resource node.
6. The method of claim 1, wherein after determining the task state of the target resource node by the worker thread, the method further comprises:
determining whether the target resource node needs to generate a sub directed acyclic graph in response to determining that the task state of the target resource node is normally completed;
in response to determining that the target resource node needs to generate a sub-directed acyclic graph, a new target directed acyclic graph is generated based on the sub-directed acyclic graph and the initial directed acyclic graph.
7. The method of claim 6, wherein after generating a new target directed acyclic graph from the initial directed acyclic graph based on the child directed acyclic graph, the method further comprises:
determining a next target resource node submitted to the worker thread from a plurality of resource nodes based on the target directed acyclic graph.
8. The method of claim 1, wherein after determining the task state of the target resource node by the worker thread, the method further comprises:
and marking the state of the target deployment task as successful in response to determining that the task states of all the resource nodes are normally completed.
9. A state determining apparatus for a K8s deployment task, comprising:
the first determining module is used for determining an initial directed acyclic graph of the target deployment task based on deployment dependency relations of a plurality of resources of the target deployment task; wherein the initial directed acyclic graph includes a plurality of resource nodes;
a second determining module for determining a target resource node submitted to the work thread from the plurality of resource nodes based on the initial directed acyclic graph;
a third determining module for determining a task state of the target resource node through the working thread;
and the marking module is used for responding to the fact that the task state of the target resource node is determined to be completed in error, terminating the state determination of the target deployment task and marking the state of the target deployment task as error.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable by the processor, the processor implementing the method of any one of claims 1 to 8 when the program is executed.
11. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 8.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211716947.3A CN116009898A (en) | 2022-12-29 | 2022-12-29 | State determination method, device, equipment and medium for K8s deployment task |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211716947.3A CN116009898A (en) | 2022-12-29 | 2022-12-29 | State determination method, device, equipment and medium for K8s deployment task |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116009898A true CN116009898A (en) | 2023-04-25 |
Family
ID=86018784
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211716947.3A Pending CN116009898A (en) | 2022-12-29 | 2022-12-29 | State determination method, device, equipment and medium for K8s deployment task |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116009898A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117608810A (en) * | 2024-01-18 | 2024-02-27 | 腾讯科技(深圳)有限公司 | Service processing method, device, electronic equipment and storage medium |
-
2022
- 2022-12-29 CN CN202211716947.3A patent/CN116009898A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117608810A (en) * | 2024-01-18 | 2024-02-27 | 腾讯科技(深圳)有限公司 | Service processing method, device, electronic equipment and storage medium |
| CN117608810B (en) * | 2024-01-18 | 2024-04-30 | 腾讯科技(深圳)有限公司 | Service processing method, device, electronic equipment and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105045602B (en) | Method and device for constructing Hadoop application development framework and electronic device | |
| CN111612158A (en) | Model deployment method, device, equipment and storage medium | |
| CN112491581A (en) | Service performance monitoring and management method and device | |
| CN112486589A (en) | System configuration item management method and device, electronic equipment and storage medium | |
| WO2017050037A1 (en) | Automated test method and device | |
| CN109783221B (en) | A virtual machine resource allocation method, device and resource server | |
| CN116009898A (en) | State determination method, device, equipment and medium for K8s deployment task | |
| CN114942878A (en) | Automatic performance testing method for internet application and related equipment | |
| CN111045783B (en) | Method and device for generating container mirror image, storage medium and electronic equipment | |
| CN114421458B (en) | A method, device and electronic equipment for generating physical topology of low voltage area | |
| CN114327854A (en) | Method for processing service request by coroutine and related equipment | |
| US20230367936A1 (en) | Verification method, electronic device and storage medium | |
| CN118657487A (en) | Business process configuration method and related equipment | |
| CN113395319B (en) | Method, system, electronic device and storage medium for sensing network fault | |
| CN115629951B (en) | Task full-link tracking method, first node, link system and medium | |
| CN115618363B (en) | Vulnerability path mining method and related equipment | |
| CN113642638B (en) | Capacity adjustment method, model training method, device, equipment and storage medium | |
| CN114416465B (en) | Genuine software inspection method, electronic device and storage medium | |
| CN116795716A (en) | Automobile software testing method and device, electronic equipment and storage medium | |
| CN116319806A (en) | Service deployment method, device, device, storage medium and computer program product | |
| WO2014163519A1 (en) | Automatic generation of test layouts for testing a design rule checking tool | |
| CN115269331A (en) | Service topology monitoring method facing micro service group and related equipment | |
| CN114546823A (en) | Method for reproducing debugging scene of logic system design and related equipment | |
| CN115442233A (en) | ECU upgrade method, device, electronic equipment, storage medium and vehicle | |
| CN114924754A (en) | Cloud platform-based application stack automatic deployment method and related equipment |
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 |