Compare commits
1 Commits
bootstrap/
...
registry/v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3d17b9d34 |
@@ -1,9 +1,9 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
|
||||
consulClient "github.com/hashicorp/consul/api"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
@@ -11,6 +11,10 @@ import (
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Consul
|
||||
func NewRegistry(c *conf.Registry) *consulKratos.Registry {
|
||||
if c == nil || c.Consul == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := consulClient.DefaultConfig()
|
||||
cfg.Address = c.Consul.GetAddress()
|
||||
cfg.Scheme = c.Consul.GetScheme()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package etcd
|
||||
|
||||
import (
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/registry/etcd/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/registry/etcd/v2"
|
||||
etcdClient "go.etcd.io/etcd/client/v3"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
@@ -11,6 +11,10 @@ import (
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Etcd
|
||||
func NewRegistry(c *conf.Registry) *etcdKratos.Registry {
|
||||
if c == nil || c.Etcd == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := etcdClient.Config{
|
||||
Endpoints: c.Etcd.Endpoints,
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
package eureka
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
eurekaKratos "github.com/go-kratos/kratos/contrib/registry/eureka/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Eureka
|
||||
func NewRegistry(c *conf.Registry) *eurekaKratos.Registry {
|
||||
if c == nil || c.Eureka == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var opts []eurekaKratos.Option
|
||||
opts = append(opts, eurekaKratos.WithHeartbeat(c.Eureka.HeartbeatInterval.AsDuration()))
|
||||
opts = append(opts, eurekaKratos.WithRefresh(c.Eureka.RefreshInterval.AsDuration()))
|
||||
|
||||
@@ -3,9 +3,9 @@ package kubernetes
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
k8sRegistry "github.com/go-kratos/kratos/contrib/registry/kubernetes/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
k8sRegistry "github.com/go-kratos/kratos/contrib/registry/kubernetes/v2"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
k8sRest "k8s.io/client-go/rest"
|
||||
k8sTools "k8s.io/client-go/tools/clientcmd"
|
||||
@@ -15,7 +15,11 @@ import (
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Kubernetes
|
||||
func NewRegistry(_ *conf.Registry) *k8sRegistry.Registry {
|
||||
func NewRegistry(cfg *conf.Registry) *k8sRegistry.Registry {
|
||||
if cfg == nil || cfg.Kubernetes == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
restConfig, err := k8sRest.InClusterConfig()
|
||||
if err != nil {
|
||||
home := k8sUtil.HomeDir()
|
||||
@@ -33,7 +37,8 @@ func NewRegistry(_ *conf.Registry) *k8sRegistry.Registry {
|
||||
return nil
|
||||
}
|
||||
|
||||
reg := k8sRegistry.NewRegistry(clientSet)
|
||||
var namespace string
|
||||
reg := k8sRegistry.NewRegistry(clientSet, namespace)
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package nacos
|
||||
|
||||
import (
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/registry/nacos/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/registry/nacos/v2"
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
|
||||
@@ -13,6 +13,10 @@ import (
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Nacos
|
||||
func NewRegistry(c *conf.Registry) *nacosKratos.Registry {
|
||||
if c == nil || c.Nacos == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
srvConf := []nacosConstant.ServerConfig{
|
||||
*nacosConstant.NewServerConfig(c.Nacos.Address, c.Nacos.Port),
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package polaris
|
||||
|
||||
import (
|
||||
polarisKratos "github.com/go-kratos/kratos/contrib/registry/polaris/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
polarisKratos "github.com/go-kratos/kratos/contrib/registry/polaris/v2"
|
||||
|
||||
polarisApi "github.com/polarismesh/polaris-go"
|
||||
polarisApi "github.com/polarismesh/polaris-go/api"
|
||||
polarisModel "github.com/polarismesh/polaris-go/pkg/model"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
@@ -13,6 +12,10 @@ import (
|
||||
|
||||
// NewPolarisRegistry 创建一个注册发现客户端 - Polaris
|
||||
func NewPolarisRegistry(c *conf.Registry) *polarisKratos.Registry {
|
||||
if c == nil || c.Polaris == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
var consumer polarisApi.ConsumerAPI
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package servicecomb
|
||||
|
||||
import (
|
||||
servicecombKratos "github.com/go-kratos/kratos/contrib/registry/servicecomb/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
servicecombClient "github.com/go-chassis/sc-client"
|
||||
servicecombKratos "github.com/go-kratos/kratos/contrib/registry/servicecomb/v2"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Servicecomb
|
||||
func NewRegistry(c *conf.Registry) *servicecombKratos.Registry {
|
||||
if c == nil || c.Servicecomb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := servicecombClient.Options{
|
||||
Endpoints: c.Servicecomb.Endpoints,
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package zookeeper
|
||||
|
||||
import (
|
||||
zookeeperKratos "github.com/go-kratos/kratos/contrib/registry/zookeeper/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
zookeeperKratos "github.com/go-kratos/kratos/contrib/registry/zookeeper/v2"
|
||||
"github.com/go-zookeeper/zk"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
@@ -11,6 +11,10 @@ import (
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - ZooKeeper
|
||||
func NewRegistry(c *conf.Registry) *zookeeperKratos.Registry {
|
||||
if c == nil || c.Zookeeper == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
conn, _, err := zk.Connect(c.Zookeeper.Endpoints, c.Zookeeper.Timeout.AsDuration())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
4
tag.bat
4
tag.bat
@@ -4,7 +4,7 @@ git tag utils/v0.1.0 --force
|
||||
|
||||
git tag cache/redis/v0.0.5 --force
|
||||
git tag oss/minio/v0.0.5 --force
|
||||
git tag registry/v0.0.5 --force
|
||||
git tag registry/v0.0.6 --force
|
||||
git tag config/v0.0.5 --force
|
||||
git tag logger/v0.0.6 --force
|
||||
git tag rpc/v0.0.5 --force
|
||||
@@ -17,7 +17,7 @@ git tag database/influxdb/v0.0.1 --force
|
||||
git tag database/cassandra/v0.0.1 --force
|
||||
git tag database/clickhouse/v0.0.2 --force
|
||||
|
||||
git tag bootstrap/v0.0.7 --force
|
||||
git tag bootstrap/v0.0.8 --force
|
||||
|
||||
git tag v0.5.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user