Skip to content

Commit

Permalink
[cherry-pick] Set total hosts to 1 during initialization (#1865) (#1876)
Browse files Browse the repository at this point in the history
Signed-off-by: hmsayem <hmsayem@appscode.com>
  • Loading branch information
1gtm committed Jun 19, 2023
1 parent 0b76c04 commit 3078d59
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/backup.go
Expand Up @@ -79,6 +79,7 @@ func NewCmdBackup() *cobra.Command {
masterURL string
kubeconfigPath string
opt = mongoOptions{
totalHosts: 1,
waitTimeout: 300,
setupOptions: restic.SetupOptions{
ScratchDir: restic.DefaultScratchDir,
Expand Down Expand Up @@ -289,8 +290,6 @@ func (opt *mongoOptions) backupMongoDB(targetRef api_v1beta1.TargetRef) (*restic
// 3. For sharded MongoDB, totalHosts=(number of shard + 1) // extra 1 for config server
// So, for stand-alone MongoDB and MongoDB ReplicaSet, we don't have to do anything.
// We only need to update totalHosts field for sharded MongoDB

opt.totalHosts = 1
// For sharded MongoDB, parameter.ConfigServer will not be empty
if parameters.ConfigServer != "" {
opt.totalHosts = len(parameters.ReplicaSets) + 1 // for each shard there will be one key in parameters.ReplicaSet
Expand Down

0 comments on commit 3078d59

Please sign in to comment.