You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2024/06/20 03:48:28 UTC

(dubbo-kubernetes) branch master updated (8b60acc0 -> 9e30b790)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


    from 8b60acc0 Merge pull request #285 from Yan0613/master
     new bac41a38 client update
     new 2c1b6ac5 add new resource
     new e2f5ca50 Merge branch 'master' of https://github.com/apache/dubbo-kubernetes
     new 9e30b790 reformat code

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 api/mesh/v1alpha1/application.proto        | 21 +++++++++++++++++++++
 conf/dubbo-cp.yaml                         |  7 +++++++
 pkg/admin/handler/service.go               |  3 +--
 pkg/admin/model/service.go                 |  8 +++++---
 pkg/admin/model/traffic_configurator.go    |  1 +
 pkg/plugins/resources/traditional/store.go | 27 +++++++++++++++++++++------
 6 files changed, 56 insertions(+), 11 deletions(-)
 create mode 100644 api/mesh/v1alpha1/application.proto


(dubbo-kubernetes) 04/04: reformat code

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git

commit 9e30b7904ea05bb15807a81fe3a1d247c50df555
Author: chickenlj <ke...@gmail.com>
AuthorDate: Thu Jun 20 11:48:06 2024 +0800

    reformat code
---
 pkg/admin/handler/service.go            | 3 +--
 pkg/admin/model/service.go              | 8 +++++---
 pkg/admin/model/traffic_configurator.go | 1 +
 pkg/core/reg_client/client.go           | 1 -
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/pkg/admin/handler/service.go b/pkg/admin/handler/service.go
index 3942f171..b40f0d87 100644
--- a/pkg/admin/handler/service.go
+++ b/pkg/admin/handler/service.go
@@ -30,16 +30,15 @@ import (
 import (
 	mesh_proto "github.com/apache/dubbo-kubernetes/api/mesh/v1alpha1"
 	"github.com/apache/dubbo-kubernetes/pkg/admin/model"
+	"github.com/apache/dubbo-kubernetes/pkg/admin/service"
 	"github.com/apache/dubbo-kubernetes/pkg/core/consts"
 	"github.com/apache/dubbo-kubernetes/pkg/core/resources/apis/mesh"
 	core_store "github.com/apache/dubbo-kubernetes/pkg/core/resources/store"
 	core_runtime "github.com/apache/dubbo-kubernetes/pkg/core/runtime"
-	"github.com/gin-gonic/gin"
 )
 
 // API Definition: https://app.apifox.com/project/3732499
 // 资源详情-服务
-
 // service search
 func SearchServices(rt core_runtime.Runtime) gin.HandlerFunc {
 	return func(c *gin.Context) {
diff --git a/pkg/admin/model/service.go b/pkg/admin/model/service.go
index 197acd1d..e59cf57d 100644
--- a/pkg/admin/model/service.go
+++ b/pkg/admin/model/service.go
@@ -17,12 +17,15 @@
 
 package model
 
+import (
+	"strconv"
+	"strings"
+)
+
 import (
 	"github.com/apache/dubbo-kubernetes/api/mesh/v1alpha1"
 	"github.com/apache/dubbo-kubernetes/pkg/admin/constants"
 	core_mesh "github.com/apache/dubbo-kubernetes/pkg/core/resources/apis/mesh"
-	"strconv"
-	"strings"
 )
 
 type ServiceSearchResp struct {
@@ -118,7 +121,6 @@ func (r *ServiceTabDistributionResp) FromServiceDataplaneResource(dataplane *cor
 	r.mergeMetaData(metadatalist, req)
 
 	return r
-
 }
 
 func (r *ServiceTabDistributionResp) mergeInbound(inbound *v1alpha1.Dataplane_Networking_Inbound, ip string) {
diff --git a/pkg/admin/model/traffic_configurator.go b/pkg/admin/model/traffic_configurator.go
index 4c16127c..cd44a01e 100644
--- a/pkg/admin/model/traffic_configurator.go
+++ b/pkg/admin/model/traffic_configurator.go
@@ -169,6 +169,7 @@ func addressMatchToRespAddressMatch(address *mesh_proto.AddressMatch) *RespAddre
 		return &RespAddressMatch{}
 	}
 }
+
 func paramMatchToRespParamMatch(param []*mesh_proto.ParamMatch) []ParamMatch {
 	res := make([]ParamMatch, 0, len(param))
 	if param != nil {
diff --git a/pkg/core/reg_client/client.go b/pkg/core/reg_client/client.go
index 18ddec2c..265ffd24 100644
--- a/pkg/core/reg_client/client.go
+++ b/pkg/core/reg_client/client.go
@@ -22,5 +22,4 @@ type RegClient interface {
 	SetContent(path string, value []byte) error // 包括创建或者更新的操作
 	GetContent(path string) ([]byte, error)
 	DeleteContent(path string) error // 删除指定路径的内容
-
 }


(dubbo-kubernetes) 03/04: Merge branch 'master' of https://github.com/apache/dubbo-kubernetes

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git

commit e2f5ca5015f4d25c1d9c79eea45ff428539593f8
Merge: 2c1b6ac5 8b60acc0
Author: chickenlj <ke...@gmail.com>
AuthorDate: Thu Jun 20 11:41:17 2024 +0800

    Merge branch 'master' of https://github.com/apache/dubbo-kubernetes

 .github/workflows/ci.yml                           |   37 +-
 .licenserc.yaml                                    |    6 +
 Makefile                                           |   15 +
 api/mesh/v1alpha1/condition_route.pb.go            |  705 ++++-
 api/mesh/v1alpha1/condition_route.proto            |   62 +-
 api/mesh/v1alpha1/condition_route_helper.go        |  283 ++
 api/mesh/v1alpha1/dds.pb.go                        |  102 +-
 api/mesh/v1alpha1/dds.proto                        |    5 -
 api/mesh/v1alpha1/dds_grpc.pb.go                   |  118 -
 api/mesh/v1alpha1/dynamic_config.pb.go             |  125 +-
 api/mesh/v1alpha1/dynamic_config.proto             |    6 +-
 api/mesh/v1alpha1/dynamic_config_helper.go         |   44 +
 api/mesh/v1alpha1/mapping.pb.go                    |  417 +--
 api/mesh/v1alpha1/mapping.proto                    |   41 -
 api/mesh/v1alpha1/mapping_grpc.pb.go               |  192 --
 api/mesh/v1alpha1/mds.pb.go                        |  806 ++++++
 api/mesh/v1alpha1/{mapping.proto => mds.proto}     |   48 +-
 api/mesh/v1alpha1/mds_grpc.pb.go                   |  295 +++
 api/mesh/v1alpha1/metadata.pb.go                   |  489 +---
 api/mesh/v1alpha1/metadata.proto                   |   32 -
 api/mesh/v1alpha1/metadata_grpc.pb.go              |  173 --
 api/mesh/v1alpha1/tag_route.pb.go                  |   64 +-
 api/mesh/v1alpha1/tag_route.proto                  |    3 +
 ...{dynamic_config_helper.go => tag_route_help.go} |   49 +-
 app/dubbo-cp/cmd/run.go                            |   27 +-
 app/dubboctl/cmd/proxy.go                          |    1 -
 app/dubboctl/cmd/proxy_test.go                     |  271 --
 app/dubboctl/internal/docker/creds/credentials.go  |   42 +-
 app/dubboctl/internal/dubbo/templates_embedded.go  |    1 +
 app/dubboctl/internal/kube/client_test.go          |  256 --
 app/dubboctl/internal/kube/component_test.go       |  154 --
 conf/dubbo-cp.yaml                                 |    2 +-
 deploy/charts/admin/Chart.yaml                     |   12 +-
 deploy/kubernetes/prometheus.yaml                  |  735 +++++-
 generate/templates/main.go                         |   11 +-
 generate/zz_filesystem_generated.go                | 2768 ++++++++++++++++----
 go.mod                                             |    2 +-
 mk/check.mk                                        |    5 +-
 mk/generate.mk                                     |   12 +-
 pkg/admin/constants/constants.go                   |    5 +
 pkg/admin/handler/application.go                   |  415 ++-
 pkg/admin/handler/instance.go                      |  292 ++-
 pkg/admin/handler/overview.go                      |    7 +-
 pkg/admin/handler/search.go                        |   17 +-
 pkg/admin/handler/service.go                       |  456 +++-
 pkg/admin/handler/service_testing.go               |    2 +
 pkg/admin/handler/service_testing_impl.go          |    5 +-
 pkg/admin/handler/traffic_condition_rule.go        |  303 +++
 pkg/admin/handler/traffic_configurator.go          |  200 ++
 pkg/admin/handler/traffic_tag_rule.go              |  205 ++
 pkg/admin/model/application.go                     |   68 +-
 pkg/admin/model/instance.go                        |   26 +-
 pkg/admin/model/service.go                         |  161 ++
 pkg/admin/model/testing.go                         |   17 +
 pkg/admin/model/traffic_condition_rule.go          |  303 +++
 pkg/admin/model/traffic_configurator.go            |  236 ++
 pkg/admin/model/traffic_tag_rule.go                |   93 +
 pkg/admin/server/router.go                         |   77 +-
 pkg/admin/server/server.go                         |    8 +-
 pkg/admin/service/application.go                   |   21 +-
 pkg/admin/service/instance.go                      |   12 +-
 pkg/admin/service/service.go                       |  122 +
 pkg/admin/util/reflection/reflection.go            |    5 +
 pkg/admin/util/reflection/reflection_test.go       |  592 -----
 pkg/admin/util/reflection/testdata/api/server.go   |  119 -
 .../util/reflection/testdata/proto/greet.pb.go     |  616 -----
 .../util/reflection/testdata/proto/greet.proto     |   44 -
 .../testdata/proto/grpc_gen/greet_grpc.pb.go       |  315 ---
 .../proto/triple_gen/greettriple/greet.triple.go   |  376 ---
 pkg/config/plugins/runtime/k8s/config.go           |    5 -
 .../xds/bootstrap/types/bootstrap_request.go       |   17 +
 pkg/core/consts/const.go                           |   15 +
 pkg/core/dns/lookup/cache.go                       |   17 +
 pkg/core/dns/lookup/cache_suite_test.go            |   17 +
 pkg/core/dns/lookup/cache_test.go                  |   17 +
 pkg/core/dns/lookup/interface.go                   |   17 +
 pkg/core/governance/governance_config.go           |   21 +
 pkg/core/governance/governance_config_mock.go      |    8 +
 pkg/core/logger/log.go                             |    2 +
 .../managers/apis/dataplane/dataplane_manager.go   |   15 +-
 pkg/core/registry/mapping.go                       |   17 +-
 pkg/core/registry/metadata_instance.go             |    3 +
 pkg/core/registry/registry.go                      |    4 +-
 pkg/core/resources/manager/manager_test.go         |    4 +-
 pkg/core/resources/model/resource.go               |    7 -
 pkg/core/user/context.go                           |   17 +
 pkg/core/user/user.go                              |   17 +
 pkg/core/xds/sockets.go                            |   17 +
 pkg/dubbo/servicemapping/register_request.go       |   58 -
 pkg/dubbo/servicemapping/resource_meta.go          |   65 -
 pkg/dubbo/servicemapping/server.go                 |  432 ---
 pkg/{dubbo => mds}/client/stream.go                |    4 +-
 pkg/{dubbo => mds}/client/sync_client.go           |    0
 pkg/{dubbo => mds}/components.go                   |   33 +-
 pkg/{dubbo => mds}/pusher/interface.go             |    0
 pkg/{dubbo => mds}/pusher/pushed_items.go          |    0
 pkg/{dubbo => mds}/pusher/pusher.go                |    0
 .../pusher/resource_changed_callbacks.go           |    0
 pkg/{dubbo => mds}/pusher/revision.go              |    0
 pkg/mds/server/debounce.go                         |   86 +
 pkg/mds/server/register_request.go                 |  205 ++
 .../metadata => mds/server}/resource_meta.go       |    2 +-
 pkg/{dubbo/metadata => mds/server}/server.go       |  400 +--
 pkg/plugins/resources/k8s/store.go                 |  137 +-
 pkg/plugins/resources/k8s/store_test.go            |   64 +
 pkg/plugins/resources/k8s/util/bitset.go           |   72 +
 .../resources/k8s/util/bitset_test.go}             |   61 +-
 pkg/plugins/resources/traditional/store.go         |  213 +-
 pkg/plugins/resources/traditional/utils.go         |   21 +
 pkg/plugins/runtime/k8s/plugin.go                  |   21 +
 pkg/proxy/cgroups/cgroups.go                       |   17 +
 pkg/util/concurrent/debouncer.go                   |   96 +
 pkg/util/maps/sorted_keys_test.go                  |   17 +
 pkg/util/os/limits_test.go                         |   17 +
 pkg/util/protocol/protocol.go                      |   17 +
 pkg/util/sets/set.go                               |  297 +++
 pkg/util/sets/set_test.go                          |  392 +++
 pkg/util/slices/slices.go                          |  315 +++
 pkg/util/slices/slices_test.go                     |  916 +++++++
 pkg/xds/bootstrap/generator.go                     |   17 +
 pkg/xds/context/aggregate_mesh_context.go          |   17 +
 pkg/xds/envoy/imports.go                           |   17 +
 pkg/xds/envoy/types.go                             |    2 -
 pkg/xds/generator/zoneproxy/destinations.go        |   17 +
 pkg/xds/generator/zoneproxy/generator.go           |   17 +
 pkg/xds/ingress/dataplane.go                       |   17 +
 pkg/xds/ingress/outbound.go                        |   17 +
 pkg/xds/ingress/router.go                          |   17 +
 templates/go/common/api/api.proto                  |   10 +-
 templates/go/common/go.mod                         |  120 +-
 templates/go/common/go.sum                         |  179 ++
 test/control-plane/cp.yaml                         |   35 +-
 tools/dds-client/main.go                           |  180 ++
 tools/dds-client/stream/client.go                  |  181 ++
 134 files changed, 12542 insertions(+), 6030 deletions(-)

diff --cc conf/dubbo-cp.yaml
index 74d0f92d,91f90f25..89f188f9
--- a/conf/dubbo-cp.yaml
+++ b/conf/dubbo-cp.yaml
@@@ -14,16 -14,9 +14,16 @@@
  # limitations under the License.
  
  # 可选 k8s half universal
- deploy_mode: universal
+ deploy_mode: k8s
  #mode: test
  mode: zone
 +#store:
 +#  traditional:
 +#    config_center: nacos://localhost:8848
 +#    registry:
 +#      address: nacos://localhost:8848
 +#    metadata_report:
 +#      address: nacos://localhost:8848
  #multizone:
  #  zone:
  #    globalAddress: grpc://127.0.0.1:5685


(dubbo-kubernetes) 01/04: client update

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git

commit bac41a380cca464db2b32686e080d07ba20c6fa6
Author: chickenlj <ke...@gmail.com>
AuthorDate: Sat May 25 15:02:05 2024 +0800

    client update
---
 conf/dubbo-cp.yaml                         |  7 +++++++
 pkg/core/reg_client/client.go              |  1 +
 pkg/plugins/resources/traditional/store.go | 27 +++++++++++++++++++++------
 3 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/conf/dubbo-cp.yaml b/conf/dubbo-cp.yaml
index af59e7a2..74d0f92d 100644
--- a/conf/dubbo-cp.yaml
+++ b/conf/dubbo-cp.yaml
@@ -17,6 +17,13 @@
 deploy_mode: universal
 #mode: test
 mode: zone
+#store:
+#  traditional:
+#    config_center: nacos://localhost:8848
+#    registry:
+#      address: nacos://localhost:8848
+#    metadata_report:
+#      address: nacos://localhost:8848
 #multizone:
 #  zone:
 #    globalAddress: grpc://127.0.0.1:5685
diff --git a/pkg/core/reg_client/client.go b/pkg/core/reg_client/client.go
index 265ffd24..18ddec2c 100644
--- a/pkg/core/reg_client/client.go
+++ b/pkg/core/reg_client/client.go
@@ -22,4 +22,5 @@ type RegClient interface {
 	SetContent(path string, value []byte) error // 包括创建或者更新的操作
 	GetContent(path string) ([]byte, error)
 	DeleteContent(path string) error // 删除指定路径的内容
+
 }
diff --git a/pkg/plugins/resources/traditional/store.go b/pkg/plugins/resources/traditional/store.go
index 91f04f73..da8efa74 100644
--- a/pkg/plugins/resources/traditional/store.go
+++ b/pkg/plugins/resources/traditional/store.go
@@ -20,6 +20,7 @@ package traditional
 import (
 	"context"
 	"fmt"
+	"strings"
 	"sync"
 )
 
@@ -752,11 +753,8 @@ func (c *traditionalStore) List(_ context.Context, resources core_model.Resource
 		c.dCache.Range(func(key, value any) bool {
 			item := resources.NewItem()
 			r := value.(core_model.Resource)
-			item.SetMeta(&resourceMetaObject{
-				Name: key.(string),
-			})
-			err := item.SetSpec(r.GetSpec())
-			if err != nil {
+			match, err := c.copyResource(key, item, r, opts)
+			if err != nil || !match {
 				return false
 			}
 			if err := resources.AddItem(item); err != nil {
@@ -803,6 +801,9 @@ func (c *traditionalStore) List(_ context.Context, resources core_model.Resource
 			return err
 		}
 		for _, app := range appNames {
+			if opts.NameContains != "" && !strings.Contains(app, opts.NameContains) {
+				return nil
+			}
 			// 2. 获取到该应用名下所有的revision
 			path := getMetadataPath(app)
 			revisions, err := c.regClient.GetChildren(path)
@@ -817,7 +818,8 @@ func (c *traditionalStore) List(_ context.Context, resources core_model.Resource
 				id := dubbo_identifier.NewSubscriberMetadataIdentifier(app, revision)
 				appMetadata, err := c.metadataReport.GetAppMetadata(id)
 				if err != nil {
-					return err
+					log.Error(nil, "Err loading app metadata with id %s", id)
+					continue
 				}
 				item := resources.NewItem()
 				metaData := item.GetSpec().(*mesh_proto.MetaData)
@@ -880,3 +882,16 @@ func (c *traditionalStore) List(_ context.Context, resources core_model.Resource
 	}
 	return nil
 }
+
+// copyResource, todo is copy necessary since they are of the same type?
+func (c *traditionalStore) copyResource(key any, dst core_model.Resource, src core_model.Resource, opts *store.ListOptions) (bool, error) {
+	name := opts.NameContains
+
+	if name != "" && !strings.Contains(key.(string), name) {
+		return false, nil
+	}
+
+	dst.SetMeta(src.GetMeta())
+	err := dst.SetSpec(src.GetSpec())
+	return true, err
+}


(dubbo-kubernetes) 02/04: add new resource

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git

commit 2c1b6ac5e12083adb0e97b582a5720023b74490e
Author: chickenlj <ke...@gmail.com>
AuthorDate: Sat May 25 15:02:18 2024 +0800

    add new resource
---
 api/mesh/v1alpha1/application.proto | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/api/mesh/v1alpha1/application.proto b/api/mesh/v1alpha1/application.proto
new file mode 100644
index 00000000..675ec562
--- /dev/null
+++ b/api/mesh/v1alpha1/application.proto
@@ -0,0 +1,21 @@
+syntax = "proto3";
+
+package dubbo.mesh.v1alpha1;
+
+option go_package = "github.com/apache/dubbo-kubernetes/api/mesh/v1alpha1";
+
+import "api/mesh/options.proto";
+
+message Application {
+  option (dubbo.mesh.resource).name = "ApplicationResource";
+  option (dubbo.mesh.resource).type = "Application";
+  option (dubbo.mesh.resource).package = "mesh";
+  option (dubbo.mesh.resource).dds.send_to_zone = false;
+  option (dubbo.mesh.resource).ws.name = "application";
+  option (dubbo.mesh.resource).ws.plural = "applications";
+  option (dubbo.mesh.resource).allow_to_inspect = true;
+
+  string name = 1;
+  repeated string services = 2;
+  repeated string instances = 3;
+}