Skip to content

Commit

Permalink
Set total hosts to 1 during initialization (#1865)
Browse files Browse the repository at this point in the history
/cherry-pick

Signed-off-by: hmsayem <hmsayem@appscode.com>
  • Loading branch information
hmsayem authored and 1gtm committed Jun 19, 2023
1 parent 7847d4c commit c883c67
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/backup.go
Original file line number Diff line number Diff line change
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 c883c67

Please sign in to comment.