A method, apparatus, electronic device, and storage medium for establishing a network connection

By filtering and identifying candidate and exclusion application instances for network connection objects, and establishing network connections based on the running status of candidate application instances, the problems of high network connection resource consumption and low scalability are solved, and stable and efficient network connections are achieved.

CN117749854BActive Publication Date: 2026-06-05TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-09-13
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In complex network environments, existing technologies consume excessive resources and have low scalability when establishing network connections, failing to guarantee the reentrancy of network connections and the stability of network services.

Method used

By using optional tags and exclusion indication information carried by network connection objects, optional and exclusionary application instances are filtered from the original application instances. The target application instance is determined based on the running status of the candidate application instances, and a network connection is established to reduce dependence on external service interfaces.

Benefits of technology

It reduces network connection resource consumption, improves network connection scalability and stability, and enables the implementation of simple network connection logic in complex network environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117749854B_ABST
    Figure CN117749854B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of networks, in particular to a method and device for establishing a network connection, electronic equipment and a storage medium. Based on various optional tags carried by a created network connection object, various optional application instances corresponding to the optional tags are screened out, based on to-be-excluded indication information carried by the network connection object, various to-be-excluded application instances are screened out, based on the screened to-be-excluded application instances, corresponding optional application instances are deleted from the various optional application instances, various candidate application instances associated with a first service network and a second service network are obtained, based on respective running states corresponding to the various candidate application instances, various target application instances meeting preset running conditions are screened out from the various candidate application instances; and based on the various target application instances, a network connection between the first service network and the second service network is established, so that network service access can be ensured, resource consumption can be reduced, and scalability can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network technology, and in particular to a method, apparatus, electronic device and storage medium for establishing a network connection. Background Technology

[0002] Currently, with the development of network technology, the network environment in which the service network is located is becoming increasingly diverse.

[0003] In related technologies, when the network environments of different service networks are different, network connections can usually be established by calling external service interfaces. For example, when the network environment of service network 1 is different from that of service network 2, a network connection between service network 1 and service network 2 can be established by calling external service interfaces.

[0004] However, in related technologies, when the network environment is very complex, the implementation logic of the external service interface for establishing network connections also becomes very complex. Furthermore, the implementation logic of the external service interface called when establishing network connections between different service networks is also different. Therefore, the resource consumption is too high and the scalability is not high when establishing network connections using this method in related technologies. Summary of the Invention

[0005] This application provides a method, apparatus, electronic device, and storage medium for establishing network connections, thereby reducing resource consumption and improving scalability.

[0006] The specific technical solutions provided in this application are as follows:

[0007] On one hand, this application provides a method for establishing a network connection, applied to a controller, including:

[0008] Based on the optional tags carried by the created network connection object, select the optional application instances corresponding to each optional tag from the preset original application instances; and based on the exclusion indication information carried by the network connection object, select the application instances to be excluded from the original application instances.

[0009] Based on the selected application instances to be excluded, the corresponding optional application instances are deleted from each optional application instance to obtain each candidate application instance associated with the first service network and the second service network.

[0010] Based on the running status of each candidate application instance, target application instances that meet the preset running conditions are selected from the candidate application instances.

[0011] Based on the aforementioned target application instances, a network connection is established between the first service network and the second service network.

[0012] Optionally, the step of filtering out application instances to be excluded from the original application instances based on the exclusion indication information carried by the network connection object includes:

[0013] Based on the exclusion tags contained in the exclusion indication information, select the application instances to be excluded that correspond to the exclusion tags from the original application instances; and,

[0014] Based on the first application instance identifiers contained in the exclusion indication information, the application instances to be excluded corresponding to the corresponding first application instance identifiers are determined from the original application instances.

[0015] Optionally, the step of filtering out application instances corresponding to each exclusion tag from the original application instances based on each exclusion tag contained in the exclusion indication information includes:

[0016] For each of the application instances to be excluded, perform the following operations respectively:

[0017] If it is determined that the application instance to be excluded is included in each candidate application instance based on the second application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

[0018] Optionally, the step of filtering out application instances corresponding to each exclusion tag from the original application instances based on each exclusion tag contained in the exclusion indication information includes:

[0019] Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance;

[0020] Based on the union of the set of application instances to be excluded and the set of optional application instances, a set of candidate application instances containing each candidate application instance is obtained.

[0021] Optionally, the running state includes at least the probe configuration state, and the step of selecting target application instances that meet preset running conditions from the candidate application instances based on their respective running states includes:

[0022] For each of the candidate application instances, perform the following operations respectively:

[0023] When it is determined that the probe configuration status of a candidate application instance is configured and the corresponding configured probe is successfully detected, the candidate application instance is used as the target application instance. Each probe is used to determine whether the corresponding candidate application instance is in a state of providing network services normally.

[0024] When it is determined that the probe configuration status is not configured and the application instance in the running status is continuously running, the candidate application instance is selected as the target application instance.

[0025] Optionally, the method further includes:

[0026] Add each candidate application instance with a probe configuration status of "not configured" to the set of application instances without probes;

[0027] Each target application instance is added to the set of application instances that can provide services.

[0028] Each candidate application instance, excluding the target application instances, is added to the set of application instances that cannot provide services.

[0029] The set of probe-free application instances, the set of application instances that can provide services, and the set of application instances that cannot provide services are stored in the network status.

[0030] Optionally, establishing a network connection between the first service network and the second service network based on each target application instance includes:

[0031] By calling the connection creation interface, a network connection interface is established between the first service network and the second service network;

[0032] By invoking the target application instances and the network connection interface, the network services of the second service network are provided to the first service network.

[0033] Optionally, the method further includes:

[0034] When the update time corresponding to the network connection is obtained, the network connection is tuned. The update time is generated after the API server updates the network connection object after receiving the deletion request for the network connection and setting the deletion timestamp of the network connection object to the current time.

[0035] During the tuning process, when it is determined that the deletion timestamp of the network connection is not empty, the network status corresponding to the network connection is determined to be expected to be deleted, wherein the deletion timestamp is set when the deletion request is received;

[0036] Delete the network connection.

[0037] Optionally, deleting the network connection includes:

[0038] By calling the delete network interface, the network service interfaces corresponding to the network connection are deleted.

[0039] Remove the deletion interception flag corresponding to the network connection and generate a deletion command;

[0040] The deletion instruction is sent to the API server so that the API server deletes the network connection object created for the corresponding network connection.

[0041] On one hand, an embodiment of this application provides an apparatus for establishing a network connection, comprising:

[0042] The first filtering module is used to filter out the optional application instances corresponding to each optional tag from the preset original application instances based on each optional tag carried by the created network connection object, and to filter out each application instance to be excluded from the original application instances based on the exclusion indication information carried by the network connection object.

[0043] The determination module is used to delete corresponding optional application instances from each optional application instance based on each filtered application instance to be excluded, and to obtain each candidate application instance associated with the first service network and the second service network.

[0044] The second filtering module is used to filter out target application instances that meet preset operating conditions from the candidate application instances based on the running status of each candidate application instance.

[0045] A module is established to establish a network connection between the first service network and the second service network based on the target application instances.

[0046] Optionally, when selecting application instances to be excluded from the original application instances based on the exclusion indication information carried by the network connection object, the first filtering module is further configured to:

[0047] Based on the exclusion tags contained in the exclusion indication information, select the application instances to be excluded that correspond to the exclusion tags from the original application instances; and,

[0048] Based on the first application instance identifiers contained in the exclusion indication information, the application instances to be excluded corresponding to the corresponding first application instance identifiers are determined from the original application instances.

[0049] Optionally, the determining module is further configured to:

[0050] For each of the application instances to be excluded, perform the following operations respectively:

[0051] If it is determined that the application instance to be excluded is included in each candidate application instance based on the second application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

[0052] Optionally, when filtering out application instances corresponding to each exclusion tag from the original application instances based on each exclusion tag contained in the exclusion indication information, the first filtering module is further configured to:

[0053] Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance;

[0054] Based on the union of the set of application instances to be excluded and the set of optional application instances, a set of candidate application instances containing each candidate application instance is obtained.

