Skip to content

Commit

Permalink
fix mongos
Browse files Browse the repository at this point in the history
  • Loading branch information
pooknull committed Sep 26, 2024
1 parent 734662e commit cf4e799
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions pkg/psmdb/mongos.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,30 +245,25 @@ func mongosContainerArgs(cr *api.PerconaServerMongoDB, useConfigFile bool, cfgIn
"mongos",
"--bind_ip_all",
"--port=" + strconv.Itoa(int(msSpec.Port)),
"--sslAllowInvalidCertificates",
"--configdb",
configDB,
}
if cr.CompareVersion("1.7.0") >= 0 {
args = append(args,
"--relaxPermChecks",
)
if !cr.TLSEnabled() || *cr.Spec.TLS.AllowInvalidCertificates {
args = append(args, "--sslAllowInvalidCertificates")
}
args = append(args, []string{
"--configdb",
configDB,
"--relaxPermChecks",
}...)

if cr.TLSEnabled() {
if !*cr.Spec.TLS.AllowInvalidCertificates {
// remove --sslAllowInvalidCertificates
args = append(args[:3], args[3+1:]...)
}

args = append(args,
"--clusterAuthMode=x509",
)
} else if (cr.CompareVersion("1.16.0") >= 0 && cr.Spec.Unsafe.TLS) || (cr.CompareVersion("1.16.0") < 0 && cr.Spec.UnsafeConf) {
if (cr.TLSEnabled() && cr.Spec.TLS.Mode == api.TLSModeAllow) || cr.UnsafeTLSDisabled() || cr.Spec.Secrets.InternalKey != "" {
args = append(args,
"--clusterAuthMode=keyFile",
"--keyFile="+mongodSecretsDir+"/mongodb-key",
)
} else if cr.TLSEnabled() {
args = append(args,
"--clusterAuthMode=x509",
)
}

if cr.CompareVersion("1.16.0") >= 0 {
Expand Down

0 comments on commit cf4e799

Please sign in to comment.