feat: proxy mode support multiple cluster (#677)

* feat: proxy mode support multiple cluster

* feat: ut

* feat: update readme

* feat: ut

* refactor: rename

* refactor: update service
This commit is contained in:
naison
2025-07-27 21:22:08 +08:00
committed by GitHub
parent 38584da9d3
commit 05905bb8ba
41 changed files with 3632 additions and 2708 deletions

View File

@@ -518,15 +518,13 @@ func checkConnectStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: namespace,
Status: "connected",
ProxyList: nil,
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -542,15 +540,13 @@ func centerCheckConnectStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: "default",
Status: "connected",
ProxyList: nil,
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -561,8 +557,10 @@ func centerCheckConnectStatus(t *testing.T) {
}
type status struct {
ID int32
Mode string
List []*connection
}
type connection struct {
Namespace string
Status string
ProxyList []*proxy
@@ -585,9 +583,7 @@ func checkProxyStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: namespace,
Status: "connected",
ProxyList: []*proxy{{
@@ -599,9 +595,9 @@ func checkProxyStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 9080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -618,9 +614,7 @@ func centerCheckProxyStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: "default",
Status: "connected",
ProxyList: []*proxy{{
@@ -632,9 +626,9 @@ func centerCheckProxyStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 9080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -651,9 +645,7 @@ func checkProxyWithServiceMeshStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: namespace,
Status: "connected",
ProxyList: []*proxy{{
@@ -665,9 +657,9 @@ func checkProxyWithServiceMeshStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 9080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -684,9 +676,7 @@ func centerCheckProxyWithServiceMeshStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: "default",
Status: "connected",
ProxyList: []*proxy{{
@@ -698,9 +688,9 @@ func centerCheckProxyWithServiceMeshStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 9080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -717,9 +707,7 @@ func checkProxyWithServiceMeshAndGvisorStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: namespace,
Status: "connected",
ProxyList: []*proxy{{
@@ -731,9 +719,9 @@ func checkProxyWithServiceMeshAndGvisorStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 9080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}
@@ -757,9 +745,7 @@ func centerCheckProxyWithServiceMeshAndGvisorStatus(t *testing.T) {
t.Fatal(err)
}
expect := []*status{{
ID: 0,
Mode: "full",
expect := status{List: []*connection{{
Namespace: "default",
Status: "connected",
ProxyList: []*proxy{{
@@ -771,9 +757,9 @@ func centerCheckProxyWithServiceMeshAndGvisorStatus(t *testing.T) {
PortMap: map[int32]int32{9080: 8080},
}},
}},
}}
}}}
var statuses []*status
var statuses status
if err = json.Unmarshal(output, &statuses); err != nil {
t.Fatal(err)
}