Disclosure of Invention
The inventor finds through research that the current native mechanism of kubernets is based on a single container network plane design and cannot adapt to the multi-network plane requirements of telecommunication network elements.
Accordingly, the container multi-network plane adaptation scheme is provided, and container network multi-plane adaptation facing kubernets can be effectively achieved.
According to a first aspect of the embodiments of the present disclosure, there is provided a container multi-network plane adaptation method, including: after receiving an inquiry request which is sent by a first container positioned under a first network plane and is used for inquiring a service IP address of a second container under a second network plane, inquiring whether the service IP address of the second container under the second network plane exists currently; if the service IP address of the second container under the second network plane exists currently, the service IP address of the second container under the second network plane is sent to the first container, so that the first container can access the second network plane of the second container by using the service IP address of the second container under the second network plane.
In some embodiments, if the service IP address of the second container under the second network plane is not currently available, the metadata information of the first container and the metadata information of the second container are obtained; filtering the metadata information of the second container according to the metadata information of the first container to obtain metadata of the second container under the first network plane; determining a service IP address of the second container in the first network plane according to the metadata of the second container in the first network plane. Sending the service IP address of the second container under the first network plane to the first container so that the first container accesses the first network plane of the second container by using the service IP address of the second container under the first network plane.
In some embodiments, filtering the metadata information of the second container according to the metadata information of the first container comprises: determining a network plane matched with the first container as the first network plane according to the metadata information of the first container; and filtering the metadata information of the second container to obtain a filtering result, wherein the filtering result only comprises the metadata of the second container under the first network plane.
In some embodiments, after receiving a service registration request sent by a user, extracting a registration tag and a network plane tag from the service registration request; selecting a target container associated with the registration tag; selecting a network plane of the target container according to the network plane label; a service IP address is created and the created service IP address is mapped with a network plane of the target container.
According to a second aspect of embodiments of the present disclosure, there is provided a container multi-network plane adaptation apparatus, including: the API service module is configured to inquire whether a service IP address of a second container under a second network plane exists at present or not after receiving an inquiry request which is sent by a first container under the first network plane and used for inquiring the service IP address of the second container under the second network plane; if the service IP address of the second container under the second network plane exists currently, the service IP address of the second container under the second network plane is sent to the first container, so that the first container can access the second network plane of the second container by using the service IP address of the second container under the second network plane.
In some embodiments, the apparatus further comprises a vessel filtration module, wherein: the API service module is configured to acquire metadata information of the first container and metadata information of the second container if the API service module does not currently have a service IP address of the second container under a second network plane, and send the metadata information of the first container and the metadata information of the second container to the container filtering module; after receiving metadata information of the second container under the first network plane, which is sent by a container filtering module, determining a service IP address of the second container under the first network plane according to the metadata of the second container under the first network plane, and sending the service IP address of the second container under the first network plane to the first container, so that the first container can access the first network plane of the second container by using the service IP address of the second container under the first network plane; the container filtering module is configured to filter the metadata information of the second container according to the metadata information of the first container to obtain the metadata information of the second container under the first network plane, and send the metadata information of the second container under the first network plane to the API service module.
In some embodiments, the container filtering module is configured to determine, according to the metadata information of the first container, that a network plane matching the first container is the first network plane, and filter the metadata information of the second container to obtain a filtering result, where the filtering result includes only metadata of the second container under the first network plane.
In some embodiments, the apparatus further comprises a multi-network plane service control module, wherein: the API service module is configured to send a service registration request to the multi-network plane service control module after receiving the service registration request sent by a user; the multi-network plane service control module is also configured to receive and store the mapping relation between the service IP address sent by the multi-network plane service control module and the network plane of the target container; the multi-network plane service control module is configured to extract a registration label and a network plane label from the service registration request, select a target container associated with the registration label, select a network plane of the target container according to the network plane label, create a service IP address, map the created service IP address with the network plane of the target container, and send a mapping relationship between the created service IP address and the network plane of the target container to the API service module.
According to a third aspect of the embodiments of the present disclosure, there is provided a container multi-network plane adaptation apparatus, including: a memory configured to store instructions; a processor coupled to the memory, the processor configured to perform a method implementing any of the embodiments described above based on instructions stored by the memory.
According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, in which computer instructions are stored, and when executed by a processor, implement the method according to any one of the embodiments described above.
Other features of the present disclosure and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be discussed further in subsequent figures.
Fig. 1 is a flowchart illustrating a container multi-network plane adaptation method according to an embodiment of the disclosure. In some embodiments, the following container multi-network plane adaptation method flows are performed by a container multi-network plane adaptation apparatus.
Instep 101, after receiving a query request sent by a first container located under a first network plane for querying a service IP address of a second container under a second network plane, querying whether the second container currently has the service IP address of the second container under the second network plane.
Instep 102, if there is a service IP address of the second container in the second network plane, the service IP address of the second container in the second network plane is sent to the first container, so that the first container accesses the second network plane of the second container by using the service IP address of the second container in the second network plane.
In the container multi-network plane adaptation method provided by the above embodiment of the present disclosure, the first container accesses the second network plane of the second container by using the preset service IP address, so that the kubernets-oriented container network multi-plane adaptation can be effectively implemented.
For example, the service IP address of the first container under the first network plane is 10.0.0.3, and the service IP address of the second container under the second network plane is 192.168.0.2 as the first container is known through query. The first container accesses the second network plane of the second container using the service IP address 192.168.0.2.
Fig. 2 is a flowchart illustrating a container multi-network plane adaptation method according to another embodiment of the disclosure. In some embodiments, the following container multi-network plane adaptation method flow is performed by a container multi-network plane adaptation apparatus.
Instep 201, after receiving a query request sent by a first container located under a first network plane for querying a service IP address of a second container under a second network plane, querying whether the service IP address of the second container under the second network plane exists currently.
Instep 202, if the second container does not currently have a service IP address of the second container under the second network plane, the metadata information of the first container and the metadata information of the second container are obtained.
Instep 203, the metadata information of the second container is filtered according to the metadata information of the first container to obtain metadata of the second container under the first network plane.
In some embodiments, the network plane matched with the first container is determined to be the first network plane according to the metadata information of the first container, and the metadata information of the second container is filtered to obtain a filtering result, wherein the filtering result only includes the metadata of the second container under the first network plane.
Instep 204, a service IP address of the second container in the first network plane is determined from the metadata of the second container in the first network plane.
Instep 205, the service IP address of the second container under the first network plane is sent to the first container so that the first container accesses the first network plane of the second container using the service IP address of the second container under the first network plane.
For example, the service IP address of the first container in the first network plane is 10.0.0.3, and the first container fails to obtain the service IP address of the second container in the second network plane through querying. In this case, the service IP address of the second container in the first network plane is 10.0.0.2 obtained by filtering the metadata of the second container. A first network plane is conducted where the first container accesses the second container using the service IP address 10.0.0.2.
Fig. 3 is a flowchart illustrating a container multi-network plane adaptation method according to yet another embodiment of the disclosure. In some embodiments, the following container multi-network plane adaptation method flows are performed by a container multi-network plane adaptation apparatus.
Instep 301, after receiving a service registration request sent by a user, a registration tag and a network plane tag are extracted from the service registration request.
Atstep 302, a target container associated with the registered tag is selected.
Atstep 303, the network plane of the target container is selected according to the network plane label.
Atstep 304, a service IP address is created and the created service IP address is mapped with the network plane of the target container.
Fig. 4 is a schematic diagram of a registration service according to an embodiment of the disclosure.
As shown in fig. 4, there is currently container a, container B and container C. The service IP address of container a in network plane 1 is 10.0.0.1, the service IP address of container B in network plane 1 is 10.0.0.2, and the service IP address of container C in network plane 1 is 10.0.0.3.
If the target containers corresponding to the registration tags in the service registration request are container a and container B, and the network plane tag is network plane 2, a service IP address 192.168.0.1 is created for container a under network plane 2, and a service IP address 192.168.0.2 is created for container B under network plane 2. Thus, container C may access network plane 2 of container a using service IP address 192.168.0.1, and container C may also access network plane 2 of container B using service IP address 192.168.0.2.
Fig. 5 is a schematic structural diagram of a container multi-network plane adaptation device according to an embodiment of the present disclosure. As shown in fig. 5, the container multi-network plane adaptation device includes an API (Application Programming Interface)service module 51.
TheAPI service module 51, after receiving a query request sent by a first container located under the first network plane for querying a service IP address of a second container under the second network plane, queries whether a service IP address of the second container under the second network plane currently exists. If the service IP address of the second container in the second network plane currently exists, theAPI service module 51 sends the service IP address of the second container in the second network plane to the first container, so that the first container accesses the second network plane of the second container by using the service IP address of the second container in the second network plane.
In some embodiments, as shown in fig. 5, the container multi-network plane adaptation device further comprises acontainer filtering module 52.
TheAPI service module 51 is configured to, if there is no service IP address of the second container in the second network plane, obtain metadata information of the first container and metadata information of the second container, and send the metadata information of the first container and the metadata information of the second container to thecontainer filtering module 52.
Thecontainer filtering module 52 is configured to filter the metadata information of the second container according to the metadata information of the first container to obtain the metadata information of the second container under the first network plane, and send the metadata information of the second container under the first network plane to theAPI service module 51.
After receiving the metadata information of the second container in the first network plane sent by the container filtering module, theAPI service module 51 determines the service IP address of the second container in the first network plane according to the metadata of the second container in the first network plane, and sends the service IP address of the second container in the first network plane to the first container, so that the first container accesses the first network plane of the second container by using the service IP address of the second container in the first network plane.
In some embodiments, thecontainer filtering module 52 is configured to determine, according to the metadata information of the first container, that the network plane matched with the first container is the first network plane, and filter the metadata information of the second container to obtain a filtering result, where only the metadata of the second container under the first network plane is included in the filtering result.
Fig. 6 is a schematic structural diagram of a container multi-network plane adaptation device according to another embodiment of the disclosure. Fig. 6 differs from fig. 5 in that in the embodiment shown in fig. 6, the container multi-network plane adaptation means further comprises a multi-network planeservice control module 53.
TheAPI service module 51 is configured to send a service registration request to the multi-network planeservice control module 53 after receiving the service registration request sent by the user.
The multi-network-planeservice control module 53 is configured to extract a registration tag and a network-plane tag from the service registration request, select a target container associated with the registration tag, select a network plane of the target container according to the network-plane tag, create a service IP address, map the created service IP address with the network plane of the target container, and send the created mapping relationship between the service IP address and the network plane of the target container to theAPI service module 51.
TheAPI service module 51 receives and stores the mapping relationship between the service IP address sent by the multi-network planeservice control module 53 and the network plane of the target container.
Fig. 7 is a schematic structural diagram of a container multi-network plane adaptation device according to still another embodiment of the disclosure. As shown in fig. 7, the container multi-network plane adaptation apparatus includes amemory 71 and aprocessor 72.
Thememory 71 is used for storing instructions, theprocessor 72 is coupled to thememory 71, and theprocessor 72 is configured to execute the method according to any one of fig. 1 to 3 based on the instructions stored in the memory.
As shown in fig. 7, the container multi-network plane adaptation apparatus further includes acommunication interface 73 for information interaction with other devices. Meanwhile, the container multi-network plane adapting device further comprises abus 74, and theprocessor 72, thecommunication interface 73 and thememory 71 are communicated with each other through thebus 74.
Thememory 71 may comprise a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Thememory 71 may also be a memory array. Thestorage 71 may also be partitioned and the blocks may be combined into virtual volumes according to certain rules.
Further, theprocessor 72 may be a central processing unit CPU, or may be an application specific integrated circuit ASIC, or one or more integrated circuits configured to implement embodiments of the present disclosure.
The present disclosure also relates to a computer-readable storage medium, in which computer instructions are stored, and when executed by a processor, the instructions implement the method according to any one of fig. 1 to 3.
In some embodiments, the functional units described above can be implemented as general purpose processors, Programmable Logic Controllers (PLCs), Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs), or other Programmable Logic devices, discrete Gate or transistor Logic, discrete hardware components, or any suitable combination thereof, for performing the functions described in this disclosure.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The description of the present disclosure has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the disclosure in the form disclosed. Many modifications and variations will be apparent to practitioners skilled in this art. The embodiment was chosen and described in order to best explain the principles of the disclosure and the practical application, and to enable others of ordinary skill in the art to understand the disclosure for various embodiments with various modifications as are suited to the particular use contemplated.