Container group distribution adjusting method and device, electronic equipment and readable storage medium

By receiving notification messages from the service management platform, identifying the adjustment task status of the target service and pausing the migration process, reading the container group distribution adjustment progress, and calculating the intermediate distribution ratio, it ensures that the service upgrade is based on the current actual distribution ratio. This solves the coordination problem between service upgrade and container group distribution adjustment, and achieves efficient coordination without service interruption.

CN120803606APending Publication Date: 2025-10-17BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510895994.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the logical cluster of the container orchestration engine, when services are upgraded and container group distribution is adjusted, resource preemption, configuration conflicts, and failure of the availability guarantee mechanism lead to service interruptions and a lack of an effective coordination mechanism.

Method used

By receiving notification messages from the service management platform, the adjustment task status of the target service is identified and the migration process is suspended. The container group distribution adjustment progress is read and the intermediate distribution ratio is calculated to ensure that the service upgrade is based on the current actual distribution ratio and avoid using an outdated initial distribution ratio.

Benefits of technology

It ensures the smooth progress of service upgrades and container group distribution adjustments, avoids resource conflicts and service interruptions, and improves system stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803606A_ABST
    Figure CN120803606A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a container group distribution adjustment method and device, electronic equipment and a readable storage medium. The method comprises the following steps: receiving a notification message sent by a service management platform; the notification message is used for indicating that a target service in a running state is upgraded, and the task state of an adjustment task associated with the target service is set as a waiting state; in response to the notification message, reading the number of container groups adjusted from the first cluster to the second cluster and the number of unadjusted container groups in the first cluster in the process of executing the adjustment task by the container group distribution adjustment device, and obtaining the ratio of the number of the unadjusted container groups in the first cluster to the number of the container groups in the second cluster, the proportion is used as an intermediate distribution proportion; setting the task state as a completion state; and sending the intermediate distribution proportion to a service management platform.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information processing, in particular to a container group distribution adjustment method and device, electronic equipment and readable storage medium. BACKGROUND

[0002] With the expansion of the logical cluster scale of the container orchestration engine, in order to improve resource utilization and reduce costs, the federated cluster architecture is widely used. The federated cluster architecture unifies multiple physical clusters as a logical cluster, and users only need to interact with the logical cluster, while administrators can dynamically adjust the container group distribution according to needs. For example, when a cluster A is no longer used, the administrator can migrate the container group from the A cluster to other clusters, without the user's involvement in the whole operation and maintenance process.

[0003] The service is a logical unit encapsulating the container group in the logical cluster of the container orchestration engine, and the container group is the carrier for the service to run. The service manages the container group through a label selector. Under the logical cluster system of the container orchestration engine, service upgrade relies on the container group, and the service associates the container group through the label selector to process requests. When the service is upgraded, the logical cluster of the container orchestration engine will deploy a new container group in the specified cluster according to the container group distribution information stored by the platform, and gradually replace the old container group to complete the upgrade.

[0004] When the service upgrade and the container group distribution adjustment are performed at the same time, conflicts will occur due to resource preemption, configuration conflicts and failure of availability guarantee mechanisms. For example, after the administrator migrates the container group from the A cluster to the B cluster, the distribution information stored by the platform is not updated, and when the service is upgraded, the existing container group in the B cluster will be deleted to ensure service version consistency, because the container group rebuilt in the A cluster cannot be used immediately, resulting in service interruption. Therefore, the coordination mechanism of service upgrade and container group distribution adjustment needs to be optimized. SUMMARY

[0005] The purpose of the embodiments of the present application is to provide a container group distribution adjustment method and device, electronic equipment and readable storage medium, which can ensure the smooth progress of service upgrade and container group distribution adjustment. The specific technical solutions are as follows:

[0006] In the first aspect of the present application, a container group distribution adjustment method is first provided, applied to a container group distribution adjustment device, comprising:

[0007] receiving a notification message sent by a service management platform; the notification message is used to indicate that a target service in a running state is executed by an upgrade operation, and a task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task of migrating a container group from a first cluster to a second cluster, and the notification message contains identification information of the target service;

[0008] In response to the notification message, the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster during the execution of the adjustment task, and the number of container groups that are not adjusted in the first cluster, and obtains a ratio of the number of container groups that are not adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio;

[0009] setting the task state to a completed state;

[0010] sending the intermediate distribution ratio to the service management platform, so that the service management platform performs an upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set to the completed state, and the intermediate distribution ratio is used to replace an initial distribution ratio of the target service before adjustment.

[0011] In a second aspect of the embodiment of the present application, a container group distribution adjustment method is also provided, which is applied to a service management platform and includes:

[0012] detecting whether a target service is associated with an adjustment task when an upgrade operation of the target service is performed;

[0013] in a case where the target service is associated with an adjustment task, setting a task state of the adjustment task corresponding to the target service to a waiting state, and sending a notification message to a container group distribution adjustment device, so that the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster during the execution of the adjustment task, and the number of container groups that are not adjusted in the first cluster in response to the notification message, and obtains a ratio of the number of container groups that are not adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task state to a completed state;

[0014] receiving the intermediate distribution ratio sent by the container group distribution adjustment device;

[0015] performing an upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set to the completed state, and the intermediate distribution ratio is used to replace an initial distribution ratio of the target service before adjustment.

[0016] In a third aspect of the embodiment of the present application, a container group distribution adjustment device is also provided, which includes:

[0017] The first receiving module is used for receiving a notification message sent by a service management platform; the notification message is used for indicating that a target service in a running state is executed with an upgrade operation, and a task state of an adjustment task associated with the target service is set as a waiting state; the adjustment task is used for describing a distribution adjustment task of migrating a container group from a first cluster to a second cluster, and the notification message contains identification information of the target service;

[0018] The determining module is used for reading, in response to the notification message, a number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device in a process of executing the adjustment task, and a number of container groups that have not been adjusted in the first cluster, and obtaining a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio;

[0019] The setting module is used for setting the task state as a completed state;

[0020] The first sending module is used for sending the intermediate distribution ratio to the service management platform, so that the service management platform executes the upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set as the completed state; and the intermediate distribution ratio is used for replacing an initial distribution ratio of the target service before adjustment.

[0021] In a fourth aspect of the embodiment of the present application, a container group distribution adjustment device is further provided, comprising:

[0022] The detecting module is used for detecting whether a target service is associated with an adjustment task when the target service is executed with an upgrade operation;

[0023] The setting module is used for setting a task state of an adjustment task corresponding to the target service as a waiting state in a case where the target service is associated with the adjustment task, and sending a notification message to a container group distribution adjustment device, so that the container group distribution adjustment device reads, in response to the notification message, a number of container groups that have been adjusted from a first cluster to a second cluster by the container group distribution adjustment device in a process of executing the adjustment task, and a number of container groups that have not been adjusted in the first cluster, obtains a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task state as a completed state;

[0024] The second receiving module is used for receiving the intermediate distribution ratio sent by the container group distribution adjustment device;

[0025] The execution module is configured to perform an upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set to a completed state, and the intermediate distribution ratio is used to replace an initial distribution ratio of the target service before adjustment.

[0026] In yet another aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores instructions that, when executed on a computer, cause the computer to perform the data forwarding method described above.

[0027] In yet another aspect of the embodiments of the present application, a computer program product is provided, which contains instructions that, when executed on a computer, cause the computer to perform the container group distribution adjustment method described above.

[0028] In the embodiments of the present application, a notification message sent by a service management platform is received, the notification message is used to indicate that a target service in a running state is executed with an upgrade operation, and a task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task of migrating a container group from a first cluster to a second cluster, and the notification message contains identification information of the target service; the container group distribution adjustment device can identify a specific task to be suspended according to the notification message, suspend a container group migration process, and avoid parallel execution with the upgrade operation.

[0029] In response to the notification message, the number of container groups that have been adjusted from the first cluster to the second cluster in the process of executing the adjustment task by the container group distribution adjustment device, and the number of container groups that have not been adjusted in the first cluster are read, and a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster is obtained as an intermediate distribution ratio, the task state is set to a completed state, and the service management platform can determine the task completion state in a case where it detects information of the task completion state, so that the service upgrade process can be started in time;

[0030] The intermediate distribution ratio is sent to the service management platform, so that the service management platform can execute the upgrade operation of the target service according to the intermediate distribution ratio in a case where it detects that the task state is set to a completed state, the initial distribution ratio is replaced by the intermediate distribution ratio, the service upgrade is ensured to be based on the current actual intermediate distribution ratio, the upgrade strategy error caused by using the outdated initial distribution ratio is avoided, and the accuracy and effectiveness of the upgrade operation are ensured. BRIEF DESCRIPTION OF DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below.

