slime-io / slime

An intelligent ServiceMesh manager based on Istio
https://slime-io.github.io/
Other
427 stars 80 forks source link

meshreg: add config to specify protocol of the source #497

Closed believening closed 8 months ago

believening commented 8 months ago

This pr allows a source to specify the protocol used by its service, rather than forcing the current default protocol type (nacos/eureka: HTTP, zookeeper: DUBBO).

Generic support is also provided. When GenericProtocol is enabled, GENERIC is used as the protocol for the service port, and the specific protocol is reflected in the port name. For more information on generic, see generic proxy.

usage:

# meshreg configuration
ZookeeperSource:
  GenericProtocol: true
  SvcProtocol: DUBBO

converted diff(right is the new):

type: networking.istio.io/v1alpha3/ServiceEntry                 type: networking.istio.io/v1alpha3/ServiceEntry
name: foo.bar.EchoService:group-a:v2                            name: foo.bar.EchoService:group-a:v2
namespace: dubbo                                                namespace: dubbo
labels:                                                         labels:
  app: foo-bar                                                    app: foo-bar 
  path: foo.bar.EchoService                                       path: foo.bar.EchoService
  registry: zookeeper                                             registry: zookeeper
Spec:                                                           Spec:
  hosts:                                                          hosts:
  - foo.bar.EchoService:group-a:v2                                - foo.bar.EchoService:group-a:v2
  ports:                                                          ports:
  - number: 20881                                                 - number: 20881
    protocol: dubbo                                           |     protocol: GENERIC
    name: dubbo-20881                                         |     name: generic-dubbo-20881
  resolution: STATIC                                              resolution: STATIC
  endpoints:                                                      endpoints:
  - address: 1.1.1.1                                              - address: 1.1.1.1 
    ports:                                                          ports:
      generic-dubbo-20881: 20881                                      generic-dubbo-20881: 20881
    labels:                                                         labels:
      app: foo-bar                                                    app: foo-bar
      group: group-a                                                  group: group-a
      interface: foo.bar.EchoService                                  interface: foo.bar.EchoService
      name: apigw-demo                                                name: apigw-demo
      version: v2                                                     version: v2