Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cluster-manager 支持mongodb配置replicaset(v1.29.x) #3635

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"mongo": {
"address": "${bcsClusterManagerMongoAddress}",
"replicaset": "${bcsClusterManagerMongoReplicaset}",
"connecttimeout": ${bcsClusterManagerMongoConnectTimeout},
"database": "${bcsClusterManagerMongoDatabase}",
"username": "${bcsClusterManagerMongoUsername}",
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/bcs-cluster-manager/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0
github.com/RichardKnop/machinery/v2 v2.0.11
github.com/Tencent/bk-bcs/bcs-common v0.0.0-20240418123107-72b120390195
github.com/Tencent/bk-bcs/bcs-common v0.0.0-20241212064043-5cca411636d5
github.com/Tencent/bk-bcs/bcs-common/common/encryptv2 v0.0.0-20230908045126-c9d09981a9c5
github.com/Tencent/bk-bcs/bcs-services/pkg v0.0.0-20240418123107-72b120390195
github.com/apparentlymart/go-cidr v1.1.0
Expand Down
1 change: 1 addition & 0 deletions bcs-services/bcs-cluster-manager/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func (cm *ClusterManager) initModel() error {
password := cm.opt.Mongo.Password
mongoOptions := &mongo.Options{
Hosts: strings.Split(cm.opt.Mongo.Address, ","),
Replicaset: cm.opt.Mongo.Replicaset,
ConnectTimeoutSeconds: int(cm.opt.Mongo.ConnectTimeout),
Database: cm.opt.Mongo.Database,
Username: cm.opt.Mongo.Username,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type TunnelConfig struct {
// MongoConfig option for mongo
type MongoConfig struct {
Address string `json:"address"`
Replicaset string `json:"replicaset"`
ConnectTimeout uint `json:"connecttimeout"`
Database string `json:"database"`
Username string `json:"username"`
Expand Down
1 change: 1 addition & 0 deletions bcs-services/bcs-cluster-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func main() { // nolint
flag.String("bcslog_backtraceat", "", "when logging hits line file:N, emit a stack trace")
// mongo config
flag.String("mongo_address", "127.0.0.1:27017", "mongo server address")
flag.String("mongo_replicaset", "", "mongo replica set name")
flag.Uint("mongo_connecttimeout", 3, "mongo server connnect timeout")
flag.String("mongo_database", "", "database in mongo for cluster manager")
flag.String("mongo_username", "", "mongo username for cluster manager")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"mongo": {
"address": "${bcsClusterManagerMongoAddress}",
"replicaset": "${bcsClusterManagerMongoReplicaset}",
"connecttimeout": ${bcsClusterManagerMongoConnectTimeout},
"database": "${bcsClusterManagerMongoDatabase}",
"username": "${bcsClusterManagerMongoUsername}",
Expand Down
Loading