[0032] Figure 1is a flowchart of a container group distribution adjustment method provided by an embodiment of the present application;

[0033] Figure 2 is an interactive flowchart of a container group distribution adjustment method provided by an embodiment of the present application;

[0034] Figure 3 is a flowchart of a container group distribution adjustment method provided by an embodiment of the present application;

[0035] Figure 4 is a flowchart of another container group distribution adjustment method provided by an embodiment of the present application;

[0036] Figure 5 is a structural schematic diagram of a container group distribution adjustment device provided by an embodiment of the present application;

[0037] Figure 6 is a structural schematic diagram of another container group distribution adjustment device provided by an embodiment of the present application;

[0038] Figure 7 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

[0040] The container group distribution adjustment method provided by the embodiments of the present application can be applied to at least the following application scenarios, which will be described below.

[0041] A federal cluster manages multiple physical clusters through a central control plane. A user submits a resource request through a federal API, and the federal control plane distributes these resources to each physical cluster according to a policy and creates corresponding container groups in each physical cluster. In the federal cluster, resources and container groups are in an abstract definition and specific instance relationship. The resource request submitted by the user is an abstract configuration at a logical level, which specifies the deployment rules of the container group, such as the image and the number of replicas; after the federal control plane distributes the resource request to the physical cluster, it will create an actual running container group according to the configuration.

[0042] The process of container group distribution adjustment, when an administrator decides to migrate a container group from one cluster to another, such as migrating a container group from cluster A to cluster B, the following steps are usually performed:

[0043] The administrator adjusts the container group distribution policy through the federation control plane, and migrates the container group from the A cluster to the B cluster. The federation control plane creates a new container group in the B cluster according to the new policy, and gradually reduces the number of container groups in the A cluster. When the container group in the B cluster is completely ready, the container group in the A cluster is completely deleted.

[0044] The process of service upgrade, specifically including: the user submits a new Deployment configuration through the federation API, triggering service upgrade. The federation control plane creates a new container group in each physical cluster according to the current container group distribution policy, and gradually replaces the old container group. When the new container group is ready, the old container group is deleted.

[0045] In the following scenarios, service interruption problems may occur:

[0046] Scenario 1: The administrator has migrated the container group of the A cluster to the B cluster, but the container group distribution information of the federation control plane has not been completely updated.

[0047] Scenario 2: The user triggers service upgrade during this period, and the federation control plane still creates a new container group in the A cluster according to the old container group distribution information.

[0048] Scenario 3: Since the container group in the A cluster has been migrated to the B cluster, the new container group in the A cluster cannot immediately take over the traffic generated by the service, and the container group in the B cluster is deleted. At this time, there is no available container group to handle the traffic generated by the service, resulting in service interruption.

[0049] There is a delay in the synchronization of information between the federation control plane and each physical cluster, resulting in the container group distribution information not being updated in time. During the container group migration and service upgrade process, there is a lack of effective coordination mechanism to ensure that the two do not affect the container group in the same cluster at the same time.

[0050] Based on the above application scenarios, the following describes the container group distribution adjustment method provided by the embodiments of the present application.

[0051] Figure 1 The flowchart of the container group distribution adjustment method provided by the embodiments of the present application.

[0052] The container group distribution adjustment device 100: a tool or mechanism for migrating container groups between different physical container orchestration engine logical clusters. According to resource utilization, cost, geographical location and other factors, a container group migration strategy is formulated. The container group is migrated from one physical cluster to another physical cluster while ensuring service continuity. Ensure that the state and configuration information of the container group can be correctly synchronized to the target cluster during the migration process. By dynamically adjusting the container group distribution, the resource utilization is optimized, the cost is reduced, and the flexibility and scalability of the cluster are improved.

[0053] Service management platform 200: A platform for managing service upgrades, configuration delivery, and task storage. Responsible for delivering user service upgrade operations to the unified logical cluster. Stores and manages service configuration information, ensuring configuration consistency. Records and manages container group distribution adjustment tasks, upgrade tasks, and other information. The service management platform is a bridge between users and the container orchestration engine logical cluster, simplifying service management processes and improving operational efficiency.

[0054] Adjustment time recommendation device 300: A tool based on historical data analysis for recommending suitable time windows for container group distribution adjustment. Analyzes historical service upgrade data such as upgrade time, upgrade duration, upgrade frequency, etc. Based on the analysis results, a set of suitable time periods for container group migration is recommended to avoid conflicts with user service upgrade operations. By avoiding time periods with frequent user upgrades, the disturbance to user services caused by container group distribution adjustment is reduced. The success rate of container group distribution adjustment is improved, the impact on user services is reduced, and user experience is improved.

[0055] Unified logical cluster 400: A mechanism that unifies multiple physical container orchestration engine logical clusters and presents them as a single logical cluster to the outside world. Users manage multiple physical clusters through a unified API or control plane. According to the strategy, the container group is distributed to different physical clusters. Through cross-cluster load balancing and failover, the availability of the application is improved. The unified logical cluster can simplify the complexity of multi-cluster management, while improving resource utilization and application disaster recovery capabilities.

[0056] Container orchestration engine logical cluster: An open-source container orchestration platform for automating deployment, scaling, and managing containerized applications. The container orchestration engine logical cluster is a collection of physical or virtual nodes that collectively run containerized applications. According to user-defined configurations, containerized applications are automatically deployed to nodes in the cluster.

[0057] Container group: The smallest deployment unit in the container orchestration engine logical cluster, consisting of one or more containers. Containers in a container group share network namespaces, storage volumes, and other resources. Containers within a container group can communicate directly via localhost. Container groups may be scheduled, restarted, or deleted. Container groups are the basic unit of application execution in the container orchestration engine logical cluster, allowing related containers to be combined to simplify application deployment and management.

[0058] Deployment is an object in the container orchestration engine logical cluster used to define the deployment and update strategy of the container group. Users define the desired state of the application through Deployment, and the container orchestration engine logical cluster automatically ensures that the actual state is consistent with the desired state. When updating the application, Deployment replaces the old container group step by step to ensure that the service does not interrupt. When the container group or node fails, Deployment automatically creates a new container group to replace the failed instance. Deployment is the core object in the container orchestration engine logical cluster for managing stateless applications, which can simplify the deployment, update and operation of applications.

[0059] Figure 2 is an interactive flowchart of a container group distribution adjustment method provided by an embodiment of the application, as shown in Figure 2 , specifically comprising;

[0060] Step 101: The container group distribution adjustment device 100 sends a service list request message to the adjustment time recommendation device 300;

[0061] The purpose is to obtain the service list required for subsequent operation, which is the starting trigger point of information interaction and process promotion, and prepares for subsequent screening and processing services.

[0062] Step 102: The adjustment time recommendation device 300 collects upgrade data of the services through the service management platform 200, and based on the upgrade data, calculates the upgrade probability of each service within a future preset time length, and screens out services with an upgrade probability less than a preset upgrade probability; based on the upgrade data, calculates the upgrade time length of each service, and screens out services with an upgrade time length less than a preset upgrade time length; combines the screened services into the service list;

[0063] The service management platform first collects data, then performs two layers of screening: first, according to the upgrade probability within a future preset time length, services with low probability are screened out, these services have small possibility of short-term upgrade, and are suitable for being included in the adjustment range; second, the upgrade time length is calculated to screen out services with short time consumption, so as to avoid affecting the overall adjustment process due to long service upgrade time consumption. Finally, the services screened out in the two screenings are integrated to form a service list for subsequent operation.

[0064] Step 103: The container group distribution adjustment device 100 receives the service list sent by the adjustment time recommendation device 300;

[0065] Provide specific objects for subsequent operations such as creating adjustment tasks and executing resource group adjustment.

[0066] Step 104: The container group distribution adjustment device 100 creates an adjustment task corresponding to each service on the service management platform 200, for sequentially adjusting the resource groups of at least one service according to the adjustment service information corresponding to each service;

[0067] Subsequent adjustment of the service-associated container group will be performed according to the rules, and the task is arranged for the actual adjustment operation.

[0068] Step 105: The service management platform 200 detects whether the target service is associated with the adjustment task when performing the upgrade operation on the target service;

[0069] The judgment of whether the target service is associated with the created adjustment task is to clarify the cross-influence of service upgrade and resource adjustment task, to avoid conflicts or omissions in the adjustment process due to service upgrade, and to ensure the coordination of subsequent adjustment task execution and service upgrade operation.

[0070] Step 106: The service management platform 200 sets the task state of the adjustment task corresponding to the target service to a waiting state when the target service is associated with the adjustment task;

[0071] In order to avoid the conflict between the adjustment task and the service upgrade operation, the execution of the adjustment task is suspended, and the state of the adjustment task corresponding to the service is marked as a waiting state. After the service upgrade and other influencing factors are eliminated, the task execution is resumed, which is a state control step to ensure the order of operation and avoid conflicts.

[0072] Step 107: The container group distribution adjustment device 100 receives the notification message sent by the service management platform 200;

[0073] Step 108: The container group distribution adjustment device 100 reads the number of resource groups that have been adjusted from the first cluster to the second cluster in the process of executing the adjustment task by the resource group distribution adjustment device, and the number of resource groups that have not been adjusted in the first cluster, and obtains the ratio of the number of resource groups that have not been adjusted in the first cluster to the number of resource groups in the second cluster as an intermediate distribution ratio;

[0074] The intermediate distribution ratio is used for reference and decision-making in the subsequent adjustment process.

[0075] Step 109: The container group distribution adjustment device 100 sends the intermediate distribution ratio to the service management platform 200;

[0076] The intermediate distribution ratio is sent to the service management platform, so that the service management platform can master the distribution progress and ratio of the current resource groups in different clusters, and provide data support for subsequent adjustment decision-making.

[0077] Step 110: In the case where the service management platform 200 detects that the task state is set to the completion state, the upgrade operation of the target service is performed according to the intermediate distribution ratio, which is used to replace the initial distribution ratio of the target service before adjustment;

[0078] Because the intermediate distribution ratio reflects the latest actual distribution of the resource group, it enables the upgrade operation to be performed based on parameters that are more in line with the current resource state, ensuring the adaptability of the upgrade and the resource distribution, which is a key step in performing service upgrade in combination with resource adjustment results.

[0079] Step 111: The service management platform 200 writes the second cluster configuration information into the resource of the resource orchestration engine selector, triggering the resource orchestration engine to perform update according to the rolling update strategy of the cluster according to the second service configuration information;

[0080] The implementation of the synchronous adjustment of service configuration and resource cluster distribution ensures that the service can be stably operated based on the new cluster configuration after resource adjustment, which is the final execution step of resource configuration update and service adaptation.

[0081] As shown in Figure 3 The container group distribution adjustment method can include steps 110-130, and the method is applied to a container group distribution adjustment device, as shown below:

[0082] Step 110: Receive the notification message sent by the service management platform; the notification message is used to indicate that the target service in the running state is executed for upgrade operation, and the task state of the adjustment task associated with the target service is set to the waiting state; the adjustment task is used to describe the distribution adjustment task of migrating the container group from the first cluster to the second cluster, and the notification message contains the identification information of the target service;

[0083] Service management platform: a platform for managing service upgrade, configuration delivery and task storage. The service management platform is used to receive the service upgrade request of the user, deliver the upgrade task to the unified logical cluster, and store and manage the state information of the adjustment task. As a bridge between the user and the cluster, the service management platform can coordinate service upgrade and container group distribution adjustment to ensure that the two do not conflict.

[0084] Notification message: a message sent by the service management platform, used to notify the occurrence of an event to the relevant or module. The notification message includes the identification information of the target service, such as the service name; the task state of the adjustment task, such as being set to the "waiting state"; the notification message is an important way of intercommunication, used to trigger subsequent operations.

[0085] Adjustment task: used to describe the task of container group distribution adjustment, including target service, adjustment policy, task status and other information. The adjustment task is the core management unit of container group distribution adjustment, which is used to ensure the orderliness of the adjustment process.

[0086] Task status: represents the current execution phase of the adjustment task. The task status includes:

[0087] Waiting state: an intermediate state of the adjustment task, used to identify that the current adjustment task is temporarily suspended due to external events such as service upgrade, and is in a state of waiting for resumption of execution. It plays the role of interruption marker in the task life cycle.

[0088] Completion state: indicates that the task has been completed and subsequent operations can continue.

[0089] The message is received using a message queue or API call, the message content is parsed, and the target service and task status are extracted.

[0090] When the service upgrade operation is initiated on the running target service through the service management platform, the service management platform detects that the target service is associated with an ongoing container group distribution adjustment task. Since the container group will be gradually replaced during the service upgrade process, if container group migration is performed at the same time, it may cause resource conflicts and traffic routing confusion. For example, the new container group is created in the first cluster during the upgrade, while the adjustment task is migrating the container group to the second cluster, which will cause the service instance state to be out of control.

[0091] Therefore, the service management platform sets the adjustment task status to the waiting state and sends a notification message containing the target service identifier and the task status. The container group distribution adjustment device receiving the notification message can identify the specific task that needs to be suspended according to the notification message, suspend the container group migration process, and avoid parallel execution with the upgrade operation.

[0092] Step 120, in response to the notification message, reading the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device during the execution of the adjustment task, and obtaining the number of container groups that have not been adjusted in the first cluster and the ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster as an intermediate distribution ratio.

[0093] Intermediate distribution ratio: based on the current progress of container group migration, the proportional relationship between the number of remaining container groups in the first cluster and the number of migrated container groups in the second cluster is calculated, which is used for subsequent service upgrade operations.

[0094] When the container group distribution adjustment device receives the notification message of the service management platform, it learns that the target service starts upgrading and the adjustment task needs to be suspended. In order to avoid that the service upgrade uses the wrong container group distribution state, the current adjustment progress needs to be recorded. By reading the number of container groups that have been adjusted from the first cluster to the second cluster, and the number of container groups in the first cluster that have not been adjusted, the proportion of the two is calculated.

[0095] For example, if the first cluster originally has 10 container groups, 2 have been migrated to the second cluster, and the intermediate distribution ratio is 8:2 at this time. The intermediate distribution ratio will replace the initial distribution ratio before adjustment, providing accurate container group distribution information for the service management platform, so that the service upgrade is based on the current actual intermediate distribution ratio, avoiding resource error configuration or service interruption caused by inconsistent distribution information.

[0096] The container orchestration engine logic cluster API or federation control plane is called to query the container group distribution information of the target service. The task state is updated, such as modifying the task state field in the database. By querying the intermediate distribution ratio of the container group distribution, the actual state of the container group distribution is accurately understood. The task state is set to "completed state", indicating that the container group distribution adjustment has been completed, and subsequent operations can continue. It is ensured that the service upgrade is performed after the container group distribution adjustment is completed, avoiding service interruption caused by simultaneous execution of the two.

[0097] It is ensured that the container group distribution information used during service upgrade is consistent with the current adjustment progress, avoiding upgrading when there is no available container group in the second cluster, resulting in the target service being unavailable. Based on the actual distribution ratio, the upgrade is performed, which can smoothly transition the container group version and reduce the impact of the upgrade on service operation.

[0098] Step 130, setting the task state to the completed state;

[0099] After the container group distribution adjustment task is suspended due to the target service upgrade, the intermediate distribution ratio has been obtained and calculated. At this time, the task state is set to the completed state, and the service management platform can determine the task completion state when it detects the task state set to the completed state, avoiding the service management platform waiting for the adjustment task to end, so that the service upgrade process can be started in time, shortening the service upgrade time.

[0100] Step 140, sending the intermediate distribution ratio to the service management platform, so that the service management platform can perform the upgrade operation of the target service according to the intermediate distribution ratio when it detects that the task state is set to the completed state. The intermediate distribution ratio is used to replace the initial distribution ratio of the target service before adjustment.

[0101] Initial distribution ratio: Before the container group distribution adjustment task starts, the target service has a container group distribution ratio in each cluster, such as 10 in the first cluster and 0 in the second cluster before adjustment, i.e. 10:0.

[0102] After the container group distribution adjustment task is suspended due to target service upgrade, the intermediate distribution ratio reflecting the current distribution state is calculated. At this time, the intermediate distribution ratio is sent to the service management platform, which is to deliver the latest and accurate container group distribution data to the service management platform.

[0103] The intermediate distribution ratio of the container group distribution is sent back to the service management platform. The service management platform can specifically send a query request to the task state storage node at a preset period to obtain the state field value of the target adjustment task, and trigger the upgrade process when it is found that the state has changed to "completed state". The intermediate distribution ratio is sent to the service management platform through API call or message queue. The service management platform triggers the service upgrade process according to the intermediate distribution ratio.

[0104] When the service management platform detects that the task state is in the completed state, it indicates that the container group distribution adjustment task has provided available data, and the upgrade operation can be performed according to the intermediate distribution ratio. By replacing the initial distribution ratio with the intermediate distribution ratio, it is ensured that the service upgrade is based on the current actual distribution state, avoiding the use of outdated distribution information leading to incorrect upgrade strategy, and ensuring the accuracy and effectiveness of the upgrade operation.

[0105] The intermediate distribution ratio of the container group distribution is fed back to the service management platform, providing the basis for service upgrade. The intermediate distribution ratio clearly specifies the target distribution of the container group in each cluster, and the service management platform modifies the Deployment resource accordingly, adds topology distribution constraints, and specifies the number of container groups created in different clusters, such as setting the replica number to 8 in A cluster and 2 in B cluster.

[0106] During upgrade, the service management platform triggers gradual rolling update, creating new version container groups in stages and terminating old versions, while achieving proportional traffic distribution through label selector. In this way, the service management platform performs upgrade operation according to the intermediate distribution ratio, ensuring that the upgrade is performed on the correct cluster and node. Through the sending and receiving of the intermediate distribution ratio, the coordination of service upgrade and container group distribution adjustment is realized, ensuring the integrity and consistency of the entire process.

[0107] Through message passing, state management and result feedback, the coordination of service upgrade and container group distribution adjustment is realized, and through the synchronization of task state and feedback of adjustment result, it is ensured that the service upgrade operation is performed after the completion of the container group distribution adjustment, thereby avoiding service interruption and resource conflict, which can significantly improve the stability and user experience.

[0108] In a possible embodiment, before step 110, the method further comprises:

[0109] obtaining a service list, the service list comprising at least one service and adjustment order information corresponding to each service;

[0110] creating, by the service management platform, an adjustment task corresponding to each service for sequentially adjusting the container groups of the at least one service according to the adjustment order information corresponding to each service; the adjustment task comprises at least one of the following task information: task identification information, a service name, and a task state.

[0111] adjustment task: a task for describing container group distribution adjustment, comprising task identification information, a service name, and a task state, and the like. The adjustment task is a core management unit of container group distribution adjustment, and is used to ensure the orderliness and traceability of the adjustment process.

[0112] task identification information: uniquely identifying an adjustment task, such as a task ID.

[0113] service name: identifying a service associated with the task.

[0114] service list, comprising:

[0115] service name: uniquely identifying each service.

[0116] adjustment order information: defining the priority or order of service adjustment. The rules or configurations for describing the priority or order of service adjustment. For example, ordering according to the dependency relationship, such as adjusting the base service first and then adjusting the dependent service. Ordering according to the business importance, such as adjusting the core service first and then adjusting the non-core service. The adjustment order information can ensure the orderliness of service adjustment, and avoid adjustment failure or service interruption caused by the dependency relationship or business priority.

[0117] The service list is the basis for service adjustment and adjustment task management, and ensures that the adjustment operation is performed according to the predetermined order.

[0118] In the above-mentioned step of obtaining the service list, the following steps can be included:

[0119] sending a service list request message to the adjustment time recommendation device, so that the adjustment time recommendation device collects upgrade data of the services through the service management platform, and based on the upgrade data, calculates the upgrade probability of each service within a future preset time length, and filters out services with an upgrade probability less than a preset upgrade probability; based on the upgrade data, the average upgrade time length of each service is calculated, and services with an upgrade time length less than a preset upgrade time length are filtered out; the filtered services are combined into a service list; the upgrade data comprises an upgrade time and an upgrade time length;

[0120] Receive the service list sent by the adjustment time recommendation device.

[0121] Adjustment time recommendation device: a data analysis-based tool for recommending a time window suitable for container group distribution adjustment. Collect service upgrade data, analyze the upgrade data, and generate a service list. Recommend a time window suitable for container group distribution adjustment. Through a data-driven recommendation mechanism, reduce the conflict between container group distribution adjustment and service upgrade, and improve the success rate of adjustment.

[0122] Service list request message: a message for requesting a service list, sent to the adjustment time recommendation device. The service list request message can include: the requested service list type, such as "low upgrade probability service list"; and the requested parameters, such as the preset time length, the preset upgrade probability, and the preset upgrade time length.

[0123] Upgrade data: historical data related to service upgrades. Upgrade data is the basis for analysis and recommendation by the adjustment time recommendation device. Upgrade data includes:

[0124] Upgrade time: the specific time point of service upgrade.

[0125] Upgrade duration: the time taken for service upgrade.

[0126] Statistical analysis of upgrade data can be performed using data analysis tools. According to the preset conditions, services are filtered, and according to the upgrade data, services that meet the following conditions are selected: services with an upgrade probability less than the preset upgrade probability within the preset time length; and services with an upgrade duration less than the preset upgrade duration. The filtered services are grouped into a service list.

[0127] Future preset time length: a pre-set time range, such as the next 30 days. Used to limit the time range for analyzing upgrade data, ensuring the timeliness of the recommendations.

[0128] Preset upgrade probability: a pre-set upgrade probability threshold, such as 10%. Used to filter services with a low upgrade probability within the preset time length.

[0129] Preset upgrade duration: a pre-set upgrade duration threshold, such as 5 minutes. Used to filter services with a short upgrade duration.

[0130] Send a service list request message to the adjustment time recommendation device to trigger the generation of a service list. The request message contains parameters such as the preset time length, the preset upgrade probability, and the preset upgrade duration. Specifically, the request message can be sent using API calls or message queues. Call the API of the service management platform to obtain historical upgrade records. Extract upgrade data from the database or logs.

[0131] The adjustment time recommendation device collects upgrade data of each service through the service management platform, including historical upgrade time, upgrade duration, success rate, etc. By predicting the upgrade possibility of the service within a preset time period in the future, services with an upgrade probability lower than a preset upgrade probability are selected. After removing outliers, the average upgrade duration of the service is calculated, and services with a duration lower than a preset upgrade duration are selected.

[0132] The services are sorted by upgrade probability from low to high, and services with low upgrade possibility are processed first to reduce the probability of adjustment and upgrade conflicts. If the upgrade probabilities are the same, the services are sorted by upgrade duration from short to long to ensure that the adjustment is completed quickly. If the upgrade success rate is considered, services with high success rates are prioritized to improve adjustment stability. The sorted services are used to form adjustment order information in the service list to guide the execution of adjustment tasks in sequence. The service list is received using API calls or message queues. The service list is stored in local cache or database for subsequent use.

[0133] The adjustment time recommendation device is triggered to analyze the upgrade data by sending a request message. The preset time period, preset upgrade probability, and preset upgrade duration are passed to the adjustment time recommendation device to ensure the accuracy of the analysis. The generation of the service list is supported by the data. By analyzing historical upgrade data, future upgrade behavior is predicted. By selecting services suitable for container group distribution adjustment, the possibility of being disturbed by upgrade operations during adjustment is reduced. The conflict between container group distribution adjustment and service upgrade is effectively reduced, and the success rate of adjustment is improved.

[0134] The container group distribution adjustment device receives the recommended service list from the adjustment time recommendation device. For example, the service list can be as follows:

[0135] Service B, Service D.

[0136] The container group distribution adjustment device creates an adjustment task corresponding to each service on the service management platform according to the received service list. Each adjustment task contains the following information: task ID: a unique ID that uniquely identifies the task. Service name: the name of the service that needs to be adjusted. Current adjustment state: the initial state is Initial.

[0137] For example, the container group distribution adjustment device creates the following two adjustment tasks:

[0138] Task 1:

[0139] Task ID: task-001;

[0140] Service name: Service B;

[0141] Current adjustment state: Initial.

[0142] Task 2:

[0143] Task ID: task-002;

[0144] Service Name: Service D;

[0145] Current Adjustment Status: Initial.

[0146] Specifically, the API of the service management platform can be called to obtain the service list. The service list can be read from a configuration file or a database. The API of the service management platform can be called to create an adjustment task. The task information can be stored in a database or a task queue.

[0147] According to the adjustment order information in the service list, the container groups of each service are adjusted in turn. During the adjustment process, the container group distribution adjustment and the service adjustment are coordinated according to the state of the adjustment task.

[0148] Specifically, the task scheduler or custom scheduling logic can be used to trigger the adjustment operation in turn according to the adjustment order. The multiple services and adjustment order information can be integrated into a list for unified management. The adjustment operation provides a clear order and priority, ensuring the orderliness of the adjustment process. An independent adjustment task is created for each service to ensure the independence and traceability of the container group distribution adjustment. Through the management of the task state, the container group distribution adjustment and the service adjustment are coordinated.

[0149] The services are adjusted in turn according to the predetermined order to avoid adjustment failure due to dependency relationship or business priority. Through the coordination of container group distribution adjustment and service adjustment, the resource utilization is optimized and the risk of service interruption is reduced. Through the acquisition of service list, the creation of adjustment task and the adjustment in turn according to the adjustment order information, the coordination of service adjustment and container group distribution adjustment is realized. The orderliness of the adjustment process, the optimization of resource utilization and the high availability of the service are ensured.