[0055] Optionally, the operating state includes at least the probe configuration state, and the second screening module is further used for:

[0056] For each of the candidate application instances, perform the following operations respectively:

[0057] When it is determined that the probe configuration status of a candidate application instance is configured and the corresponding configured probe is successfully detected, the candidate application instance is used as the target application instance. Each probe is used to determine whether the corresponding candidate application instance is in a state of providing network services normally.

[0058] When it is determined that the probe configuration status is not configured and the application instance in the running status is continuously running, the candidate application instance is selected as the target application instance.

[0059] Optionally, the device further includes an adding module, the adding module being used for:

[0060] Add each candidate application instance with a probe configuration status of "not configured" to the set of application instances without probes;

[0061] Each target application instance is added to the set of application instances that can provide services.

[0062] Each candidate application instance, excluding the target application instances, is added to the set of application instances that cannot provide services.

[0063] The set of probe-free application instances, the set of application instances that can provide services, and the set of application instances that cannot provide services are stored in the network status.

[0064] Optionally, the connection module is further used for:

[0065] By calling the connection creation interface, a network connection interface is established between the first service network and the second service network;

[0066] By invoking the target application instances and the network connection interface, the network services of the second service network are provided to the first service network.

[0067] Optionally, the device further includes a deletion module, the deletion module being used for:

[0068] When the update time corresponding to the network connection is obtained, the network connection is tuned. The update time is generated after the API server updates the network connection object after receiving the deletion request for the network connection and setting the deletion timestamp of the network connection object to the current time.

[0069] During the tuning process, when it is determined that the deletion timestamp of the network connection is not empty, the network status corresponding to the network connection is determined to be expected to be deleted, wherein the deletion timestamp is set when the deletion request is received;

[0070] Delete the network connection.

[0071] Optionally, when deleting the network connection, the deletion module is further configured to:

[0072] By calling the delete network interface, the network service interfaces corresponding to the network connection are deleted.

[0073] Remove the deletion interception flag corresponding to the network connection and generate a deletion command;

[0074] The deletion instruction is sent to the API server so that the API server deletes the network connection object created for the corresponding network connection.

[0075] On one hand, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of any of the methods described above for establishing a network connection.

[0076] On one hand, embodiments of this application provide a computer storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the steps of any of the methods described above for establishing a network connection.

[0077] On one hand, an embodiment of this application provides a computer program product, which includes computer instructions stored in a computer-readable storage medium; when a processor of an electronic device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, causing the electronic device to perform the steps of any of the above-described methods for establishing a network connection.

[0078] Since the embodiments of this application adopt the above-described technical solution, they have at least the following technical effects:

[0079] In this embodiment, based on the optional tags carried by the created network connection object, optional application instances corresponding to each optional tag are selected from the preset original application instances. Based on the exclusion indication information carried by the network connection object, application instances to be excluded are selected from the original application instances. Based on the selected application instances to be excluded, corresponding optional application instances are deleted from the optional application instances to obtain candidate application instances associated with the first service network and the second service network. Based on the running status of each candidate application instance, target application instances that meet the preset running conditions are selected from the candidate application instances. Based on each target application instance, a network connection is established between the first service network and the second service network. In this way, each optional application instance can be filtered out using the selectable tags, and each application instance to be excluded can be filtered out using the exclusion indication information. Each application instance to be excluded is then removed from the selectable application instances, thereby obtaining each candidate application instance. Based on the running status of each candidate application instance, each target application instance is determined, and a network connection is established based on each target application instance. This allows for the establishment of a network connection between the first service network and the second service network without the need for external service interfaces. Even in very complex network environments, a simple implementation logic can be used to achieve the network connection, which not only reduces the resource consumption of the network connection but also improves scalability. Attached Figure Description

[0080] Figure 1 This is a schematic diagram of the application scenario in the embodiments of this application;

[0081] Figure 2A This is a schematic diagram illustrating the process of establishing a network connection in an embodiment of this application;

[0082] Figure 2B This is an example diagram illustrating the determination of candidate application instances in the embodiments of this application;

[0083] Figure 2C This is an example diagram illustrating the determination of application instances to be excluded in the embodiments of this application;

[0084] Figure 2DThis is an example diagram illustrating the deletion of candidate applications in this application embodiment;

[0085] Figure 2E This is an example diagram illustrating the determination of a target application instance in the embodiments of this application;

[0086] Figure 2F This is an example diagram illustrating the network services provided in the embodiments of this application;

[0087] Figure 3 This is a flowchart illustrating the process of determining the target application instance in an embodiment of this application;

[0088] Figure 4 This is a schematic diagram of the process for deleting a network connection in an embodiment of this application;

[0089] Figure 5 This is a schematic diagram of the system in an embodiment of this application;

[0090] Figure 6 This is an interactive flowchart illustrating the process of establishing a network connection in an embodiment of this application.

[0091] Figure 7 This is a flowchart illustrating the interaction process of deleting a network connection in an embodiment of this application.

[0092] Figure 8 This is a schematic diagram of the structure of the device for establishing a network connection in the embodiments of this application;

[0093] Figure 9 This is a schematic diagram of the hardware structure of an electronic device using an embodiment of this application. Detailed Implementation

[0094] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0095] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this application. Obviously, the described embodiments are only some embodiments of the technical solutions of this application, and not all embodiments. Based on the embodiments recorded in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the technical solutions of this application.

[0096] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.

[0097] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.

[0098] Application instance: An application instance can be a pod. A pod is the smallest deployable computing unit created and managed in Kubernetes. It is a collection of applications used to provide network services to the first service network and the second service network.

[0099] Service network: Represents an isolated network that can provide services, such as a first service network being isolated from a second service network.

[0100] Probe configuration status: Indicates whether the candidate application instance has a probe configured. The probe configuration status can be divided into configured and unconfigured. The probe configuration status is configured, indicating that the candidate application instance has a probe configured. The probe configuration status is unconfigured, indicating that the candidate application instance has no probe configured.

[0101] Probe: The probe is used to obtain the detection result of whether the candidate application instance is in a state that can provide network services normally.

[0102] Probe detection results: Characterize the detection results corresponding to the candidate application instances identified by the probe, used to determine whether the candidate application instances are in a normal network service providing state. Among them, the probe detection results include success, failure, and unknown. A probe detection result of success indicates that the candidate application instance is in a normal network service providing state and can provide normal network service. A probe detection result of failure indicates that the candidate application instance is not in a normal network service providing state and cannot provide normal network service. A probe detection result of unknown indicates that the candidate application instance itself has encountered an error during operation and the availability of network service cannot be determined.

[0103] Tuning: Tuning is performed to achieve a certain type of resource, with the goal of maintaining the state expected by the user.

[0104] Custom Resource (CR): Used to extend and implement custom logic. In this embodiment, it is used to implement extensible network connection definitions and states.

[0105] Finalizer: A property of network connection objects in Kubernetes that prevents the network connection object from being actually deleted, keeping it in a terminating state until the Finalizer is removed, at which point the network connection object will be truly deleted.

[0106] Service: An abstract method within Kubernetes that exposes an application that logically runs on a set of application instances as a network service.

[0107] The design concept of the embodiments of this application is briefly introduced below:

[0108] Currently, with the development of network technology, the network environment in which the service network is located is becoming increasingly diverse.

[0109] In related technologies, when the network environments of each service network are different, the network connection between the network services can be achieved by calling external service interfaces. For example, when the network environment of service network 1 is different from that of service network 2, the network connection between service network 1 and service network 2 can be established by calling external service interfaces.

[0110] Furthermore, the network connection methods in the related technologies only support four types of network connections: ClusterIP, NodePort, LoadBalancer, and ExternalName.

[0111] 1. ClusterIP: Exposes the service via the cluster's internal IP address. When this value is selected, the service can only be accessed within the cluster. This is also the default ServiceType.

[0112] 2. NodePort: Exposes services via the IP address and static port (NodePort) on each node. NodePort services are routed to automatically created ClusterIP services. You can access a NodePort service from outside the cluster by requesting <node IP>:<node port>.

