feat: Support dubbo group for http2rpc (#404)

This commit is contained in:
Hinsteny Hisoka
2023-06-29 10:55:34 +08:00
committed by GitHub
parent c32e1ab69b
commit 736eea6cf9
9 changed files with 192 additions and 120 deletions

View File

@@ -141,6 +141,8 @@ spec:
properties:
dubbo:
properties:
group:
type: string
methods:
items:
properties:

View File

@@ -131,7 +131,8 @@ func (*Http2Rpc) XXX_OneofWrappers() []interface{} {
type DubboService struct {
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
Methods []*Method `protobuf:"bytes,3,rep,name=methods,proto3" json:"methods,omitempty"`
Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"`
Methods []*Method `protobuf:"bytes,4,rep,name=methods,proto3" json:"methods,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -184,6 +185,13 @@ func (m *DubboService) GetVersion() string {
return ""
}
func (m *DubboService) GetGroup() string {
if m != nil {
return m.Group
}
return ""
}
func (m *DubboService) GetMethods() []*Method {
if m != nil {
return m.Methods
@@ -193,9 +201,9 @@ func (m *DubboService) GetMethods() []*Method {
type Method struct {
ServiceMethod string `protobuf:"bytes,1,opt,name=service_method,json=serviceMethod,proto3" json:"service_method,omitempty"`
HttpPath string `protobuf:"bytes,2,opt,name=http_path,json=httpPath,proto3" json:"http_path,omitempty"`
HttpMethods []string `protobuf:"bytes,3,rep,name=http_methods,json=httpMethods,proto3" json:"http_methods,omitempty"`
HeadersAttach string `protobuf:"bytes,4,opt,name=headers_attach,json=headersAttach,proto3" json:"headers_attach,omitempty"`
HeadersAttach string `protobuf:"bytes,2,opt,name=headers_attach,json=headersAttach,proto3" json:"headers_attach,omitempty"`
HttpPath string `protobuf:"bytes,3,opt,name=http_path,json=httpPath,proto3" json:"http_path,omitempty"`
HttpMethods []string `protobuf:"bytes,4,rep,name=http_methods,json=httpMethods,proto3" json:"http_methods,omitempty"`
Params []*Param `protobuf:"bytes,5,rep,name=params,proto3" json:"params,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -242,6 +250,13 @@ func (m *Method) GetServiceMethod() string {
return ""
}
func (m *Method) GetHeadersAttach() string {
if m != nil {
return m.HeadersAttach
}
return ""
}
func (m *Method) GetHttpPath() string {
if m != nil {
return m.HttpPath
@@ -256,13 +271,6 @@ func (m *Method) GetHttpMethods() []string {
return nil
}
func (m *Method) GetHeadersAttach() string {
if m != nil {
return m.HeadersAttach
}
return ""
}
func (m *Method) GetParams() []*Param {
if m != nil {
return m.Params
@@ -383,36 +391,36 @@ func init() {
func init() { proto.RegisterFile("networking/v1/http_2_rpc.proto", fileDescriptor_dc706c3b890c1c84) }
var fileDescriptor_dc706c3b890c1c84 = []byte{
// 455 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xdf, 0x6a, 0xd4, 0x40,
0x18, 0xc5, 0x9d, 0xfd, 0xd7, 0xf6, 0x4b, 0xb7, 0x17, 0x03, 0x42, 0x10, 0x8d, 0x35, 0x45, 0x2c,
0x28, 0x09, 0x5d, 0xbd, 0x10, 0xc5, 0x8b, 0x2e, 0x82, 0x05, 0x11, 0x4a, 0xea, 0x95, 0x37, 0x61,
0x92, 0x8c, 0x99, 0xa1, 0xbb, 0x99, 0x61, 0x66, 0x36, 0xba, 0x0f, 0x21, 0xf8, 0x58, 0x5e, 0xfa,
0x04, 0x22, 0xfb, 0x24, 0x92, 0x99, 0x84, 0xcd, 0x4a, 0xf7, 0x2e, 0x9c, 0xf3, 0x3b, 0xdf, 0x9c,
0x2f, 0x99, 0x40, 0x50, 0x51, 0xf3, 0x4d, 0xa8, 0x5b, 0x5e, 0x95, 0x71, 0x7d, 0x11, 0x33, 0x63,
0x64, 0x3a, 0x4b, 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, 0x27, 0x70, 0x64, 0x3f, 0x93, 0x24, 0x86,
0xf5, 0x8a, 0x0d, 0x92, 0xc3, 0x46, 0xbe, 0x26, 0x86, 0xe1, 0x67, 0x70, 0x6c, 0x91, 0x7e, 0xbd,
0x8e, 0xf2, 0x1a, 0xc7, 0x8d, 0xd2, 0xf8, 0x29, 0x9c, 0x30, 0x4a, 0x0a, 0xaa, 0x74, 0x4a, 0x8c,
0x21, 0x39, 0xf3, 0x47, 0xcd, 0xc0, 0x64, 0xda, 0xaa, 0x97, 0x56, 0xc4, 0xaf, 0x60, 0x22, 0x89,
0x22, 0x4b, 0xed, 0x8f, 0xed, 0xa2, 0x0f, 0xf7, 0x2c, 0x7a, 0xdd, 0x40, 0x49, 0xcb, 0x86, 0xdf,
0x61, 0x6c, 0x85, 0xa6, 0x8e, 0x95, 0x52, 0x2d, 0x56, 0xea, 0xbf, 0xb7, 0xed, 0x59, 0xe7, 0xc6,
0x1a, 0xcd, 0x6a, 0x0e, 0xbc, 0xa5, 0xeb, 0xdd, 0xd5, 0xac, 0xfc, 0x91, 0xae, 0xf1, 0x19, 0x80,
0x43, 0xcc, 0x5a, 0x52, 0x7f, 0xd8, 0x63, 0x5c, 0xf4, 0xf3, 0x5a, 0xd2, 0x70, 0x0a, 0x5e, 0xef,
0x42, 0xcc, 0xdf, 0xfc, 0xda, 0x04, 0xe8, 0xf7, 0x26, 0x40, 0x7f, 0x37, 0x01, 0xfa, 0xf2, 0xa2,
0xe4, 0x86, 0xad, 0xb2, 0x28, 0x17, 0xcb, 0x98, 0x2c, 0x78, 0x46, 0x32, 0x12, 0xb7, 0xeb, 0xd8,
0xfb, 0xbc, 0xf3, 0x47, 0x64, 0x13, 0x7b, 0x9f, 0x5f, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x79,
0xc4, 0x13, 0x39, 0x29, 0x03, 0x00, 0x00,
// 463 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00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0x25, 0x9a, 0xcc, 0x4e, 0x78, 0x4b, 0xd7,
0xbd, 0xad, 0x4c, 0x2c, 0xfc, 0x81, 0xae, 0xf1, 0x19, 0x80, 0x93, 0x98, 0xb5, 0xa4, 0xbd, 0x5e,
0xce, 0xfa, 0x69, 0x2d, 0x69, 0x38, 0x05, 0xaf, 0x73, 0x32, 0xf3, 0xd7, 0x3f, 0x37, 0x01, 0xfa,
0xb5, 0x09, 0xd0, 0xef, 0x4d, 0x80, 0x3e, 0x3f, 0x2f, 0xb9, 0x61, 0xab, 0x2c, 0xca, 0xc5, 0x32,
0x26, 0x0b, 0x9e, 0x91, 0x8c, 0xc4, 0x6d, 0x1d, 0x7b, 0xf1, 0xbd, 0x7f, 0x26, 0x1b, 0xdb, 0x8b,
0x7f, 0xf1, 0x37, 0x00, 0x00, 0xff, 0xff, 0x75, 0x5c, 0x9e, 0x28, 0x4b, 0x03, 0x00, 0x00,
}
func (m *Http2Rpc) Marshal() (dAtA []byte, err error) {
@@ -528,9 +536,16 @@ func (m *DubboService) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x1a
dAtA[i] = 0x22
}
}
if len(m.Group) > 0 {
i -= len(m.Group)
copy(dAtA[i:], m.Group)
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(len(m.Group)))
i--
dAtA[i] = 0x1a
}
if len(m.Version) > 0 {
i -= len(m.Version)
copy(dAtA[i:], m.Version)
@@ -586,20 +601,13 @@ func (m *Method) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x2a
}
}
if len(m.HeadersAttach) > 0 {
i -= len(m.HeadersAttach)
copy(dAtA[i:], m.HeadersAttach)
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(len(m.HeadersAttach)))
i--
dAtA[i] = 0x22
}
if len(m.HttpMethods) > 0 {
for iNdEx := len(m.HttpMethods) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.HttpMethods[iNdEx])
copy(dAtA[i:], m.HttpMethods[iNdEx])
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(len(m.HttpMethods[iNdEx])))
i--
dAtA[i] = 0x1a
dAtA[i] = 0x22
}
}
if len(m.HttpPath) > 0 {
@@ -607,6 +615,13 @@ func (m *Method) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.HttpPath)
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(len(m.HttpPath)))
i--
dAtA[i] = 0x1a
}
if len(m.HeadersAttach) > 0 {
i -= len(m.HeadersAttach)
copy(dAtA[i:], m.HeadersAttach)
i = encodeVarintHttp_2Rpc(dAtA, i, uint64(len(m.HeadersAttach)))
i--
dAtA[i] = 0x12
}
if len(m.ServiceMethod) > 0 {
@@ -758,6 +773,10 @@ func (m *DubboService) Size() (n int) {
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
l = len(m.Group)
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
if len(m.Methods) > 0 {
for _, e := range m.Methods {
l = e.Size()
@@ -780,6 +799,10 @@ func (m *Method) Size() (n int) {
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
l = len(m.HeadersAttach)
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
l = len(m.HttpPath)
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
@@ -790,10 +813,6 @@ func (m *Method) Size() (n int) {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
}
l = len(m.HeadersAttach)
if l > 0 {
n += 1 + l + sovHttp_2Rpc(uint64(l))
}
if len(m.Params) > 0 {
for _, e := range m.Params {
l = e.Size()
@@ -1063,6 +1082,38 @@ func (m *DubboService) Unmarshal(dAtA []byte) error {
m.Version = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttp_2Rpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttp_2Rpc
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthHttp_2Rpc
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Group = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType)
}
@@ -1180,6 +1231,38 @@ func (m *Method) Unmarshal(dAtA []byte) error {
m.ServiceMethod = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field HeadersAttach", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttp_2Rpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttp_2Rpc
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthHttp_2Rpc
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.HeadersAttach = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field HttpPath", wireType)
}
@@ -1211,7 +1294,7 @@ func (m *Method) Unmarshal(dAtA []byte) error {
}
m.HttpPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field HttpMethods", wireType)
}
@@ -1243,38 +1326,6 @@ func (m *Method) Unmarshal(dAtA []byte) error {
}
m.HttpMethods = append(m.HttpMethods, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field HeadersAttach", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttp_2Rpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttp_2Rpc
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthHttp_2Rpc
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.HeadersAttach = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType)

View File

@@ -51,15 +51,16 @@ message Http2Rpc {
message DubboService {
string service = 1 [(google.api.field_behavior) = REQUIRED];
string version = 2 [(google.api.field_behavior) = OPTIONAL];
repeated Method methods = 3 [(google.api.field_behavior) = REQUIRED];
string version = 2 [(google.api.field_behavior) = REQUIRED];
string group = 3 [(google.api.field_behavior) = OPTIONAL];
repeated Method methods = 4 [(google.api.field_behavior) = REQUIRED];
}
message Method {
string service_method = 1 [(google.api.field_behavior) = REQUIRED];
string http_path = 2 [(google.api.field_behavior) = REQUIRED];
repeated string http_methods = 3 [(google.api.field_behavior) = REQUIRED];
string headers_attach = 4;
string headers_attach = 2 [(google.api.field_behavior) = OPTIONAL];
string http_path = 3 [(google.api.field_behavior) = REQUIRED];
repeated string http_methods = 4 [(google.api.field_behavior) = REQUIRED];
repeated Param params = 5;
}

View File

@@ -141,6 +141,8 @@ spec:
properties:
dubbo:
properties:
group:
type: string
methods:
items:
properties:

View File

@@ -1200,11 +1200,7 @@ func (m *IngressConfig) constructHttp2RpcMethods(dubbo *higressv1.DubboService)
"reject_unknown_method": true,
"reject_unknown_query_parameters": true
},
"services_mapping": {
"name": "%s",
"version": "%s",
"method_mapping": %s
},
"services_mapping": %s,
"url_unescape_spec": "ALL_CHARACTERS_EXCEPT_RESERVED"
}
}
@@ -1214,9 +1210,6 @@ func (m *IngressConfig) constructHttp2RpcMethods(dubbo *higressv1.DubboService)
for _, serviceMethod := range dubbo.GetMethods() {
var method = make(map[string]interface{})
method["name"] = serviceMethod.GetServiceMethod()
var passthrough_setting = make(map[string]interface{})
passthrough_setting["passthrough_all_headers"] = true
method["passthrough_setting"] = passthrough_setting
var params []interface{}
for _, methodParam := range serviceMethod.GetParams() {
var param = make(map[string]interface{})
@@ -1230,13 +1223,29 @@ func (m *IngressConfig) constructHttp2RpcMethods(dubbo *higressv1.DubboService)
path_matcher["match_http_method_spec"] = Http2RpcMethodMap()[serviceMethod.HttpMethods[0]]
path_matcher["match_pattern"] = serviceMethod.GetHttpPath()
method["path_matcher"] = path_matcher
var passthrough_setting = make(map[string]interface{})
var headersAttach = serviceMethod.GetHeadersAttach()
if headersAttach == "" {
passthrough_setting["passthrough_all_headers"] = false
} else if headersAttach == "*" {
passthrough_setting["passthrough_all_headers"] = true
} else {
passthrough_setting["passthrough_headers"] = headersAttach
}
method["passthrough_setting"] = passthrough_setting
methods = append(methods, method)
}
name := dubbo.GetService()
version := dubbo.GetVersion()
var serviceMapping = make(map[string]interface{})
var dubboServiceGroup = dubbo.GetGroup()
if dubboServiceGroup != "" {
serviceMapping["group"] = dubboServiceGroup
}
serviceMapping["name"] = dubbo.GetService()
serviceMapping["version"] = dubbo.GetVersion()
serviceMapping["method_mapping"] = methods
strBuffer := new(bytes.Buffer)
methodsJsonStr, _ := json.Marshal(methods)
fmt.Fprintf(strBuffer, httpRouterTemplate, name, version, string(methodsJsonStr))
serviceMappingJsonStr, _ := json.Marshal(serviceMapping)
fmt.Fprintf(strBuffer, httpRouterTemplate, string(serviceMappingJsonStr))
IngressLog.Infof("Found http2rpc buildHttp2RpcMethods %s", strBuffer.String())
result := buildPatchStruct(strBuffer.String())
return result, nil

View File

@@ -323,7 +323,7 @@ apiVersion: v1
kind: Pod
metadata:
name: nacos-standlone-rc3
namespace: higress-system
namespace: higress-conformance-app-backend
labels:
name: nacos-standlone-rc3
spec:
@@ -337,7 +337,7 @@ apiVersion: v1
kind: Service
metadata:
name: nacos-standlone-rc3-service
namespace: higress-system
namespace: higress-conformance-app-backend
spec:
selector:
name: nacos-standlone-rc3
@@ -350,10 +350,15 @@ apiVersion: v1
kind: Pod
metadata:
name: dubbo-demo-provider
namespace: higress-system
namespace: higress-conformance-app-backend
spec:
containers:
- name: dubbo-demo-provider
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/dubbo-provider-demo:0.0.1
image: registry.cn-hangzhou.aliyuncs.com/hinsteny/dubbo-provider-demo:0.0.2
env:
- name: NACOS_K8S_NAMESPACE
value: higress-conformance-app-backend
- name: DUBBO_GROUP
value: dev
ports:
- containerPort: 20880

View File

@@ -35,7 +35,7 @@ var HTTPRouteHttp2Rpc = suite.ConformanceTest{
Request: http.AssertionRequest{
ActualRequest: http.Request{
Host: "foo.com",
Path: "/sayhello?name=hisoka",
Path: "/dubbo/hello?name=higress",
Method: "GET",
},
},

View File

@@ -19,18 +19,18 @@ metadata:
namespace: higress-system
spec:
dubbo:
service: "com.dubbo.demo.api.DemoService"
version: "1.0.0"
service: com.dubbo.demo.api.DemoService
version: 1.0.0
group: dev
methods:
- serviceMethod: "sayHello"
- serviceMethod: sayHello
headersAttach: "*"
httpMethods:
- "GET"
- “POST”
httpPath: "/sayhello"
- GET
httpPath: "/dubbo/hello"
params:
- paramKey: "name"
paramSource: "QUERY"
- paramKey: name
paramSource: QUERY
paramType: "java.lang.String"
---
apiVersion: networking.higress.io/v1
@@ -40,7 +40,7 @@ metadata:
namespace: higress-system
spec:
registries:
- domain: nacos-standlone-rc3-service
- domain: nacos-standlone-rc3-service.higress-conformance-app-backend
nacosGroups:
- DEFAULT_GROUP
name: nacos-service-resource
@@ -51,7 +51,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
higress.io/destination: providers:com.dubbo.demo.api.DemoService:1.0.0:.DEFAULT-GROUP.public.nacos
higress.io/destination: providers:com.dubbo.demo.api.DemoService:1.0.0:dev.DEFAULT-GROUP.public.nacos
higress.io/rpc-destination-name: httproute-http2rpc-demo
name: httproute-http2rpc-demo-ingress
namespace: higress-system
@@ -62,7 +62,7 @@ spec:
http:
paths:
- pathType: Prefix
path: /
path: /dubbo
backend:
resource:
apiGroup: networking.higress.io

View File

@@ -159,6 +159,8 @@ func (suite *ConformanceTestSuite) Setup(t *testing.T) {
"higress-conformance-infra",
"higress-conformance-app-backend",
"higress-conformance-web-backend",
"nacos-standlone-rc3",
"dubbo-demo-provider",
}
kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, namespaces)
}