[0150] In one possible embodiment, the following steps can also be included:

[0151] The container group distribution adjustment device obtains the current adjustment requirement;

[0152] According to the current adjustment requirement, the distribution of the container group is adjusted, and the task state of the adjustment task being adjusted is set to a running state.

[0153] The container group distribution adjustment device first obtains the current adjustment requirement. The adjustment requirement can include the following contents:

[0154] Target node: The target node to which the container group needs to be migrated.

[0155] Resource requirement: CPU, memory and other resources required by the container group.

[0156] Adjustment strategy: e.g. priority, resource utilization optimization, etc.

[0157] The container group distribution adjustment device starts to adjust the distribution of the container group according to the adjustment requirement. The specific steps are as follows:

[0158] The service management platform obtains the task with the current state of Initial; the Initial task after screening is sorted according to the adjustment strategy, and the container group task to be adjusted is selected from the sorting result, and the distribution adjustment operation is performed according to the preset migration rule in the adjustment requirement, to ensure that the adjustment process meets the resource planning and business priority requirements. In the adjustment process, the container group distribution adjustment device will update the task state to Running. The service management platform will record and monitor the state change of the task.

[0159] Exemplarily, service B:

[0160] Initial state: Initial;

[0161] The container group distribution adjustment device selects the task with the task ID of task-001. The task state is updated to Running. The container group of service B is migrated to the target node, and the required resources are allocated.

[0162] Service D:

[0163] Initial state: Initial;

[0164] The container group distribution adjustment device selects the task with the task ID of task-002. The task state is updated to Running. The container group of service D is migrated to the target node, and the required resources are allocated.

[0165] Adjustment process example:

[0166] The container group of service B needs to be migrated from node A to node B, and needs to be allocated 2 CPUs and 4 GB of memory. The container group distribution adjustment device will perform the following steps: check whether the resources of node B meet the requirement; migrate the container group of service B from node A to node B; allocate 2 CPUs and 4 GB of memory for the container group of service B on node B.

[0167] The service management platform will continuously monitor the state of the task and record the execution of the task. If the task is successfully completed, the state will be updated to Completed; if the task fails, the state will be updated to Failed; if the task is interrupted, the state will be updated to Interrupted.

[0168] The embodiment of the application receives a notification message sent by a service management platform, the notification message is used to indicate that a target service in a running state is executed with an upgrade operation, and a task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task of migrating a container group from a first cluster to a second cluster, and the notification message contains identification information of the target service; the container group distribution adjustment device can identify a specific task to be suspended according to the notification message, suspend the container group migration process, and avoid parallel execution with the upgrade operation.

[0169] In response to the notification message, the number of container groups that have been adjusted from the first cluster to the second cluster in the process of executing the adjustment task by the container group distribution adjustment device and the number of container groups that have not been adjusted in the first cluster are read, and a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster is obtained as an intermediate distribution ratio, the task state is set to a completed state, and the service management platform can determine the task completion state in the case of detecting the information of the task completion state, so that the service upgrade process can be started in time;

[0170] The intermediate distribution ratio is sent to the service management platform, so that the service management platform can execute the upgrade operation of the target service according to the intermediate distribution ratio in the case of detecting that the task state is set to the completed state, the initial distribution ratio is replaced by the intermediate distribution ratio, the service upgrade is ensured to be based on the current actual intermediate distribution ratio, the upgrade strategy error caused by using the outdated initial distribution ratio is avoided, and the accuracy and effectiveness of the upgrade operation are ensured.

[0171] As shown in Figure 4 The container group distribution adjustment method can include steps 210-240, and the method is applied to a service management platform, as shown below:

[0172] Step 210, when the upgrade operation of the target service is executed, whether the target service is associated with an adjustment task is detected;

[0173] Service management platform: a platform for managing service upgrade, configuration delivery and task storage. Used to receive the service upgrade request of the user, deliver the upgrade task to the unified logical cluster, store and manage the state information of the adjustment task. As a bridge between the user and the cluster, the service management platform can coordinate the service upgrade and the container group distribution adjustment to ensure that the two do not conflict.

[0174] Target service: a service that needs to be upgraded at present. Has a unique service name or identification. May have a dependency relationship with other services. The target service is the core object of the upgrade operation, and the upgrade process of the target service needs to be coordinated with the adjustment of the container group distribution.

[0175] Adjustment task: a task used to describe the container group distribution adjustment, containing task identification information, service name, and task status, etc.

[0176] Adjustment task is the core management unit of container group distribution adjustment, used to ensure the orderliness and traceability of the adjustment process.

[0177] Notification message: a message sent by the service management platform, used to notify the container group distribution adjustment device of the occurrence of an event.

[0178] When performing an upgrade operation on a target service, the service management platform checks whether the service is associated with an adjustment task. The basis for association can be service name, task identification, etc. Query the task database or task queue to check whether there is an adjustment task associated with the target service. Ensure that the target service is associated with the adjustment task before the upgrade operation to avoid missing critical tasks. Provide a trigger condition for the upgrade operation of the target service.

[0179] Step 220, in the case where the target service is associated with an adjustment task, set the task status of the adjustment task corresponding to the target service to a waiting state, and send a notification message to the container group distribution adjustment device, so that the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device in the process of executing the adjustment task, and the number of container groups that have not been adjusted in the first cluster, and obtains the ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task status to a completed state.

[0180] If the target service is associated with an adjustment task, the service management platform sets the task status of the adjustment task to "waiting state". Send a notification message to the container group distribution adjustment device to trigger the operation of the container group distribution adjustment device. Update the task status field in the task database or task queue. Send the notification message using API call or message queue. By setting the task status to "waiting state", the consistency of the task status is ensured. Message passing: by sending a notification message, the operation of the container group distribution adjustment device is triggered, and the cooperation between them is realized.

[0181] Exemplarily, the service management platform notifies the container group distribution adjustment device that the task state of the adjustment task corresponding to service A has been set to the pending state. The "Pending" state indicates that a certain adjustment task has been identified and recorded, but has not yet started execution. The adjustment task is waiting for resources, permissions or other conditions to be met before starting execution. When the user performs the upgrade operation on service A, the service management platform detects that service A is currently associated with an adjustment task, and sets the task state to Pending. This means that the adjustment task of service A has been identified by the service management platform. The adjustment task is waiting for further processing, such as waiting for resource allocation, permission checking, etc.

[0182] Exemplarily, the user performs an upgrade operation on service A through the service management platform. The service management platform detects that service A currently has an adjustment task with task ID task-003, and sets the task state to Pending. The service management platform notifies the container group distribution adjustment device that the task state of the adjustment task corresponding to service A has been set to Pending. After receiving the notification, the container group distribution adjustment device immediately stops the current adjustment operation and records the current distribution result: A cluster container group: 8; B cluster container group: 2.

[0183] Step 230, receiving the intermediate distribution ratio sent by the container group distribution adjustment device;

[0184] After completing the container group distribution adjustment, the container group distribution adjustment device sends the intermediate distribution ratio to the service management platform. The service management platform receives and stores the intermediate distribution ratio. Specifically, the intermediate distribution ratio can be received using API calls or message queues. The intermediate distribution ratio is stored in a database or cache. Receiving the intermediate distribution ratio of the container group distribution adjustment device provides a basis for service upgrade. Ensures that the service management platform has an accurate understanding of the latest state of the container group distribution.

[0185] Step 240, in the case where it is detected that the task state is set to the completed state, performing an upgrade operation on the target service according to the intermediate distribution ratio, the intermediate distribution ratio being used to replace the initial distribution ratio of the target service before adjustment.

[0186] After the service management platform detects that the task state of the adjustment task is "completed state", the upgrade operation of the target service is performed according to the intermediate distribution ratio. The upgrade operation includes creating new container groups, updating configurations, deleting old container groups, etc. Specifically, the container orchestration engine logic cluster API can be called to perform the upgrade operation on the correct cluster and node according to the intermediate distribution ratio. The rolling update strategy is used to ensure the availability of the service during the upgrade process.

[0187] The intermediate distribution ratio determines the actual distribution number of the container group in different clusters. The upgrade operation takes the intermediate distribution ratio as the target distribution rule, and through the topology distribution configuration function of the container orchestration tool, it forcibly requires the new version container group to be deployed to the corresponding cluster in the same proportion. For example, in the deployment configuration, set the total number of replicas to the adjusted total number of 10, and specify that the first cluster allocates 8 replicas and the second cluster allocates 2 replicas, to ensure that the newly created container group strictly follows the adjusted distribution state, avoiding incorrect resource deployment due to inconsistent distribution information.

[0188] The upgrade process adopts a gradual strategy, first creating new version container groups in the second cluster step by step until the adjusted target number is 2. In this stage, only new container groups are added, and old instances are not terminated, ensuring service availability is not affected. After the new version container group in the second cluster is stable, terminate the old version container group in the first cluster in batches, and create the same number of new version container groups, until the instance number in the first cluster is adjusted to 8, ensuring that the service always has enough instances to handle requests during the upgrade process, avoiding interruption.

[0189] According to the intermediate distribution ratio, the upgrade operation is performed to ensure that the upgrade is performed on the correct cluster and node. By coordinating container group distribution adjustment and service upgrade, the risk of service interruption is reduced. The entire process of service upgrade is completed to ensure high availability and stability.

[0190] Through task association detection, task state setting, notification message sending, adjustment result receiving, and upgrade operation execution, the coordination of service upgrade and container group distribution adjustment is realized. Service interruption and resource conflicts can be effectively avoided.

[0191] In one possible embodiment, after step 210, the method further comprises:

[0192] In the case where the target service is not associated with the adjustment task, generating first service configuration information of the upgraded target service; the first service configuration information includes: container group template, resource requirement, environment variable;

[0193] The first service configuration information is issued to the container orchestration engine logical cluster.

[0194] The first service configuration information: the configuration information of the upgraded target service, including container group template, resource requirement, environment variable, etc.

[0195] Container group template: defines the container image, resource limit, etc. of the upgraded container group.

[0196] Resource requirement: specifies the CPU, memory, etc. required by the upgraded service.

[0197] Environment variable: configures the environment variable required for the upgraded service to run.

[0198] The first service configuration information is the core content of service upgrade, ensuring that the upgraded service can operate normally.

[0199] When performing the upgrade operation on the target service, the service management platform checks whether the target service is associated with an adjustment task. If the target service is not associated with the adjustment task, the process of generating and issuing the configuration information is directly entered.

[0200] According to the upgrade configuration provided by the user, the service configuration information after the upgrade is generated. The configuration information includes container group templates, resource requirements, environment variables, etc. The container orchestration engine logical cluster resource configuration file can be generated using a template engine. The user-provided upgrade configuration is combined with the template to generate the final first service configuration information. The generated first service configuration information is issued to the logical cluster through the container orchestration engine logical cluster API. The logical cluster creates or updates resources in the corresponding physical cluster according to the configuration information. The container orchestration engine logical cluster API can be called to apply the configuration information to the logical cluster. The configuration information is distributed to each physical cluster using the federation control plane.

[0201] Ensuring that the target service is associated with the adjustment task before the upgrade operation can avoid missing critical tasks. According to the detection result, it is determined whether to enter the process of generating and issuing the configuration information. According to the upgrade configuration provided by the user, resource configuration information that meets the specification of the container orchestration engine logical cluster can be generated.

[0202] Apply the upgraded configuration information to the container orchestration engine logical cluster to trigger the creation or update of resources. Ensure that the resource configuration in the logical cluster is consistent with the user's desired state. Through the automated process, reduce manual intervention, and improve upgrade efficiency and accuracy.

[0203] When the target service is not associated with the adjustment task, the first service configuration information after the upgrade is directly generated, and the first service configuration information is issued to the container orchestration engine logical cluster. This can simplify the upgrade process, improve upgrade efficiency, and ensure the accuracy and consistency of resource configuration. Through automated generation and issuance of configuration information, the upgrade demand can be quickly responded to.

[0204] In one possible embodiment, after step 240, the method further comprises:

[0205] According to the intermediate distribution ratio, the second service configuration information of the target service after the upgrade is generated;

[0206] The second service configuration information is written into the resources of the container orchestration engine logical cluster, triggering the container orchestration engine logical cluster to update according to the rolling update strategy of the second service configuration information.

[0207] Second service configuration information: configuration information of the upgraded target service generated according to the intermediate distribution ratio. Container group template: definition of the container image, resource limit, etc. of the upgraded container group. The second service configuration information is the core content of service upgrade, which ensures that the upgraded service can run normally and is consistent with the result of container group distribution adjustment.

[0208] According to the intermediate distribution ratio of the container group distribution adjustment, the configuration information of the upgraded target service is generated. The configuration information includes container group template, resource requirement, scheduling strategy, etc. The container orchestration engine logical cluster resource configuration file can be generated using a template engine. The intermediate distribution ratio is combined with the upgrade configuration provided by the user to generate the final configuration information.

[0209] The generated second service configuration information is issued to the logical cluster through the container orchestration engine logical cluster API. The logical cluster creates or updates resources in the corresponding physical cluster according to the configuration information. The container orchestration engine logical cluster API can be called to apply the configuration information to the logical cluster. The configuration information is distributed to each physical cluster using the federation control plane.

[0210] According to the intermediate distribution ratio of the container group distribution adjustment, the resource configuration information conforming to the container orchestration engine logical cluster specification is generated. According to the intermediate distribution ratio, the scheduling strategy of the container group is optimized to ensure that the container group is distributed on the correct cluster and node. User-defined upgrade configuration is supported to meet the needs of different services. The upgraded configuration information is applied to the container orchestration engine logical cluster to trigger the creation or update of resources. Ensure that the resource configuration in the logical cluster is consistent with the user's desired state.

[0211] The service management platform reflects the new service configuration in the second service configuration information and issues it to the unified K8s logical cluster. The new service configuration will allocate the number of container groups according to the new ratio, such as 8 container groups in cluster A and 2 container groups in cluster B.

[0212] The rolling update mechanism of Deployment will ensure that the new service configuration is updated gradually. The specific steps are as follows: create new container groups according to the new configuration; gradually delete old container groups to ensure that the service is always available during the update process; when all old container groups are deleted and new container groups are created and running, the update is complete.

[0213] Exemplarily, the following flow is included:

[0214] The service management platform detects that the state of service A is Completed; the service management platform detects that the adjustment task corresponding to service A is in the Completed state, indicating that the container group distribution adjustment has been completed.

[0215] The service management platform continues the upgrade operation of service A; the upgrade operation can include updating the configuration, image version, etc. of the service.

[0216] The service management platform reflects the new service configuration in the Deployment and delivers it to the unified K8s logical cluster. The new service configuration will allocate the number of container groups according to the new ratio, i.e. the number of container groups of the A cluster is 8 and the number of container groups of the B cluster is 2.

[0217] The second service configuration information of the upgraded target service is generated according to the intermediate distribution ratio adjusted according to the container group distribution, and the second service configuration information is delivered to the container orchestration engine logical cluster. The coordination of service upgrade and container group distribution adjustment can be ensured, resource scheduling can be optimized, and upgrade efficiency can be improved. Through automatic generation and delivery of configuration information, the upgrade demand can be quickly responded.

[0218] In the embodiment of the application, when performing the upgrade operation on the target service, it is detected whether the target service is associated with the adjustment task; in the case where the target service is associated with the adjustment task, the task state of the adjustment task corresponding to the target service is set to a waiting state, and a notification message is sent to the container group distribution adjustment device, so that the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device in the process of performing the adjustment task, and the number of container groups that have not been adjusted in the first cluster, and obtains the ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, sets the task state to a completed state, and the service management platform can determine the task completion state when detecting the information of the task completion state, so that the service upgrade process can be started in time;

[0219] In the case where it is detected that the task state is set to the completed state, the upgrade operation of the target service is performed according to the intermediate distribution ratio, the initial distribution ratio is replaced by the intermediate distribution ratio, the service upgrade is ensured to be based on the current actual intermediate distribution ratio, the upgrade strategy error caused by using the outdated initial distribution ratio is avoided, and the accuracy and effectiveness of the upgrade operation are ensured.

[0220] The embodiment of the application also provides a service list generation method, which is applied to an adjustment time recommendation device and specifically as follows:

[0221] In step 310, a service list request message sent by the container group distribution adjustment device is received.

[0222] Container group distribution adjustment device: a tool or mechanism for migrating container groups between different physical container orchestration engine logical clusters. Receive service list request message. Adjust container group distribution according to service list. Through the container group distribution adjustment device, ensure the coordination of container group distribution and service upgrade.

[0223] Service list request message: a message for requesting a service list, sent to the service management platform.

[0224] The service management platform receives the service list request message from the container group distribution adjustment device. The request message contains parameters such as preset duration, preset upgrade probability, and preset upgrade duration. The request message can be received using API calls or message queues. Parse the request message and extract the key parameters.

[0225] Step 320, in response to the service list request message, collect upgrade data of services through the service management platform;

[0226] The service management platform collects upgrade data of services according to the parameters in the request message. Upgrade data includes upgrade time and upgrade duration. The upgrade data can be extracted from the database or log by calling the API of the service management platform.