[0113] 3. LoadBalancer: Uses the cloud provider's load balancer to expose services externally. The external load balancer can route traffic to automatically created NodePort and ClusterIP services.

[0114] 4. ExternalName: By returning the CNAME and its corresponding value, you can map a service to the content of the externalName field (e.g., a URL). No proxy needs to be created.

[0115] However, due to differences in business scenarios and network environments, the calling logic of external service interfaces can vary significantly. On the one hand, the process of creating a network request is complex and usually involves multiple steps. Furthermore, the implementation logic of external service interfaces called when establishing network connections between different service networks is also different. Therefore, the reentrancy of network connections cannot be guaranteed, the resource consumption during network connection establishment is too high, and the scalability is not high. On the other hand, after a network connection is established, it is impossible to determine the availability of the actual service provider (RS) providing the service. That is, even if the backend RS fails for some reason, traffic will still be allocated to the RS, resulting in instability and reduced reliability of the network services provided by the network connection.

[0116] To address the aforementioned issues, this application provides a method, apparatus, electronic device, and storage medium for establishing a network connection. By using selectable tags, selectable application instances can be identified; by using exclusion indication information, excluder application instances can be identified and removed from the selectable application instances, thereby obtaining candidate application instances. Based on the running status of each candidate application instance, target application instances are determined, and a network connection is established based on each target application instance. This enhances scalability and reduces network resource consumption.

[0117] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0118] See Figure 1 The diagram shown is an application scenario illustration of an embodiment of this application. This application scenario illustration includes a controller 110 and various service networks 120. The controller 110 and each service network 120 can communicate via a communication network.

[0119] The controller 110 may include one or more processors, memory, and I / O interfaces for interacting with the service network 120. The controller 110 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The controller 110 and each service network 120 may be directly or indirectly connected via wired or wireless communication; this embodiment of the application does not impose limitations on this.

[0120] Each service network 120 is used to provide network services.

[0121] The method for establishing a network connection in this embodiment can be performed on the controller 110. When the controller 110 establishes a network connection, it filters out each optional application instance through each optional tag, filters out each application instance to be excluded through exclusion indication information, and deletes each application instance to be excluded from each optional application instance, thereby obtaining each candidate application instance. Based on the running status of each candidate application instance, it determines each target application instance, and thus establishes a network connection between the first service network and the second service network based on each target application instance.

[0122] The method in this application embodiment can be applied to cloud-native scenarios. With the development of cloud-native technology, more and more services are moving to the cloud to enjoy the advantages of cloud-native. One of the problems that needs to be solved is how to access corresponding cloud-native services across network environments. Related technologies typically encapsulate their respective network connection services, internally calling external network services. All implementations are outside of cloud-native Kubernetes, making it impossible to monitor the real-time running status of backend application instances and dynamically maintain them to ensure high reliability of network services. Therefore, in this embodiment, based on the optional tags carried by the created network connection object, optional application instances corresponding to each optional tag are selected from a preset set of original application instances. Furthermore, based on the exclusion indication information carried by the network connection object, application instances to be excluded are selected from the original application instances. Based on the selected application instances to be excluded, corresponding optional application instances are deleted from the optional application instances, resulting in candidate application instances associated with the first and second service networks. Based on the running status of each candidate application instance, target application instances that meet preset running conditions are selected from the candidate application instances. Based on each target application instance, a network connection is established between the first and second service networks. This allows for monitoring the running status of backend application instances and dynamically maintaining them, ensuring high reliability of network services and reducing resource consumption.

[0123] The technologies involved in establishing network connections, as described in the embodiments of this application, are illustrated in the following examples:

[0124] Based on the above embodiments, see Figure 2A The diagram shown is a flowchart illustrating the process of establishing a network connection in an embodiment of this application. The process of establishing a network connection in this embodiment is described below, specifically including:

[0125] S20: Based on the optional tags carried by the created network connection object, select the optional application instances corresponding to each optional tag from the preset original application instances, and based on the exclusion indication information carried by the network connection object, select the application instances to be excluded from each original application instance.

[0126] In this embodiment, a network connection request is submitted to an API server via a client. The API server verifies the validity of the created network connection request. If the validity of the network connection request passes the verification, the API server creates a network connection object based on the network connection request. When the controller determines the created network connection object, since the network connection object carries various optional tags, it filters out the original application instances corresponding to the optional tags from the preset original application instances based on the optional tags. The filtered original application instances are the optional application instances. Also, since the network connection object carries various exclusion indication information, it can filter out the original application instances corresponding to the exclusion indication information from the preset original application instances based on the exclusion indication information. The filtered original application instances are the application instances to be excluded.

[0127] The following describes the process of selecting each optional application instance in the embodiments of this application. Specifically, a network connection request is received, which carries filtering instruction information. The filtering instruction information contains each candidate tag. Therefore, each candidate tag is matched with the application instance tags corresponding to each preset original application instance. From each original application instance, the original application instance that matches each candidate tag is determined, and the determined original application instance is used as the corresponding candidate application instance.

[0128] For example, see Figure 2BThe diagram shown is an example of determining optional application instances in an embodiment of this application. Assuming the application instance is a pod, the optional tags are "app:a" and "type:foo". The preset original pods are original pod1, original pod2, original pod3, original pod4 and original pod5. The optional tags corresponding to original pod1 are "app:a" and "type:foo", the application instance tags corresponding to original pod2 are "app:a" and "type:foo", the optional tags corresponding to original pod3 are "app:d" and "type:foo", the optional tags corresponding to original pod4 are "app:b" and "type:bar", and the optional tags corresponding to original pod5 are "app:a" and "type:bar". Therefore, the original pods that match both the optional tags "app:a" and "type:foo" are determined to be original pod1 and original pod2. Therefore, original pod1 and original pod2 are respectively selected as candidate pods.

[0129] The optional tags can be, for example, preset attribute tags or key-value pairs, and this application embodiment does not impose any restrictions on them.

[0130] Attribute tags can be version tags, environment tags, architecture tags, partition tags, etc., and this application embodiment does not impose any restrictions on them.

[0131] It should be noted that in the embodiments of this application, the original application instance corresponding to the optional tag can be one or more. That is, multiple original application instances may correspond to the same optional tag, and each optional application instance may correspond to multiple optional tags. This embodiment of the application does not impose any restrictions on this.

[0132] The process of selecting each application instance to be excluded in the embodiments of this application is described below. Specifically, since the network connection request carries exclusion indication information, each application instance to be excluded can be determined from each original application instance based on the exclusion indication information.

[0133] Optionally, in this application embodiment, a possible implementation method is provided for determining each application instance to be excluded, specifically including:

[0134] N1: Based on the exclusion labels contained in the exclusion indication information, filter out the application instances to be excluded that correspond to each exclusion label from each original application instance.

[0135] In this embodiment, each tag to be excluded is matched with the application instance tags corresponding to each preset original application instance. From each original application instance, the original application instance that matches each tag to be excluded is determined, and the determined original application instance is used as the corresponding application instance to be excluded. In this way, the application instance to be excluded can be determined, thereby ensuring the high availability of subsequent network services.

[0136] N2: Based on the first application instance identifiers contained in the exclusion indication information, determine the application instances to be excluded from each original application instance that correspond to the corresponding first application instance identifier.

[0137] In this embodiment of the application, the network connection object also carries a list to be excluded, which contains the identifiers of each first application instance. Based on the identifiers of each first application instance, the application instances to be excluded corresponding to each first application instance identifier are determined.

