Project: Slime (Orchestration & Management / Service Mesh)
File: README_EN.md

The role of the `meshregistry` module is approximately `serviceregistry`, which docks a variety of service registries, converts different service data into unified `ServiceEntry` data (istio service model), and then provides it to the downstream as a service by means of a specified protocol. This module can be considered as a continuation of the istio `galley` component, with some differences. No longer proxies resources other than service data for single responsibility reasons (`galley` supports fetching various configuration resources in k8s and forwarding them to downstream) Following the evolution of istio, the supported protocols are switched from `MCP` to `MCP-over-xDS` (this is achieved by , the library also supports HTTP protocols, etc.) Some enhancements have been made based on the experience and needs of the ground practice, some of which may require downstream (istio side) corresponding modifications, but are not necessary The currently supported service registries are. zk (dubbo) eureka nacos k8s `MCP-over-xDS` Other protocols supported This feature is supported by and requires client-server dual-end support. Currently, since it is not yet in the community istio, you need to turn off this feature if you dock to the community istio. If you expect to use it, you need to modify istio to replace the community `Adsc` with this library. There are plans to retrofit istio-mcp incremental push to delta xDS implementation and then move forward with community adsc support for delta xDS. You can follow the progress of this library Optionally, you can enable the dubbo `Sidecar` generation feature, which will analyze the dubbo application's interface dependencies based on the dubbo consumers' information in zk and then generate standard istio `Sidecar` resources, which can greatly reduce the amount of configuration sent down to the data surface As a slime module, the flow of use is roughly the same: 1. enable the module and be managed by slime (slime-boot method or bundle method) prepare the module config to configure the module behavior as necessary add the module to the bundle, package it, and create an image this module supports a small number of behavior settings in the env way, if necessary, you can add in the bundle's deployment material (deployment) (optional) in the bundle's configuration configmap to add this module section, similar to the following. ```yaml apiVersion: v1 data: cfg: | bundle: modules: name: meshregistry kind: meshregistry enable: true cfg_meshregistry: | name: meshregistry kind: meshregistry enable: true mode: BundleItem general: LEGACY: MeshConfigFile: "" RevCrds: "" Mcp: EnableIncPush: false K8SSource: Enabled: false EurekaSource: Enabled: true Address: "http://eureka.myeureka.com/eureka" RefreshPeriod: 15s SvcPort: 80 ZookeeperSource: Enabled: true RefreshPeriod: 30s WaitTime: 10s ZookeeperSource: Enabled: true zookeeper.myzk.cluster.local:2181 ``` > See the bundle deployment mode introduction for other configurations > > See

for configuration details 1 blockOwnerDeletion: true controller: true kind: PluginManager name: reviews-pm uid: 00a65d02-4025-4d0c-a08a-0a8901cd0fa2 resourceVersion: "658741" uid: 2e8c8a96-fc0d-4e92-9f7a-e3336a53a806 spec: configPatches: applyTo: HTTP_FILTER match: context: SIDECAR_OUTBOUND listener: filterChain: filter: name: envoy.filters.network.httpconnectionmanager subFilter: name: envoy.filters.http.router patch: operation: INSERT_BEFORE value: name: reviews-ep typed_config: '@type': type.googleapis.com/udpa.type.v1.TypedStruct type_url: "" value: rate_limits: actions: headervaluematch: descriptor_value: Service[a.powerful]-User[none]-Gateway[null]-Api[null]-Id[hash:-1414739194] headers: invert_match: false name: testaaa saferegexmatch: google_re2: {} regex: testt stage: 0 workloadSelector: labels: app: reviews ``` EnvoyPlugin enables and sets the specified http filter by configuring `typedPerFilterConfig` of the envoy RDS api. Also, for traffic management interfaces outside of `typedPerFilterConfig`, such as `rate_limits(config.route.v3.RateLimit)`, `cors(config.route.v3.CorsPolicy)`, EnvoyPlugin provides DirectPatch mode for setting such interfaces. It can be configured in the following format. ```yaml apiVersion: microservice.slime.io/v1alpha1 kind: EnvoyPlugin metadata: name: reviews-ep namespace: default spec: route: inbound|http|80/default plugin: enable: true name: {{http_filter-1}} # http filter name inline: settings: {{filter_settings}} # filter settings enable: true name: {{http_filter-N}} enable: true inline: directPatch: true settings: {{api_settings}} ``` `{{api_settings}}` is the setting for the non-typedPerFilterConfig field in the RDS api object. To disable `envoy.filters.http.buffer`, use the yaml file below to create envoy plugin ```yaml apiVersion: microservice.slime.io/v1alpha1 kind: EnvoyPlugin metadata: name: reviews-ep namespace: default spec: route: inbound|http|80/default plugins: enable: true inline: settings: disabled: true name: envoy.filters.http.buffer ``` And you will get the envoyfilter ```yaml apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: reviews-ep namespace: default ownerReferences: apiVersion: microservice.slime.io/v1alpha1 blockOwnerDeletion: true controller: true kind: EnvoyPlugin name: reviews-ep uid: c2f672bf-588a-4cbe-b0d4-0625ef1320e8 spec: configPatches: applyTo: HTTP_ROUTE match: routeConfiguration: vhost: name: inbound|http|80 route: name: default patch: operation: MERGE value: typedPerFilterConfig: envoy.filters.http.buffer: '@type': type.googleapis.com/udpa.type.v1.TypedStruct type_url: "" value: disabled: true ``` The envoy RDS api provides some specialized interfaces for configuring traffic management rules in addition to `typedPerFilterConfig`, such as `rate_limits(config.route.v3.RateLimit)`, `cors(config.route.v3. CorsPolicy)`, etc. Such configurations can be set using EnvoyPlugin DirectPatch mode. Take the configuration of `rate_limits` and `cors` as an example, use the yaml file below to create envoy plugin ```yaml apiVersion: microservice.slime.io/v1alpha1 kind: EnvoyPlugin metadata: name: reviews-ep namespace: default spec: workloadSelector: labels: app: reviews route: inbound|http|80/default plugins: name: envoy.filters.network.ratelimit enable: true inline: directPatch: true settings: rate_limits: actions: headervaluematch: descriptor_value: Service[a.powerful]-User[none]-Gateway[null]-Api[null]-Id[hash:-1414739194] headers: invert_match: false name: testaaa saferegexmatch: google_re2: {} regex: testt stage: 0 name: envoy.filters.http.cors enable: true inline: directPatch: true settings: cors: alloworiginstring_match: string_match: saferegexmatch: google_re2: {} regex: www.163.com| ``` And you will get the envoyfilter ```yaml apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: reviews-ep namespace: default ownerReferences: apiVersion: microservice.slime.io/v1alpha1 blockOwnerDeletion: true controller: true kind: EnvoyPlugin name: reviews-ep uid: fcf9d63b-115f-4a2a-bfc4-40d5ce1bcfee spec: configPatches: applyTo: HTTP_ROUTE match: routeConfiguration: vhost: name: inbound|http|80 route: name: default patch: operation: MERGE value: route: rate_limits: actions: headervaluematch: descriptor_value: Service[a.powerful]-User[none]-Gateway[null]-Api[null]-Id[hash:-1414739194] headers: invert_match: false name: testaaa saferegexmatch: google_re2: {} regex: testt stage: 0 applyTo: HTTP_ROUTE match: routeConfiguration: vhost: name: inbound|http|80 route: name: default patch: operation: MERGE value: route: cors: alloworiginstring_match: string_match: saferegexmatch: google_re2: {} regex: www.163.com| workloadSelector: labels: app: reviews ```