[0227] Step 330, generate a service list according to the upgrade data; the service list includes services with an upgrade probability less than the preset upgrade probability within the preset duration and services with an upgrade duration less than the preset upgrade duration; the upgrade data includes upgrade time and upgrade duration;

[0228] According to the upgrade data, filter out services that meet the following conditions: services with an upgrade probability less than the preset upgrade probability within the preset duration; services with an upgrade duration less than the preset upgrade duration. The filtered services form a service list. Statistical analysis of upgrade data can be performed using data analysis tools. Filter services according to preset conditions and generate a service list.

[0229] Step 340, send the service list to the container group distribution adjustment device.

[0230] Send the generated service list to the container group distribution adjustment device. The container group distribution adjustment device adjusts the container group distribution according to the service list. The service list is sent using API calls or message queues. By receiving the service list request message, collecting upgrade data, generating the service list, and sending the service list, service filtering based on historical upgrade data is achieved, which can effectively reduce the conflict between container group distribution adjustment and service upgrade, and improve the success rate of adjustment. Through the data-driven recommendation mechanism, resource scheduling can be optimized.

[0231] The embodiment of the application receives a request message, triggers the service management platform to analyze upgrade data. The preset time length, the preset upgrade probability, the preset upgrade time length and other parameters are transmitted to the service management platform to ensure the accuracy of the analysis. Data support is provided for the generation of a service list. By analyzing historical upgrade data, future upgrade behavior is predicted. Services suitable for container group distribution adjustment are screened out to reduce the possibility of interference by upgrade operations during the adjustment process. Through a data-driven recommendation mechanism, the success rate and efficiency of container group distribution adjustment are improved. The generated service list is synchronized to a container group distribution adjustment device for subsequent operation. The service list generation and sending process is completed to provide a basis for container group distribution adjustment.

[0232] Based on the container group distribution adjustment method shown in the above Figure 3 The embodiment of the application also provides a container group distribution adjustment device, as shown in the above Figure 5 The container group distribution adjustment device 500 can include:

[0233] The first receiving module 510 is configured to receive a notification message sent by the service management platform; the notification message is used to indicate that a target service in a running state is executed by an upgrade operation, and a task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task of migrating a container group from a first cluster to a second cluster, and the notification message contains identification information of the target service;

[0234] The determination module 520 is configured to read, in response to the notification message, a number of container groups that have been adjusted from the first cluster to the second cluster during execution of the adjustment task by the container group distribution adjustment device, and a number of container groups that have not been adjusted in the first cluster, and obtain a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio;

[0235] The setting module 530 is configured to set the task state to a completed state;

[0236] The first sending module 540 is configured to send the intermediate distribution ratio to the service management platform, so that the service management platform executes an upgrade operation of the target service according to the intermediate distribution ratio in a case where the task state is detected to be set to the completed state, and the intermediate distribution ratio is used to replace an initial distribution ratio of the target service before adjustment.

[0237] In a possible embodiment, the device 500 further includes:

[0238] The acquisition module is configured to acquire a service list, the service list including at least one service and adjustment sequence information corresponding to each service.

[0239] A creation module is used to create an adjustment task corresponding to each of the services on the service management platform, so as to adjust the container group of at least one of the services in sequence according to the adjustment sequence information corresponding to each of the services; the adjustment task includes at least one of the following task information: task identification information, service name and task status.

[0240] In a possible embodiment, the acquisition module is specifically configured to:

[0241] sending a service list request message to the time adjustment recommendation device, so that the time adjustment recommendation device collects upgrade data of the services through the service management platform, and based on the upgrade data, calculates the upgrade probability of each service within a future preset time period, and filters out services whose upgrade probability is less than the preset upgrade probability; based on the upgrade data, calculates the average upgrade duration of each service, and filters out services whose upgrade duration is less than the preset upgrade duration; and combines the filtered services into the service list; the upgrade data includes: upgrade time and upgrade duration;

[0242] Receive the service list sent by the adjustment time recommendation device.

[0243] In an embodiment of the present invention, a notification message sent by a service management platform is received, where the notification message is used to indicate that an upgrade operation has been performed on a target service that is already in a running state, and the task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task for migrating a container group from a first cluster to a second cluster, and the notification message includes identification information of the target service; a container group distribution adjustment device can identify a specific task to be suspended based on the notification message, suspend the container group migration process, and avoid parallel execution with the upgrade operation.

[0244] In response to the notification message, the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device during the execution of the adjustment task, as well as the number of container groups that have not been adjusted in the first cluster, are read, and a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster is obtained as an intermediate distribution ratio, and the task status is set to a completed status. When the service management platform detects the task completion status information, it can clarify the task completion status, so that the service upgrade process can be started in a timely manner;

[0245] The intermediate distribution ratio is sent to the service management platform so that the service management platform can perform the upgrade operation of the target service according to the intermediate distribution ratio when it detects that the task status is set to the completed status. By replacing the initial distribution ratio with the intermediate distribution ratio, it is ensured that the service upgrade is based on the current actual intermediate distribution ratio, avoiding the use of outdated initial distribution ratios that lead to upgrade strategy errors, and ensuring the accuracy and effectiveness of the upgrade operation.

[0246] Based on the above Figure 4 The container group distribution adjustment method shown in the embodiment of the present application also provides a container group distribution adjustment device. As shown in the figure, the container group distribution adjustment device 600 can include: Figure 6

[0247] The detection module 610 is configured to detect whether the target service is associated with an adjustment task when performing an upgrade operation on the target service.

[0248] The setting module 620 is configured to, in a case where the target service is associated with an adjustment task, set a task state of the adjustment task corresponding to the target service to a waiting state, and send a notification message to the container group distribution adjustment device, so that the container group distribution adjustment device reads, in response to the notification message, a number of container groups of the second cluster that have been adjusted from the first cluster in a process of performing the adjustment task by the container group distribution adjustment device, and a number of container groups of the first cluster that have not been adjusted, and obtains a ratio of the number of container groups of the first cluster that have not been adjusted to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task state to a completed state.

[0249] The second receiving module 630 is configured to receive the intermediate distribution ratio sent by the container group distribution adjustment device.

[0250] The execution module 640 is configured to, in a case where it is detected that the task state is set to the completed state, perform an upgrade operation of the target service according to the intermediate distribution ratio, and the intermediate distribution ratio is used to replace an initial distribution ratio of the target service before adjustment.

[0251] In a possible embodiment, the device 600 further includes:

[0252] The first generation module is configured to, in a case where the target service is not associated with an adjustment task, generate first service configuration information of the target service after upgrade; the first service configuration information includes a container group template, resource requirements, and environment variables.

[0253] The delivery module is configured to deliver the first service configuration information to a container orchestration engine logical cluster.

[0254] In a possible embodiment, the device 600 further includes:

[0255] The second generation module is configured to generate second service configuration information of the target service after upgrade according to the intermediate distribution ratio.

[0256] ​The writing module is configured to write the second service configuration information into resources of a container orchestration engine logical cluster, and trigger the container orchestration engine logical cluster to update according to a rolling update strategy of the second service configuration information.

[0257] In the embodiment of the application, when performing an upgrade operation on a target service, it is detected whether the target service is associated with an adjustment task; if the target service is associated with the adjustment task, a task state of an adjustment task corresponding to the target service is set to a waiting state, and a notification message is sent to a container group distribution adjustment device, so that the container group distribution adjustment device reads a number of container groups that have been adjusted from a first cluster to a second cluster in a process of performing the adjustment task, and a number of container groups that are not adjusted in the first cluster, and obtains a ratio of the number of container groups that are not adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task state to a completed state; and when the service management platform detects information of the task completed state, the task completed state can be determined, so that a service upgrade process can be started in time.

[0258] When it is detected that the task state is set to the completed state, an upgrade operation of the target service is performed according to the intermediate distribution ratio, so that the service upgrade is ensured to be based on the current actual intermediate distribution ratio, and an out-of-date initial distribution ratio is avoided to cause an upgrade strategy error, thereby ensuring the accuracy and effectiveness of the upgrade operation.

[0259] The embodiment of the application further provides an electronic device, as shown in the accompanying drawings, Figure 7 The processor 701, the communication interface 702 and the memory 703 can communicate with each other through the communication bus 704,

[0260] The memory 703 is configured to store a computer program.

[0261] The processor 701 is configured to execute the program stored in the memory 703, and implement the following steps:

[0262] receive a notification message sent by the service management platform; the notification message is used to indicate that a target service in a running state is executed for an upgrade operation, and a task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task of migrating container groups from a first cluster to a second cluster, and the notification message contains identification information of the target service;