[0138] For example, see Figure 2C The diagram shown is an example of determining application instances to be excluded in an embodiment of this application. Assume the application instance is a pod, the exclusion tag is "env:1", and the first application instance identifiers included in the exclusion indication information are the first application instance identifiers corresponding to pod3 and pod4 to be excluded, respectively. The preset original pods are original pod1, original pod2, original pod3, original pod4, and original pod5. The application instance tag corresponding to original pod1 is "env:1", the application instance tag corresponding to original pod2 is "env:1", the application instance tag corresponding to original pod3 is "env:3", the application instance tag corresponding to original pod4 is "env:2", and the application instance tag corresponding to original pod5 is "env:16". Therefore, the original pods matching the exclusion tag "env:1" are determined to be original pod1 and original pod2, and original pod1 and original pod2 are respectively designated as pods to be excluded. Furthermore, the pods to be excluded determined based on the first application instance identifiers included in the exclusion indication information are pod3 and pod4 to be excluded, therefore, original pod3 and original pod4 are directly designated as pods to be excluded.

[0139] It should be noted that the network connection request in this embodiment is created directly through an API interface or the kubectl command line. Furthermore, when validating the validity of the network connection request, the format validity of each candidate tag and each tag to be excluded contained in the network connection request can be verified.

[0140] The kubectl command line is used to communicate with the API server, organize and convert the commands entered by the user into information that the API server can recognize, and thus manage various Kubernetes resources based on the kubectl command line.

[0141] Furthermore, in this embodiment of the application, before creating a network connection, it is necessary to define the network connection object corresponding to the network connection. Specifically, the desired network connection is defined in a declarative manner in the content of the Spec, and some information required for the scalable network connection is defined through ServiceLinkSource. A selector is defined, which uses key-value pairs to define a series of candidate tags to select the optional application instances to be connected to. An excluder is defined, which is used to remove the corresponding application instances to be excluded from the set of optional application instances selected by the Selector. These excluded application instances can be selected in the form of exclusion tags or in the form of a list of application instance identifiers to be excluded.

[0142] Furthermore, when defining a network connection object, the current running state of the network connection object is defined in the network state. The running state includes a set of application instances to be excluded, a set of application instances that can provide services, a set of application instances that cannot provide services, and a set of application instances without probes. The set of application instances to be excluded contains the application instances to be excluded. The set of application instances that can provide services contains each target application instance. The set of application instances that can provide services contains candidate application instances other than each target application instance. The set of application instances without probes contains each application instance that has not been configured with probes.

[0143] Optionally, in this embodiment of the application, a possible implementation method is provided for screening candidate application instances. The process of determining each candidate application instance in this embodiment of the application is described below, specifically including:

[0144] Each candidate application instance includes a collection of containers that provide network services to the first service network and the second service network.

[0145] S21: Based on the selected application instances to be excluded, delete the corresponding optional application instances from each optional application instance to obtain each candidate application instance associated with the first service network and the second service network.

[0146] In this embodiment of the application, based on the application instance identifier corresponding to each of the selected application instances to be excluded, the corresponding candidate application instances are deleted from each candidate application instance to obtain each candidate application instance associated with the first service network and the second service network.

[0147] In this embodiment of the application, for each of the selected application instances to be excluded, the following operations are performed respectively: based on the application instance identifier corresponding to an application instance to be excluded, it is matched with the application instance identifier corresponding to each candidate application instance, so as to obtain each candidate application instance associated with the first service network and the second service network. After obtaining each candidate application instance, each candidate application instance can be obtained from the API server through the k8s Informer mechanism.

[0148] Optionally, in this embodiment of the application, a possible implementation method is provided for obtaining each candidate application instance associated with the first service network and the second service network. The process of obtaining each candidate application instance in this embodiment of the application is described below, specifically including:

[0149] If it is determined that an application instance to be excluded is included in each candidate application instance based on the application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

[0150] In this embodiment, the application instance identifier corresponding to an application instance to be excluded is matched with the application instance identifier corresponding to each candidate application instance. It is determined whether a candidate application instance with the same application instance identifier as the application instance to be excluded can be matched. If a candidate application instance with the same application instance identifier as the application instance to be excluded is determined from the candidate application instances, the determined candidate application instance is deleted from the candidate application instances. If no candidate application instance with the same application instance identifier as the application instance to be excluded is determined from the candidate application instances, the deletion process is not performed on the candidate application instances.

[0151] For example, see Figure 2D The diagram shown is an example of deleting candidate application instances in an embodiment of this application. Assuming that the application instance is a pod, the pod identifiers corresponding to each pod to be excluded are pod1 and pod2, and the pod identifiers corresponding to each candidate pod are pod2, pod4, pod8, and pod11. Therefore, the candidate pod with the same pod identifier as each pod to be excluded is determined to be candidate pod2. Thus, candidate pod2 is deleted from each candidate pod, thereby obtaining each candidate pod associated with the first service network and the second service network as pod4, pod8, and pod11.

[0152] Optionally, this application embodiment also provides a possible implementation for obtaining each candidate application instance associated with the first service network and the second service network. The process of obtaining each candidate application instance in this application embodiment is described below, specifically including:

[0153] S211: Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance.

[0154] In this embodiment of the application, each application instance to be excluded is added to the set of application instances to be excluded, thereby obtaining a set of application instances to be excluded containing each application instance to be excluded, and each optional application instance is added to the set of optional application instances, thereby obtaining a set of optional application instances containing each optional application instance.

[0155] S212: Based on the union of the set of application instances to be excluded and the set of optional application instances, obtain a set of candidate application instances containing each candidate application instance.

[0156] In this embodiment of the application, the union between the set of application instances to be excluded and the set of optional application instances is determined, so that each application instance to be excluded can be excluded from each optional application instance, and each of the remaining optional application instances can be used as a candidate application instance to obtain a set of candidate application instances containing each candidate application instance.

[0157] S22: Based on the running status of each candidate application instance, select the target application instances that meet the preset running conditions from the candidate application instances.

[0158] In this embodiment of the application, the following operations are performed for each candidate application instance: based on the running status corresponding to a candidate application instance, it is determined whether a candidate application instance meets the preset running conditions; if it is determined that a candidate application instance meets the preset running conditions, then a candidate application instance is used as the target application instance.

[0159] Optionally, in this embodiment of the application, a possible implementation method is provided for determining the target application instance from each candidate application instance. Specifically, probes are obtained from the API server. Each candidate application instance may or may not be configured with probes. If it is determined that a candidate application instance is configured with probes, then it is determined that the candidate application instance corresponds to a probe object. Therefore, it is possible to determine whether a candidate application instance is the target application instance based on the probe configuration status corresponding to the candidate application instance. The following is a detailed explanation:

[0160] First probe configuration status: Configured.

[0161] Specifically, when it is determined that the probe configuration status corresponding to the candidate application instance is configured, the system determines whether to use the candidate application instance as the target application instance based on the probe detection results in the running state.

[0162] The probe detection results can be divided into two categories: success, failure, and unknown. The following describes the three probe detection results in this embodiment:

[0163] The first probe test result was successful.

[0164] Specifically, when the probe configuration status corresponding to a candidate application instance is determined to be configured and the corresponding configured probe detection is successful, the candidate application instance is used as the target application instance.

[0165] Each probe is used to determine whether the corresponding candidate application instance is in a normal state of providing network services.

[0166] In this embodiment of the application, when a candidate application instance is used as a target application instance, the following two conditions must be met: First, the probe configuration status corresponding to the candidate application instance is configured, that is, the candidate application instance is configured with a probe; second, the probe detection result is successful, that is, the candidate application instance is in a state where it can provide network services normally. Therefore, when the probe configuration status corresponding to the candidate application instance is configured and the probe detection result is successful, the candidate application instance is used as the target application instance.

[0167] For example, see Figure 2E The diagram shown is an example of determining the target application instance in an embodiment of this application. Assuming the application instance is a pod, the controller reads candidate pod1 from the candidate pod set. If it is determined that the probe configuration status corresponding to candidate pod1 is configured, the probe detection result in the running state is read. At this time, the probe detection result is successful, and it is determined that candidate pod1 is in a running state that can provide network services normally. Therefore, candidate pod1 is used as the target pod, and the step of determining whether the probe configuration status is configured is re-executed.

[0168] The second probe detection result: failed.

[0169] Specifically, if the probe configuration status corresponding to the candidate application instance is determined to be configured, and the probe detection result in the running state is failed, then no processing is performed on the candidate application instance.

