Third-party Service Creation

Third-party Service Creation

There are still two entrances for third-party service creation, namely the Create -->Create Third-Party Component in the left navigation of the team view and the Add Third-Party Component button on the Application Dashboard page. The creation process is the same.

Create a Static Third-party Service

  • Select the service registration method as static registration

  • Fill in the mailing address of the service

    For example, the service has two running instances, the IP addresses are 192.168.0.1 192.168.0.2 respectively. For the convenience of setting, we can fill in the port configuration when filling in the first instance, that is, provide the following data to inform Kato that the listening port of the Kato service is 8080 , And they are all consistent.

    • 192.168.0.1:8080

    • 192.168.0.2

  • Submit the creation, enter the Dashboard page of the service to configure the service port, connection information, and health check properties.

Create Dynamic Third-party Services

  • Select the service registration method as dynamic registration
  • Select dynamic registration type
  • Fill in the information of the service registration center such as address, Key (user name and password are optional)
  • Submit the creation, enter the Dashboard page of the service to configure the service port, connection information, and health check properties.
The Format of the Data in the Service Registry

Take etcd as an example:

/kato/service1/3201a2727b6445e9a9234a26284549e6
{"ip":"192.168.0.1", "port": 5000}
/kato/service1/728d17f86a5f3d834b6db984dd4a50ad
{"ip":"192.168.0.2"}

These are two pieces of information registered in etcd, each representing an instance of a third-party service. Among them, /kato/service1 is the Key of the service registration center information filled in above, and 3201a2727b6445e9a9234a26284549e6 is the unique identifier of this data (uuid), separated by slashes.

{"ip":"192.168.0.107", "port": 5000} is the IP address and port of the instance of the third-party service. If not? Provide the port, then Kato will take the port you added in the port page .

Create a Third-party Service Based on API Registration

  • Select the service registration method as API registration

  • Submit the creation, enter the Dashboard page of the service to configure the service port, connection information, and health check properties.

  • After the creation is complete, you can dynamically change the communication address of the service by calling the API according to the API address and key displayed on the overview page.

The API provides three calling methods: GET, PUT, and DELETE, which correspond to the query, add (or modify) and delete of the service address respectively.

GET

The following is an API example of query instance:

curl -s -G \
--url http://ip:port/console/third_party/8ad4b1c7ffb305f2b59b6de625b1ee6a \
--data secret_key=6RW0mYM3

After executing the curl request, you will get a response similar to the following:

{
    "msg": "success",
    "code": 200,
    "msg_show": "Query successful",
    "data": {
        "list": [
            {
                "status": "healthy",
                "ip": "192.168.0.1",
                "is_static": true,
                "is_online": true
            },
            ...
        ]
    }
}

Request parameter description:

ParameterIs it requiredDescription
secret_keyyessecret key

Response parameter description:

ParametersTypeDescription
codeintbusiness code
msgstringA detailed description of the response to the request
msg_showstringThe description of the response to the request, used to show
statusstringThe status of the instance, possible values ​​are: healthy, unhealthy, unknown
ipstringIP address of the instance
is_staticboolWhether the instance is of static type, true: static type; false: dynamic type
is_onlineboolWhether the instance is online, true: online; false: offline
PUT

The following is an API example to modify the instance:

curl -X PUT \
--url http://192.168.1.200:7070/console/third_party/8d545c3e8e7780b228b6dcc77561388b \
-H "Content-Type: application/json" \
-d'{"secret_key":"4FsL5PWK","ip":"192.168.0.1","is_online":true}'

After executing the curl request, you will get a response similar to the following:

{
    "msg": "success",
    "code": 200,
    "msg_show": "Modified successfully"
}

Request parameter description:

ParameterIs it requiredTypeDescription
secret_keyyesstringkey
ipyesstringservice instance address, ipv4 format
is_onlineNoboolWhether to go online, default true

Response parameter description:

ParametersTypeDescription
codeintbusiness code
msgstringA detailed description of the response to the request
msg_showstringThe description of the response to the request, used to show
DELETE

The following is an API example for deleting an instance:

curl -X DELETE \
--url http://192.168.1.200:7070/console/third_party/8d545c3e8e7780b228b6dcc77561388b \
-H "Content-Type: application/json" \
-d'{"secret_key":"4FsL5PWK","ip":"192.168.1.107","is_online":true}'

After executing the curl request, you will get a response similar to the following:

{
    "msg": "success",
    "code": 200,
    "msg_show": "Delete successfully"
}

Request parameter description:

ParameterIs it requiredTypeDescription
secret_keyyesstringkey
ipyesstringservice instance address, ipv4 format

Response parameter description:

ParametersTypeDescription
codeintbusiness code
msgstringA detailed description of the response to the request
msg_showstringThe description of the response to the request, used to show

The request content type of PUT and DELETE method is application/json

Third-party Service Creation Example

Docking with Internal Services

Such as the rbd-app-ui or rbd-monitor component of the Kato platform

After creation, you need to go online manually.

For example, if you don’t want to open port 7070 to the outside world or want to access the console through 80/443, you can do this in this way.

Connect with Alibaba Cloud RDS

Kato provides corresponding support for the domain name instances of third-party components, allows users to add the domain name instance addresses of third-party components, and provides internal services of the kato platform.

Combined with the existing logic that a domain name can resolve to multiple IP addresses, the kato platform only allows adding a domain name instance address to a third-party component.

Static Registration Method

In the process of creating static third-party components, there will be logic for address verification. If the user fills in multiple addresses, and the number of domain name addresses is greater than or equal to 1, the verification will not pass.

In other words, a third-party service added by domain name can only add 1 domain name instance address.

Dynamic Registration Method

In the process of creating dynamic third-party components, especially when adding instance addresses in dynamic discovery methods such as etcd, there will also be address verification logic. If the data contains a domain name, the first domain name will be used as the third party The instance address of the component.

The adjustment process is the same as the internal service of the docking platform. There are several points to note. If the platform application needs to rely on the MYSQL installed by the third service, it needs to enable internal access and manually add application connection information.