[0263] In response to the notification message, the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster during the execution of the adjustment task, and the number of container groups that are not adjusted in the first cluster, and obtains the ratio of the number of container groups that are not adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio;

[0264] setting the task state to a completed state;

[0265] sending the intermediate distribution ratio to the service management platform, so that the service management platform performs an upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set to the completed state, the intermediate distribution ratio being used to replace an initial distribution ratio of the target service before adjustment.

[0266] Alternatively,

[0267] detecting whether the target service is associated with an adjustment task when performing an upgrade operation on the target service;

[0268] In a case where the target service is associated with an adjustment task, setting the task state of the adjustment task corresponding to the target service to a waiting state, and sending a notification message to the container group distribution adjustment device, so that the container group distribution adjustment device reads the number of container groups that have been adjusted from the first cluster to the second cluster during the execution of the adjustment task, and the number of container groups that are not adjusted in the first cluster in response to the notification message, and obtains the ratio of the number of container groups that are not adjusted in the first cluster to the number of container groups of the second cluster as an intermediate distribution ratio, and sets the task state to a completed state;

[0269] receiving the intermediate distribution ratio sent by the container group distribution adjustment device;

[0270] performing an upgrade operation of the target service according to the intermediate distribution ratio in a case where it is detected that the task state is set to the completed state, the intermediate distribution ratio being used to replace an initial distribution ratio of the target service before adjustment.

[0271] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0272] The communication interface is configured to communicate between the terminal and other devices.

[0273] The memory can include a random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0274] The processor described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0275] In yet another embodiment provided by the present application, a computer readable storage medium is also provided, which stores instructions, when running on a computer, causes the computer to perform the container group distribution adjustment method in any of the above embodiments.

[0276] In yet another embodiment provided by the present application, a computer program product containing instructions is also provided, when running on a computer, causes the computer to perform the container group distribution adjustment method in any of the above embodiments.

[0277] In the embodiments described above, all or some of the steps can be implemented by software, hardware or firmware, or any combination thereof. When implemented in software, all or some of the steps can be implemented in the form of one or more computer programs which are stored in a computer readable medium. The computer readable medium can include one or more of a computer readable storage medium and a computer readable signal medium. The computer readable storage medium can include one or more of a magnetic storage medium (e.g., one or more magnetic tapes), an electronic storage medium (e.g., one or more semiconductor memories or tapes), a mechanical storage medium (e.g., one or more recording chips), or the like. The computer readable signal medium can include a computer readable storage medium which is configured to transmit program code embedded in a modulated data signal. The modulated data signal is one example means for transmitting the program code (e.g., either modulated on a carrier or unmodulated). The program code embodied on the computer readable medium is for executing one or more of the steps in the embodiments described above on one or more of the computers in the system. The computer readable medium can be a computer program product.

[0278] It should be noted that, in the description above, the relative terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Also, the terms "comprises", "comprising", or any other variations thereof are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the phrase "comprising a..." does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0279] Each of the embodiments in the specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiments.

[0280] The above merely provides the preferred embodiments of the application, and not intended to limit the protection scope of the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall fall within the protection scope of the application.

Claims

1. A method for adjusting container group distribution, characterized in that: Applied to a container group distribution adjustment device, the method includes: Receive a notification message sent by the service management platform; the notification message is used to indicate that an upgrade operation has been performed on a target service that is already in a running state, and the task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is used to describe a distribution adjustment task for migrating a container group from a first cluster to a second cluster, and the notification message includes identification information of the target service; In response to the notification message, reading the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device during the process of performing the adjustment task, and the number of container groups that have not been adjusted in the first cluster, and obtaining a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster as an intermediate distribution ratio; Setting the task status to completed; The intermediate distribution ratio is sent to the service management platform so that the service management platform can perform an upgrade operation of the target service according to the intermediate distribution ratio when detecting that the task status is set to the completed status. The intermediate distribution ratio is used to replace the initial distribution ratio of the target service before adjustment.

2. The method according to claim 1, characterized in that Before receiving the notification message sent by the service management platform, the method further includes: Acquire a service list, the service list including at least one service and adjustment sequence information corresponding to each of the services; An adjustment task corresponding to each of the services is created on the service management platform to adjust the container group of at least one of the services in sequence according to the adjustment sequence information corresponding to each of the services; the adjustment task includes at least one of the following task information: task identification information, service name and task status.

3. The method according to claim 2, characterized in that The obtaining of the service list includes: sending a service list request message to the time adjustment recommendation device, so that the time adjustment recommendation device collects upgrade data of the services through the service management platform, and based on the upgrade data, calculates the upgrade probability of each service within a future preset time period, and filters out services whose upgrade probability is less than the preset upgrade probability; based on the upgrade data, calculates the average upgrade duration of each service, and filters out services whose upgrade duration is less than the preset upgrade duration; and combines the filtered services into the service list; the upgrade data includes: upgrade time and upgrade duration; Receive the service list sent by the adjustment time recommendation device.

4. A method for adjusting the distribution of container groups, characterized in that: Applied to a service management platform, the method includes: When performing an upgrade operation on a target service, detecting whether the target service is associated with an adjustment task; In a case where the target service is associated with the adjustment task, setting the task status of the adjustment task corresponding to the target service to a waiting state, and sending a notification message to the container group distribution adjustment device, so that the container group distribution adjustment device, in response to the notification message, reads the number of container groups that have been adjusted from the first cluster to the second cluster and the number of unadjusted container groups in the first cluster during the execution of the adjustment task by the container group distribution adjustment device, obtains a ratio of the number of unadjusted container groups in the first cluster to the number of container groups in the second cluster as an intermediate distribution ratio, and sets the task status to a completed state; receiving the intermediate distribution ratio sent by the container group distribution adjustment device; In a case where it is detected that the task status is set to a completed status, an upgrade operation of the target service is performed according to the intermediate distribution ratio, where the intermediate distribution ratio is used to replace the initial distribution ratio of the target service before adjustment.

5. The method according to claim 1, characterized in that When performing the upgrade operation on the target service, after detecting whether the target service is associated with the adjustment task, the method further includes: If the target service is not associated with the adjustment task, generating first service configuration information of the upgraded target service; the first service configuration information includes: a container group template, resource requirements, and environment variables; The first service configuration information is sent to the container orchestration engine logical cluster.

6. The method according to claim 1, characterized in that After performing the upgrade operation of the target service according to the intermediate distribution ratio when detecting that the task status is set to the completed state, the method further includes: generating upgraded second service configuration information of the target service according to the intermediate distribution ratio; The second service configuration information is written into the resources of the container orchestration engine logical cluster, triggering the container orchestration engine logical cluster to update according to the rolling update strategy of the second service configuration information.

7. A device for adjusting the distribution of container groups, characterized in that: The device comprises: A first receiving module is configured to receive a notification message sent by a service management platform; the notification message is configured to indicate that an upgrade operation has been performed on a target service that is already in a running state, and that the task state of an adjustment task associated with the target service is set to a waiting state; the adjustment task is configured to describe a distribution adjustment task for migrating a container group from a first cluster to a second cluster, and the notification message includes identification information of the target service; a determination module, configured to, in response to the notification message, read the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device during the process of performing the adjustment task, and the number of container groups that have not been adjusted in the first cluster, and obtain a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster as an intermediate distribution ratio; A setting module, used to set the task status to a completed state; The first sending module is used to send the intermediate distribution ratio to the service management platform, so that the service management platform can perform the upgrade operation of the target service according to the intermediate distribution ratio when detecting that the task status is set to the completed status. The intermediate distribution ratio is used to replace the initial distribution ratio of the target service before adjustment.

8. A device for adjusting the distribution of container groups, characterized in that: The device comprises: a detection module, configured to detect whether the target service is associated with the adjustment task when performing an upgrade operation on the target service; a setting module configured to, when the target service is associated with the adjustment task, set the task status of the adjustment task corresponding to the target service to a waiting state, and send a notification message to the container group distribution adjustment device, so that the container group distribution adjustment device, in response to the notification message, reads the number of container groups that have been adjusted from the first cluster to the second cluster by the container group distribution adjustment device during the execution of the adjustment task, and the number of container groups that have not been adjusted in the first cluster, obtains a ratio of the number of container groups that have not been adjusted in the first cluster to the number of container groups in the second cluster as an intermediate distribution ratio, and sets the task status to a completed state; a second receiving module, configured to receive the intermediate distribution ratio sent by the container group distribution adjustment device; An execution module is used to perform an upgrade operation of the target service according to the intermediate distribution ratio when detecting that the task status is set to a completed status, and the intermediate distribution ratio is used to replace the initial distribution ratio of the target service before adjustment.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.