[0170] In this embodiment of the application, when no processing is performed on the candidate application instance, the following two conditions must be met: the first condition is that the probe configuration status corresponding to the candidate application instance is configured, that is, the candidate application instance is configured with a probe; the second condition is that the probe detection result status is failed, that is, the candidate application instance is not in a state that can provide network services normally and cannot provide network services. Therefore, when the probe configuration status corresponding to the candidate application instance is configured and the probe detection result is failed, no processing is performed on the candidate application instance.

[0171] Furthermore, in this embodiment of the application, when the probe detection result is determined to be a failure, the candidate application instance is added to the set of application instances that cannot provide services. Therefore, the set of application instances that cannot provide services contains at least each candidate application instance that cannot provide services.

[0172] The result of the third probe detection was: unknown.

[0173] Specifically, if the probe configuration status corresponding to the candidate application instance is determined to be configured, and the probe detection result in the running state is unknown, then the process will revert to processing without a configured probe.

[0174] In this embodiment of the application, if it is determined that the probe configuration status corresponding to the candidate application instance is configured and the probe detection result in the running state is unknown, then the candidate application instance is treated as a candidate application instance without a probe and processed accordingly. That is, the running state of the application instance determines whether to treat the candidate application instance as the target application instance.

[0175] The second probe configuration status: Not configured.

[0176] Specifically, when it is determined that the probe configuration status corresponding to the candidate application instance is not configured, the decision is made on whether to use the candidate application instance as the target application instance based on the running status of the application instance in the running state.

[0177] The application instance running status can be divided into two types: continuous running and not running normally. The following describes the two application instance running statuses in this application embodiment, specifically including:

[0178] The first type of application instance is running continuously.

[0179] Specifically, if the probe configuration status is determined to be unconfigured and the application instance in the running status is continuously running, then a candidate application instance will be selected as the target application instance.

[0180] In this embodiment of the application, when a candidate application instance is used as a target application instance, the following two conditions must be met: First, the probe configuration status corresponding to the candidate application instance is not configured, that is, the candidate application instance is not configured with a probe; second, the application instance is running continuously, that is, the candidate application instance is running continuously. Therefore, when the probe configuration status corresponding to the candidate application instance is not configured and the application instance is running continuously, the candidate application instance is used as the target application instance.

[0181] For example, assuming the application instance is a pod, the controller reads candidate pod3 from the candidate pod set. If it is determined that the probe configuration status corresponding to candidate pod3 is not configured, the controller reads the pod running status in the running status. At this time, if it is determined that the pod running status is continuously running, it is determined that candidate pod3 is in a running state that can provide network services normally. Therefore, candidate pod3 is used as the target pod, and the next candidate pod is read. The step of determining whether the probe configuration status is configured is re-executed.

[0182] The second application instance is not running normally.

[0183] Specifically, if the probe configuration status is determined to be unconfigured, and the application instance in the running status is not running normally, then no processing will be performed on the candidate application instance.

[0184] In this embodiment of the application, when no processing is performed on the candidate application instance, the following two conditions must be met: First, the probe configuration status corresponding to the candidate application instance is not configured, that is, the candidate application instance is not configured with a probe; second, the application instance running status is not running normally, that is, the candidate application instance is not in a state that can provide network services normally and cannot provide network services. Therefore, when the probe configuration status corresponding to the candidate application instance is not configured and the application instance running status is not running normally, no processing is performed on the candidate application instance.

[0185] The "not running normally" indicates that the candidate application instance is in a pending, initialization, or error state, which is not limited in this embodiment.

[0186] In this way, by using the above method, we can obtain each target application instance, and each target application instance is an application instance that can provide services normally, thus ensuring the reliability of network connection.

[0187] Furthermore, in this embodiment of the application, a set of application instances without probes, a set of application instances that can provide services, and a set of application instances that cannot provide services can be generated, specifically including:

[0188] A1: Add each candidate application instance whose probe configuration status is not configured to the set of application instances without probes.

[0189] In this embodiment of the application, the following operations are performed for each candidate application instance: when the probe configuration status of any candidate application instance is determined to be unconfigured, the candidate application instance is added to the set of application instances without probes.

[0190] A2: Add each target application instance to the set of application instances that can provide services.

[0191] In this embodiment of the application, each target application instance is added to the set of application instances that can provide services, so that the set of application instances that can provide services contains each target application instance.

[0192] A3: Add each candidate application instance, except for the target application instance, to the set of application instances that cannot provide services.

[0193] In this embodiment of the application, since all candidate application instances other than the target application instances are candidate application instances that cannot provide network services normally, all candidate application instances other than the target application instances are added to the set of application instances that cannot provide services.

[0194] A4: Store the set of application instances without probes, the set of application instances that can provide services, and the set of application instances that cannot provide services in the network status.

[0195] In this embodiment, the set of application instances without probes, the set of application instances that can provide services, and the set of application instances that cannot provide services are stored in the network state, thereby enabling dynamic maintenance of each set of application instances and ensuring high availability of network services.

[0196] S23: Based on each target application instance, establish a network connection between the first service network and the second service network.

[0197] In this embodiment of the application, a network connection is established between the first service network and the second service network based on each target application instance.

[0198] Optionally, in this application embodiment, a possible implementation method for establishing a network connection is provided. The process of establishing a network connection in this application embodiment is described below, specifically including:

[0199] S231: Establish a network interface between the first service network and the second service network by calling the connection creation interface.

[0200] In this embodiment of the application, a network interface for providing network services is established between the first service network and the second service network by calling an external connection creation interface.

[0201] It should be noted that in S231, the connection creation interface is called to create a network interface between the first service network and the second service network. The first service network cannot obtain the corresponding network services of the second service network through the network interface alone. Instead, it needs to provide the network services corresponding to the second service network to the first service network through each target application instance.

[0202] S232: By calling each target application instance and the network interface, provide the network services of the second service network to the first service network.

[0203] In this embodiment of the application, since each target application instance is used to provide network access to the first service network, each target application instance is invoked and network services of the second service network are provided to the first service network through the created network interface, thereby achieving network connection. This can avoid a large amount of repetitive work in network connection under different network environments and reduce resource consumption.

[0204] It should be noted that in this embodiment, a real network service can be created through the target application instance. In addition, it should be noted that the network interface in this embodiment is only used to establish network connection. The implementation logic of the network interface between different service networks can be the same. Of course, users can extend the network interface and inject custom implementation logic. Therefore, the network interface has scalability.

[0205] For example, see Figure 2F The diagram shown is an example of network services provided in an embodiment of this application. Assuming the application instance is a pod, the first service network and the second service network create a network interface through the connection creation interface of the external service. The target pods are target pod1, target pod3 and target pod6. Target pod1, target pod3 and target pod6 provide the network services corresponding to the second service network to the first service network through the network interface.

[0206] In this embodiment, network services can be used declaratively, greatly reducing the difficulty of business access to network services and avoiding a large amount of repetitive access work between different services. In addition, it provides a good scalable architecture that can easily cope with different network environments and scenarios and expand the corresponding network connection implementation. Furthermore, it supports high service reliability by combining the running status of application instances and the corresponding probe detection results to ensure the high reliability of network services.

[0207] Based on the above embodiments, the process for determining the target application instance in the embodiments of this application will be described below, please refer to... Figure 3 The diagram shown illustrates the process of determining a target application instance in an embodiment of this application, specifically including:

[0208] S300: Determine whether the probe configuration status corresponding to the candidate application instance is configured. If yes, execute S301; otherwise, execute S304.

[0209] In this embodiment of the application, the running state corresponding to the candidate application instance includes the probe configuration state, which includes configured and unconfigured.

[0210] S301: If the probe detection result is successful, proceed to S302; if the probe detection result is unsuccessful, proceed to S303; if the probe detection result is unknown, proceed to S304.

[0211] In this embodiment of the application, the running status corresponding to the candidate application instance also includes the probe detection result, which can be divided into success, failure and unknown.

[0212] S302: Use the candidate application instance as the target application instance.

[0213] S303: No processing is performed on the candidate application instance.

[0214] S304: Determine whether the running status of the application instance corresponding to the candidate application instance is continuously running. If yes, execute S305; otherwise, execute S306.

[0215] In this embodiment of the application, the running status corresponding to the candidate application instance also includes the application instance running status, which can be divided into continuous running and not running normally.

[0216] S305: Use the candidate application instance as the target application instance.

[0217] S306: Do not perform any processing on candidate application instances.

[0218] S307: Read the next candidate application instance.

[0219] Therefore, by using the above method, the corresponding candidate application instance that can continuously provide network services can be identified from each candidate application instance, thereby ensuring that network services can be provided normally when the target application instance is used to provide network services of the second service network to the first service network, and ensuring normal network connection.

[0220] Based on the above embodiments, see Figure 4 The diagram shown is a schematic representation of the process for deleting a network connection in an embodiment of this application, specifically including:

[0221] S40: When the update time corresponding to the network connection is obtained, the network connection is tuned.

[0222] The update time is generated after the API server updates the network connection object by setting the deletion timestamp of the network connection object to the current time when it receives a deletion request for the network connection.

[0223] In this embodiment, the user submits a deletion request for a network connection to the API server. The API server internally sets the deletion timestamp of the network connection object corresponding to the network connection to the current time and updates the network connection object corresponding to the network connection. When the controller obtains the update time of the network connection object of the network connection in the API server, it tunes the network connection.

[0224] For example, assuming the user submits a deletion request at 2:10:00, the deletion timestamp of the network connection is set to 2:10:00. At this time, the network connection object corresponding to the network connection is updated. The controller determines that the network connection object has been updated and then tunes the network connection.

[0225] It should be noted that when the API server sets a deletion timestamp, the network connection object will be prevented from being deleted by its own deletion interception flag.

[0226] Additionally, it should be noted that in this embodiment of the application, tuning the network connection represents performing a deletion process on the network connection. However, since there may be situations where the deletion process cannot be executed, the deletion process will be terminated in such cases.

[0227] S41: During the tuning process, when the deletion timestamp of the network connection is determined to be the current time, the network state corresponding to the network connection is determined to be the expected deletion.

[0228] The deletion timestamp is set when a deletion request is received.

[0229] In this embodiment of the application, during the tuning process, if it is determined that the deletion timestamp is not empty, that is, the determined deletion timestamp of the network connection is the current time, then the network state corresponding to the network connection is determined to be the desired deletion.

[0230] For example, assuming the user submits a deletion request at 2:10:00, the deletion timestamp of the network connection is set to 2:10:00. During the tuning process, if it is determined that the deletion timestamp corresponding to the network connection is not empty and is 2:10:00, then it is determined that the network connection is expected to be deleted.

[0231] It should be noted that in this embodiment of the application, when the network status is "expected to be deleted", it indicates that the network connection is expected to be deleted.

[0232] S42: Delete network connection.

[0233] In this embodiment of the application, when it is determined that the network status corresponding to the network connection is to be deleted, the network connection is deleted.

[0234] Optionally, in this application embodiment, a possible implementation method for deleting a network connection is provided. The process of deleting a network connection in this application embodiment is described in detail below:

[0235] S421: Delete the network service interfaces corresponding to the network connection by calling the delete network interface.

[0236] In this embodiment of the application, by calling an external network deletion interface, the existing network service interfaces of the network connection are deleted, thereby deleting the underlying network connection.

[0237] It should be noted that when deleting various network service interfaces, users can inject and implement their own logic, which improves the scalability of deleting network connections.

[0238] S422: Remove the deletion interception flag corresponding to the network connection and generate a deletion command.

[0239] In this embodiment of the application, after successfully deleting the underlying network connection, the deletion interception flag corresponding to the network connection is removed, and a deletion command is generated.

[0240] S423: Send a deletion command to the API server so that the API server deletes the network connection object created for the corresponding network connection.

[0241] In this embodiment of the application, after determining the deletion interception flag corresponding to the network connection to be removed, a deletion instruction is generated and sent to the API server. The API server responds to the deletion instruction and deletes the network connection object created by the network connection.

[0242] In this way, the network connection can be deleted, further ensuring that the network connection can be completely deleted.

[0243] Based on the above embodiments, see Figure 5 The diagram shown is a system schematic diagram of an embodiment of this application, specifically including:

[0244] 1. First service network.

[0245] In this embodiment of the application, after the first service network establishes a network connection with the second service network, the first service network can use the services provided by the second service network.

[0246] 2. Second service network.

[0247] In this embodiment of the application, the second service network is used to provide services to the first service network. The first service network and the second service network are in different network environments and are isolated from each other.

[0248] The second service network includes pod1, pod2 and pod3, and each of pod1, pod2 and pod3 is configured with a probe.

[0249] 3. Selector.

[0250] In this embodiment of the application, the selector is used to select candidate application instances corresponding to the corresponding candidate tags from each preset original application instance based on each candidate tag contained in the filtering instruction information.

[0251] 4. Excluder.

[0252] In this embodiment of the application, the excluder is used to filter out application instances corresponding to the corresponding exclusion tags from each preset original application instance based on each exclusion tag contained in the filtering instruction information.

[0253] 5. Online resources.

[0254] In this embodiment, the network resource is a module that can be customized and extended to enable reentrant creation and deletion of network connections.

[0255] 6. Network resource factory.

[0256] In this embodiment of the application, the network resource factory is used to establish corresponding network connections in a factory pattern and to delete network connections, including creating resource 1 and creating resource 2, both of which are used to establish network connections.

[0257] It should be noted that the network resource factory in this embodiment is a customizable and extensible module. It only needs to implement the Apply and Destroy methods to achieve reentrant creation and deletion of network connections. In this way, network connection requests can be easily implemented by declaratively creating network connection objects.

[0258] Apply is the method for creating a network connection, and Destroy is the method for deleting a network connection.

[0259] 7. Controller.

[0260] 8. In this embodiment of the application, the controller is used to interact with the API server to create or delete network connections.

[0261] 7. API server.

[0262] In this embodiment of the application, the API server is used to receive network connection requests and network connection deletion requests, and send the received network connection requests and network connection deletion requests to the controller to perform network connection or network connection deletion.

[0263] Based on the above embodiments, see Figure 6 The diagram shown is an interactive flowchart for establishing a network connection in an embodiment of this application, specifically including:

[0264] Step 600: The client submits a network connection request to the API server.

[0265] Step 601: The API server verifies the validity of network connection requests.

[0266] In this embodiment of the application, the API server performs a validity check on the network connection request. Once the validity check of the network connection request is passed, it determines that the creation of the network connection object is allowed.

[0267] Step 602: After the controller determines that a network connection object has been created, it selects candidate application instances from the original application instances.

[0268] In this embodiment of the application, the selector in Kubernetes can be used to determine the optional application instances corresponding to each optional tag, and the excluder in Kubernetes can be used to determine the application instances to be excluded corresponding to each exclusion tag. The matching application instances to be excluded are deleted from the optional application instances, thereby obtaining each candidate application instance.

[0269] In this embodiment, each optional tag can be specified in the configuration manifest when creating a pod, or it can be added using a command after the pod is created. A pod can have multiple optional tags, and an optional tag can also be attached to multiple pods.

[0270] It should be noted that the application instance in this application embodiment can be a pod, and this application embodiment does not impose any restrictions on it.

[0271] Step 603: Obtain each candidate application instance from the API server.

[0272] In this embodiment of the application, candidate application instances can be obtained from the API server through the k8s Informer mechanism.

[0273] The Informer is a code abstraction of resources that runs under the control of the controller. It pops data from the Delta FIFO and then sends the data to the Indexer. The Informer also distributes data to custom controllers for event handling.

[0274] Step 604: Obtain the probe configuration status corresponding to each candidate application instance from the API server.

[0275] Step 605: Based on the running status, probe configuration status and probe detection results of each application instance, determine the set of application instances that can provide services, the set of application instances that cannot provide services and the set of application instances without probes from each candidate application instance.

