There should be an option to run a MongoDB instance without authentication (I-know-what-I-am-doing kind of opt-in) to accomodate existing workflows e.g. in testing environments. The simplest way to do it would be to replace --auth with --transitionToAuth in the StatefulSet definition when some parameter is set on the CRD.
I have been able to workaround like this:
apiVersion: kubedb.com/v1alpha1
kind: MongoDB
metadata:
name: test-mongodb
spec:
version: "3.6-v1"
replicas: 3
replicaSet:
name: test
podTemplate:
spec:
args:
- --transitionToAuth
storage:
[...]
It results in both --auth and --transitionToAuth being on the command line, which doesn't seem to bother mongod, while it accepts the latest argument, which is --transitionToAuth, as intended.
Feel free to close the ticket since we now have a workaround. An actual implementation might make sense, but that's not for me to decide.
Adding my two cents here: this will work only with replica set. Trying this on single node will lead to this error: BadValue: --transitionToAuth must be used with keyFile or x509 authentication
Most helpful comment
I have been able to workaround like this:
It results in both
--authand--transitionToAuthbeing on the command line, which doesn't seem to bothermongod, while it accepts the latest argument, which is--transitionToAuth, as intended.Feel free to close the ticket since we now have a workaround. An actual implementation might make sense, but that's not for me to decide.