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] Make it possible to inject kubernetes secrets into the locust worker pods #149

Open
pmacik opened this issue Nov 8, 2023 · 3 comments
Labels
Feature request Something should be improved Good First Issue Good for newcomers Pending Feedback

Comments

@pmacik
Copy link

pmacik commented Nov 8, 2023

Is your feature request related to a problem? Please describe.
I'd like to have secrets (such as tokens) available in the locust files to be used in the API calls

Describe the solution you'd like
The idea here is to create a Secret with the tokens in the locust namespace and point the LocustTest to that Secret (similarly as the locust file is mounted from ConfigMap. The controller would then mount the Secret to the worker pods (either as env variables or as a files) and the locust files executed by the workers would then be able to get those tokens from env variables (or by reading the mounted files).

Describe alternatives you've considered
Currently, I need to hard-code the tokens into the locust file directly.

Additional context
n/a

@pmacik pmacik changed the title [Feature request] Make it possible to inject kubernetes secrets (as env variables) into the locust worker pods [Feature request] Make it possible to inject kubernetes secrets into the locust worker pods Nov 8, 2023
@AbdelrhmanHamouda
Copy link
Owner

Hello @pmacik,
Thank you for proposing this feature. I for one think that it makes perfect sense that we include something like that. In the description you mention that the secret to be available as environment variable or as a file. I'm wondering if you have a specific requirement in your use case to have it both ways or supporting environment variables can be enough for example?

This question help me size the request properly since I also have been thinking about fully supporting environment variables injection and that can have multiple sources, secrets are one of them.

Also, one last question here to help me size the effort, would you be willing to contribute some of this work needed to secure the feature (it is okay if you wont/can't)?

@AbdelrhmanHamouda AbdelrhmanHamouda added Enhancement New feature or request Good First Issue Good for newcomers Pending Feedback Feature request Something should be improved and removed Enhancement New feature or request labels Nov 13, 2023
@PaulRudin
Copy link

I think more generally it would be useful to allow arbitrary additions/override of the pod spec for the workers and master. That's much more flexible and would address this and all sorts of other things people might reasonably want.

The nitty gritty of the details need to be decided - but one very reasonable approach would be to merge according to do a json merge patch as per: https://datatracker.ietf.org/doc/html/rfc7396.

@treenerd
Copy link

Hello,

I like use external-secrets operator and vault to manage secrets.
So in my case I tend use Environment variables inside the container and the locust files read the environment variables with standard python libraries.
web_ui_auth

If the operator would support to create environment variables from secrets, this would be helpful.
With GitOPS workflows and the useage of tools like ArgoCD, I prefer to avoid to have credentials in configmaps.
I like how this is implemented in cloudnative-pg to give an example.

 managed:
    users:
    - name: loadtest-user1
      ensure: present
      passwordSecret:
        name: loadtest-user1

Just my thoughts on this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Something should be improved Good First Issue Good for newcomers Pending Feedback
Projects
None yet
Development

No branches or pull requests

4 participants