[0276] Step 606: Establish a network connection interface between the first service network and the second service network by calling the connection creation interface.

[0277] Step 607: By calling each target application instance and the network interface, provide the network services of the second service network to the first service network.

[0278] Step 608: Update the network status of the network connection object to the API server.

[0279] Based on the above embodiments, see Figure 7 The diagram shown is an interactive flowchart for deleting a network connection in an embodiment of this application, specifically including:

[0280] Step 700: The user submits a deletion request to the API server to delete the network connection.

[0281] Step 701: The API server internally sets the deletion timestamp of the network connection object to the current time and updates the network connection object.

[0282] In this embodiment of the application, after the network connection object is updated, the network connection object will be prevented from being deleted by its own deletion prevention flag.

[0283] In this embodiment, the deletion blocking identifier can be the Finalizers field in Kubernetes. The Finalizers field belongs to the Kubernetes GC garbage collector and is a deletion interception mechanism that enables the controller to implement asynchronous pre-deletion callbacks. The Finalizers field can exist in each network connection object. In specific implementation, for a deletion request of a network connection object with a Finalizer field, its deletion timestamp will be set to the current time, but the network connection object will not be deleted in this step. Once the deletion timestamp is set, the value in the Finalizers field will be removed.

[0284] When the field corresponding to the deletion timestamp is set, the controllers responsible for monitoring the network connection object will execute all deletion prevention mechanisms by polling for update requests to the network connection object. Once all deletion prevention mechanisms have been executed, the network connection object is deleted.

[0285] Step 702: The controller obtains the update time corresponding to the network connection and tunes the network connection.

[0286] Step 703: During the tuning process, if the deletion timestamp of the network connection is not empty, determine that the network state corresponding to the network connection is expected to be deleted.

[0287] Step 704: The controller deletes the network service interfaces corresponding to the network connection by calling the delete network interface.

[0288] In this embodiment of the application, when deleting the network service interfaces corresponding to the network connection by calling the delete network interface, the default deletion execution logic can be used. Of course, custom logic can also be injected and implemented, so it has scalability.

[0289] Step 705: Remove the deletion interception flag corresponding to the network connection and generate a deletion command.

[0290] In this embodiment, the controller removes the finalizer of the network connection object and updates the network connection object to the API server.

[0291] Step 706: The API server deletes the network connection object created for the corresponding network connection.

[0292] Based on the same inventive concept, embodiments of this application also provide an apparatus for establishing a network connection. See also... Figure 8 The diagram shown is a structural schematic of a device for establishing a network connection in an embodiment of this application, which may include:

[0293] The first filtering module 800 is used to filter out the optional application instances corresponding to each optional tag from the preset original application instances based on the optional tags carried by the created network connection object, and to filter out the application instances to be excluded from each original application instance based on the exclusion indication information carried by the network connection object.

[0294] The determination module 801 is used to delete the corresponding optional application instances from each optional application instance based on the filtered application instances to be excluded, and to obtain each candidate application instance associated with the first service network and the second service network.

[0295] The second filtering module 802 is used to filter out target application instances that meet preset operating conditions from each candidate application instance based on the running status of each candidate application instance.

[0296] Module 803 is used to establish network connections between the first service network and the second service network based on each target application instance.

[0297] Optionally, when filtering out application instances to be excluded from each original application instance based on the exclusion indication information carried by the network connection object, the first filtering module 800 is further used for:

[0298] Based on the exclusion tags contained in the exclusion indication information, select the application instances to be excluded that correspond to each exclusion tag from each original application instance; and,

[0299] Based on the first application instance identifier contained in the exclusion indication information, the application instance to be excluded corresponding to the corresponding first application instance identifier is determined from each original application instance.

[0300] Optionally, the determining module 801 is also used for:

[0301] For each application instance to be excluded, perform the following operations:

[0302] If it is determined that an application instance to be excluded is included in each candidate application instance based on the second application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

[0303] Optionally, when filtering out application instances corresponding to each exclusion tag from each original application instance based on the exclusion indication information, the first filtering module 800 is further configured to:

[0304] Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance;

[0305] Based on the union of the set of application instances to be excluded and the set of optional application instances, a set of candidate application instances containing each candidate application instance is obtained.

[0306] Optionally, the running state includes at least the probe configuration state, and the second screening module 802 is also used for:

[0307] For each candidate application instance, perform the following operations:

[0308] When it is determined that the probe configuration status of a candidate application instance is configured and the corresponding configured probe is successfully detected, the candidate application instance is used as the target application instance. Each probe is used to determine whether the corresponding candidate application instance is in a state of providing network services normally.

[0309] When the probe configuration status is determined to be unconfigured and the application instance in the running state is continuously running, a candidate application instance is selected as the target application instance.

[0310] Optionally, the device also includes an addition module 804, which is used for:

[0311] Add each candidate application instance with a probe configuration status of "not configured" to the set of application instances without probes;

[0312] Add each target application instance to the set of application instances that can provide services;

[0313] Each candidate application instance, excluding the target application instance, is added to the set of application instances that cannot provide services.

[0314] Store the sets of application instances without probes, the sets of application instances that can provide services, and the sets of application instances that cannot provide services in the network state.

[0315] Optionally, module 803 is also used for:

[0316] By calling the connection creation interface, a network connection interface is established between the first service network and the second service network.

[0317] By calling each target application instance and the network connection interface, the network services of the second service network are provided to the first service network.

[0318] Optionally, the device also includes a deletion module 805, which is used for:

[0319] When the update time corresponding to the network connection is obtained, the network connection is tuned. The update time is generated after the API server updates the network connection object after receiving the deletion request for the network connection and setting the deletion timestamp of the network connection object to the current time.

[0320] During the tuning process, if the deletion timestamp of the network connection is determined to be non-empty, the network state corresponding to the network connection is determined to be expected to be deleted. The deletion timestamp is set when the deletion request is received.

[0321] Delete the network connection.

[0322] Optionally, when deleting a network connection, the deletion module 805 is also used for:

[0323] By calling the delete network interface, the network service interfaces corresponding to the network connection are deleted.

[0324] Remove the deletion interception flag corresponding to the network connection and generate a deletion command;

[0325] Send the deletion command to the API server so that the API server deletes the network connection object created for the corresponding network connection.

[0326] In some possible implementations, the apparatus for establishing a network connection according to this application may include at least a processor and a memory. The memory stores program code that, when executed by the processor, causes the processor to perform the steps of the methods for establishing a network connection according to various exemplary embodiments of this application described in this specification. For example, the processor may perform actions such as... Figure 2A The steps are shown in the figure.

[0327] Based on the same inventive concept as the above-described method embodiments, this application also provides an electronic device. In one embodiment, the electronic device may be, for example... Figure 1 The controller 110 shown in this embodiment, in which the electronic device can be structured as follows: Figure 9 As shown, it includes a memory 901, a communication module 903, and one or more processors 902.

[0328] The memory 901 is used to store computer programs executed by the processor 902. The memory 901 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0329] Memory 901 may be volatile memory, such as random-access memory (RAM); memory 901 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 901 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 501 may be a combination of the above-described memories.

[0330] Processor 902 may include one or more central processing units (CPUs) or digital processing units, etc. Processor 902 is used to implement the above-described method of establishing a network connection when calling a computer program stored in memory 901.

[0331] The communication module 903 is used to communicate with terminal devices and other servers.

[0332] This application embodiment does not limit the specific connection medium between the memory 901, communication module 903, and processor 902 described above. This application embodiment... Figure 9 The memory 901 and the processor 902 are connected via a bus 904, which is in... Figure 9 The diagram uses thick lines to describe the connections between other components; these are for illustrative purposes only and should not be considered limiting. The 904 bus can be divided into address bus, data bus, control bus, etc. For ease of description, Figure 9 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.

[0333] The memory 901 stores a computer storage medium, which stores computer-executable instructions for implementing the method of establishing a network connection according to embodiments of this application. The processor 902 is used to execute the aforementioned method of establishing a network connection, such as... Figure 2A As shown.

