slime-io / slime

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

lazyload: expand feature dispatch #393

Closed MouceL closed 1 year ago

MouceL commented 1 year ago

dispatch特性不支持正则,无法对复杂的域名进行分派,且懒加载默认兜底路由指向gs,无法修改

本mr支持正则匹配分派流量和兜底路由修改

以下slimeboot配置实现:

将后缀为svc.cluster.local或短域名的流量分派到global-sidecar,其余所有流量分派到passthroughCluster

  module:
    - name: lazyload
      kind: lazyload
      enable: true
      general:
        passthroughByDefault: true
        dispatches:
        - name: fqdn
          domains:
          - "*.svc.cluster.local"  
          cluster:  _GLOBAL_SIDECAR # dispatch特性,特殊标识,标识gs   
        - domainRegex: ^(?:[^.])+$
          cluster:  _GLOBAL_SIDECAR

比如想让所有ip:v4透传

可以配置

        - domainRegex: ^\d+\.\d+\.\d+\.\d+(:\d+)?$
          cluster:  PassthroughCluster

另外slimboot的涉及的general结构如下,无法反序列化

type General struct {
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

所以用于渲染chart的values中general部分都是通过 json patch 方式写入