build: update kubernetes deployment Run. (#2919)

* build: k8s improve.

* refactor: update docker image contents.

* rename seq file.

* build: update k8s origin deploys.

* update check logic.

* update magefile

* update image name.

* update readme

* update Kubernetes Discovery.

* revert pkg.

* update create in k8s

* update service image release CI.

* update deployment image source.

* update mage contents.

* update pkg source.

* update go get pkg.

* fix test file.

* update discovery register.

* update

* update deploy yaml.

* update replica.

* update deployment.

* remove notfication config.

* remove notification and zookeeper.

* update discovery in kubernetes.

* build: improve kubernetes deployment.

* update config field in discovery.

* update ReadMe in deployments.

* update go mod.

* update const quote.

* fix test fields.

* remove unused method.

* remove unused contents.
This commit is contained in:
Monet Lee
2024-12-13 11:02:45 +08:00
committed by GitHub
parent 1eaae5f980
commit 7c7a99f801
192 changed files with 2520 additions and 7897 deletions
+13 -7
View File
@@ -2,14 +2,19 @@ package push
import (
"context"
"errors"
"sync"
"github.com/openimsdk/protocol/msggateway"
"github.com/openimsdk/protocol/sdkws"
"github.com/openimsdk/tools/discovery"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/log"
"github.com/openimsdk/tools/utils/datautil"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"sync"
conf "github.com/openimsdk/open-im-server/v3/pkg/common/config"
)
type OnlinePusher interface {
@@ -37,15 +42,16 @@ func (u emptyOnlinePusher) GetOnlinePushFailedUserIDs(ctx context.Context, msg *
}
func NewOnlinePusher(disCov discovery.SvcDiscoveryRegistry, config *Config) OnlinePusher {
switch config.Discovery.Enable {
case "k8s":
return NewK8sStaticConsistentHash(disCov, config)
case "zookeeper":
if config.runTimeEnv == conf.KUBERNETES {
return NewDefaultAllNode(disCov, config)
case "etcd":
}
switch config.Discovery.Enable {
case conf.ETCD:
return NewDefaultAllNode(disCov, config)
default:
return newEmptyOnlinePusher()
log.ZError(context.Background(), "NewOnlinePusher is error", errs.Wrap(errors.New("unsupported discovery type")), "type", config.Discovery.Enable)
return nil
}
}
+5
View File
@@ -10,6 +10,7 @@ import (
pbpush "github.com/openimsdk/protocol/push"
"github.com/openimsdk/tools/db/redisutil"
"github.com/openimsdk/tools/discovery"
"github.com/openimsdk/tools/utils/runtimeenv"
"google.golang.org/grpc"
)
@@ -32,6 +33,8 @@ type Config struct {
LocalCacheConfig config.LocalCache
Discovery config.Discovery
FcmConfigPath string
runTimeEnv string
}
func (p pushServer) PushMsg(ctx context.Context, req *pbpush.PushMsgReq) (*pbpush.PushMsgResp, error) {
@@ -48,6 +51,8 @@ func (p pushServer) DelUserPushToken(ctx context.Context,
}
func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryRegistry, server *grpc.Server) error {
config.runTimeEnv = runtimeenv.PrintRuntimeEnvironment()
rdb, err := redisutil.NewRedisClient(ctx, config.RedisConfig.Build())
if err != nil {
return err