[0334] In some possible implementations, various aspects of the method for establishing a network connection provided in this application can also be implemented as a program product, which includes program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps in the road recognition method according to the various exemplary embodiments of this application described above. For example, the computer device can perform actions such as... Figure 2A The steps are shown in the figure.

[0335] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0336] The program product of the embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a computing device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with a command execution system, apparatus, or device.

[0337] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.

[0338] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0339] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

Claims

1. A method for establishing a network connection, characterized in that, include: Based on the optional tags carried by the created network connection object, select the optional application instances corresponding to each optional tag from the preset original application instances; and based on the exclusion indication information carried by the network connection object, select the application instances to be excluded from the original application instances. Based on the selected application instances to be excluded, the corresponding optional application instances are deleted from each optional application instance to obtain each candidate application instance associated with the first service network and the second service network. Based on the running status of each candidate application instance, target application instances that meet the preset running conditions are selected from the candidate application instances. Based on the aforementioned target application instances, a network connection is established between the first service network and the second service network.

2. The method as described in claim 1, characterized in that, The step of filtering out application instances from the original application instances based on the exclusion indication information carried by the network connection object includes: Based on the exclusion tags contained in the exclusion indication information, select the application instances to be excluded that correspond to the exclusion tags from the original application instances; and, Based on the first application instance identifiers contained in the exclusion indication information, the application instances to be excluded corresponding to the corresponding first application instance identifiers are determined from the original application instances.

3. The method as described in claim 2, characterized in that, The step of filtering out application instances corresponding to the exclusion tags from the original application instances based on the exclusion indication information includes: For each of the application instances to be excluded, perform the following operations respectively: If it is determined that the application instance to be excluded is included in each candidate application instance based on the second application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

4. The method as described in claim 2, characterized in that, The step of filtering out application instances corresponding to the exclusion tags from the original application instances based on the exclusion indication information includes: Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance; Based on the union of the set of application instances to be excluded and the set of optional application instances, a set of candidate application instances containing each candidate application instance is obtained.

5. The method as described in claim 1, characterized in that, The operating state includes at least the probe configuration state. The step of selecting target application instances that meet preset operating conditions from the candidate application instances based on their respective operating states includes: For each of the candidate application instances, perform the following operations respectively: When it is determined that the probe configuration status of a candidate application instance is configured and the corresponding configured probe is successfully detected, the candidate application instance is used as the target application instance. Each probe is used to determine whether the corresponding candidate application instance is in a state of providing network services normally. When it is determined that the probe configuration status is not configured and the application instance in the running status is continuously running, the candidate application instance is selected as the target application instance.

6. The method as described in claim 5, characterized in that, The method further includes: Add each candidate application instance with a probe configuration status of "not configured" to the set of application instances without probes; Each target application instance is added to the set of application instances that can provide services. Each candidate application instance, excluding the target application instances, is added to the set of application instances that cannot provide services. The set of probe-free application instances, the set of application instances that can provide services, and the set of application instances that cannot provide services are stored in the network status.

7. The method as described in claim 1, characterized in that, The step of establishing a network connection between the first service network and the second service network based on the target application instances includes: By calling the connection creation interface, a network connection interface is established between the first service network and the second service network; By invoking the target application instances and the network connection interface, the network services of the second service network are provided to the first service network.

8. The method according to any one of claims 1-7, characterized in that, The method further includes: When the update time corresponding to the network connection is obtained, the network connection is tuned. The update time is generated after the API server updates the network connection object after receiving the deletion request for the network connection and setting the deletion timestamp of the network connection object to the current time. During the tuning process, when it is determined that the deletion timestamp of the network connection is not empty, the network status corresponding to the network connection is determined to be expected to be deleted, wherein the deletion timestamp is set when the deletion request is received; Delete the network connection.

9. The method as described in claim 8, characterized in that, Deleting the network connection includes: By calling the delete network interface, the network service interfaces corresponding to the network connection are deleted. Remove the deletion interception flag corresponding to the network connection and generate a deletion command; The deletion instruction is sent to the API server so that the API server deletes the network connection object created for the corresponding network connection.

10. An apparatus for establishing a network connection, characterized in that, Applied to controllers, including: The first filtering module is used to filter out the optional application instances corresponding to each optional tag from the preset original application instances based on each optional tag carried by the created network connection object, and to filter out each application instance to be excluded from the original application instances based on the exclusion indication information carried by the network connection object. The determination module is used to delete corresponding optional application instances from each optional application instance based on each filtered application instance to be excluded, and to obtain each candidate application instance associated with the first service network and the second service network. The second filtering module is used to filter out target application instances that meet preset operating conditions from the candidate application instances based on the running status of each candidate application instance. A module is established to establish a network connection between the first service network and the second service network based on the target application instances.

11. The apparatus as claimed in claim 10, characterized in that, When selecting application instances to be excluded from the original application instances based on the exclusion indication information carried by the network connection object, the first filtering module is further configured to: Based on the exclusion tags contained in the exclusion indication information, exclude application instances corresponding to the exclusion tags are selected from the original application instances. as well as, Based on the first application instance identifiers contained in the exclusion indication information, the application instances to be excluded corresponding to the corresponding first application instance identifiers are determined from the original application instances.

12. The apparatus as claimed in claim 11, characterized in that, The determining module is also used for: For each of the application instances to be excluded, perform the following operations respectively: If it is determined that the application instance to be excluded is included in each candidate application instance based on the second application instance identifier corresponding to the application instance to be excluded, then the candidate application instance corresponding to the application instance identifier is deleted from each candidate application instance.

13. The apparatus as claimed in claim 10, characterized in that, When filtering out application instances corresponding to the exclusion tags from the original application instances based on the exclusion indication information, the first filtering module is further configured to: Generate a set of application instances to be excluded containing each application instance to be excluded, and generate a set of optional application instances containing each optional application instance; Based on the union of the set of application instances to be excluded and the set of optional application instances, a set of candidate application instances containing each candidate application instance is obtained.

14. The apparatus as claimed in claim 10, characterized in that, The operating state includes at least the probe configuration state, and the second screening module is further used for: For each of the candidate application instances, perform the following operations respectively: When it is determined that the probe configuration status of a candidate application instance is configured and the corresponding configured probe is successfully detected, the candidate application instance is used as the target application instance. Each probe is used to determine whether the corresponding candidate application instance is in a state of providing network services normally. When it is determined that the probe configuration status is not configured and the application instance in the running status is continuously running, the candidate application instance is selected as the target application instance.

15. The apparatus as claimed in claim 14, characterized in that, The device further includes an adding module, the adding module being used for: Add each candidate application instance with a probe configuration status of "not configured" to the set of application instances without probes; Each target application instance is added to the set of application instances that can provide services. Each candidate application instance, excluding the target application instances, is added to the set of application instances that cannot provide services. The set of probe-free application instances, the set of application instances that can provide services, and the set of application instances that cannot provide services are stored in the network status.

16. The apparatus as claimed in claim 10, characterized in that, The establishment module is also used for: By calling the connection creation interface, a network connection interface is established between the first service network and the second service network; By invoking the target application instances and the network connection interface, the network services of the second service network are provided to the first service network.

17. The apparatus according to any one of claims 10-16, characterized in that, The device further includes a deletion module, the deletion module being used for: When the update time corresponding to the network connection is obtained, the network connection is tuned. The update time is generated after the API server updates the network connection object after receiving the deletion request for the network connection and setting the deletion timestamp of the network connection object to the current time. During the tuning process, when it is determined that the deletion timestamp of the network connection is not empty, the network status corresponding to the network connection is determined to be expected to be deleted, wherein the deletion timestamp is set when the deletion request is received; Delete the network connection.

18. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of any of the methods described in claims 1-9.

19. A computer-readable storage medium, characterized in that, It includes program code that, when run on an electronic device, causes the electronic device to perform the steps of any of the methods described in claims 1-9.

20. A computer program product, characterized in that, It includes computer instructions stored in a computer-readable storage medium; when a processor of an electronic device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, causing the electronic device to perform the steps of any of the methods described in claims 1-9.