Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Random password when spec.users.passwordSecretRef is not provided? #1323

Open
tamis-laan opened this issue Jul 4, 2023 · 7 comments

Comments

@tamis-laan
Copy link

It would be nice if the operator by default could generate a random secure password for a user when no secret is provided (spec.users.passwordSecretRef).

It would also be nice if one could specify a list of namespaces in which these secrets will be copied as secrets can only be referenced within namespaces, something like spec.users.secretNamespaces.

@benruland
Copy link

We are also looking for the functionality to have to Operator create a random password!

When using Argo CD for rollout of a MongoDB as part of a Helm chart it is otherwise hard to create a random password as part of rollout (without using Secret Management tools), because Argo CD does not support Helm lookup yet.

@siegenthalerroger
Copy link

The second feature in the list is honestly more interesting to us, though auto-generation would just be better aswell.

@tamis-laan
Copy link
Author

We are also looking for the functionality to have to Operator create a random password!

When using Argo CD for rollout of a MongoDB as part of a Helm chart it is otherwise hard to create a random password as part of rollout (without using Secret Management tools), because Argo CD does not support Helm lookup yet.

@benruland I'm using the following to generate a random secret:
https://github.com/mittwald/kubernetes-secret-generator

@benruland
Copy link

benruland commented Aug 5, 2023

@benruland I'm using the following to generate a random secret: https://github.com/mittwald/kubernetes-secret-generator

Good idea, @tamis-laan! Just realized that ExternalSecrets Operator (which we already use) can also create random secrets: https://external-secrets.io/main/api/generator/password/

So this is another workaround.

@laurivosandi
Copy link

In any case the MongoDBCommunity CRD should stay imho in Pending state until secret is created. Without secret it ends in terminal Failed state

@SGStino
Copy link

SGStino commented Aug 14, 2023

@benruland I'm using the following to generate a random secret: https://github.com/mittwald/kubernetes-secret-generator

Good idea, @tamis-laan! Just realized that ExternalSecrets Operator (which we already use) can also create random secrets: https://external-secrets.io/main/api/generator/password/

So this is another workaround.

For those not using the ExternalSecrets operator, and using the mittwalt one ..

Just be carefull on larger clusters, the operator might watch all secrets, including helm charts with all versions values, which might be a considerable load on the kubernetes API.

@marcolongol
Copy link

marcolongol commented Apr 11, 2024

IMHO, in order to "enable" the generated secrets to be copied to additional namespaces, simply enabling additional secret annotations in the CRD or inheriting annotations from the CRD/StatefulSet would be enough, that way either reflector or replicator could be used to copy the generated secrets to the additional target namespaces, this would be useful not only for the randomly generated passwordSecretRef but also for the generated connectionStringSecretName.

I'm happy to help with a PR if someone likes the idea and briefs me through the files needing to be modified😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants