-
-
Notifications
You must be signed in to change notification settings - Fork 9
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] Support environment variables #5
Comments
Hey. I would suggest to stick with Kubernetes specification because some people may want to do the following
To do so seamlessly, it requires to be fully compatible with K8S spec. |
Hi @Jasstkn This specifically will not work as expected, because the YAML format is different and much simpler:
But they could do Would you like to add support for environment variables using the |
Ah, yes, you're right! Yep, I would like to implement this feature as well. |
Would be great to have support for this & envFrom. One of my use cases for run-job would be to run Flyway for SQL database migrations, and it would be nice to use envFrom to read from an existing secret. |
@clrxbl what data do you need for your If it's for secrets, we would also need to add secret support. In OpenFaaS we do this by convention. Specify a list of secret names with That makes them quite convenient to read in bash / code. |
I simply use envFrom to read from a single Secret containing environment variables for e.g. database authentication. |
Secret support seems reasonable for connecting to databases/APIs etc.
|
@clrxbl hello. We are in the discussion of what is the best way to implement this feature. Could you tell me what you feel is more convenient for you: the same approach as in the Kubernetes Job manifest or a more compact way with just a bare minimum and all parsing done under the hood? FYI @alexellis |
It would be great to have it use the same approach as in the Kubernetes Job manifest as it allows you to refer to environment variables located in secrets. |
You can take a look how I implemented it in the PR: #7 and also our discussion with @alexellis about possible improvements there: #7 (comment). I'm not sure which one is better. |
Looking at #7 |
Could you give an example of how you think the YAML would look? |
name: checker
image: ghcr.io/openfaas/config-checker:latest
namespace: openfaas
sa: openfaas-checker
env:
- name: "KEY"
value: "value"
envFrom:
- secretRef:
name: "secret-name" |
@alexellis hey. what do you think about the example above? |
Inspired by the Kubernetes spec, support environment variables.
I think run-job should remain as simple as possible, but these are normally required for many kinds of container.
K8s format
I'd be tempted to use the OpenFaaS format, but the K8s style may be easier for people migrating tasks.
By running the
env
built-in shell command inalpine:3.16
, we can see whether the inputs have been received.The text was updated successfully, but these errors were encountered: