Skip to content

Commit cfc6f42

Browse files
committed
improve logic for cr check
1 parent a9fe641 commit cfc6f42

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

pkg/psmdb/container.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,6 @@ func containerArgs(ctx context.Context, cr *api.PerconaServerMongoDB, replset *a
197197
"--bind_ip_all",
198198
}
199199

200-
if cr.CompareVersion("1.22.0") < 0 {
201-
args = append(args, "--auth")
202-
}
203-
204-
if replset.Configuration.IsAuthorizationEnabled() {
205-
args = append(args, "--auth")
206-
}
207-
208200
args = append(args,
209201
"--dbpath="+config.MongodContainerDataDir,
210202
"--port="+strconv.Itoa(int(replset.GetPort())),
@@ -213,6 +205,10 @@ func containerArgs(ctx context.Context, cr *api.PerconaServerMongoDB, replset *a
213205
"--relaxPermChecks",
214206
)
215207

208+
if cr.CompareVersion("1.22.0") < 0 || replset.Configuration.IsAuthorizationEnabled() {
209+
args = append(args, "--auth")
210+
}
211+
216212
name, err := replset.CustomReplsetName()
217213
if err == nil {
218214
// Update the replSet argument with the custom name

0 commit comments

Comments
 (0)