-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Using a service variable to create another environment variable #1331
Comments
It would be nice if the environment variables could be interpolated to inject kubernetes variables into the definition |
+1, I was attempting to do this the other day as well. |
The downside, of course, is that we need to escape-encode things that want On Tue, Sep 16, 2014 at 10:10 AM, Rob Szumski notifications@github.com
|
This is exactly what pod -> service portal bindings should solve - pod adapts Kube concept (services) to image (env var form) rather than force images to adapt Kube / Docker / Foo conventions. Also applies to downward facing API in #386 |
There's the case of "I want to take some piece of information known by the Maybe we want a config block that is "interpretted env vars". "interpEnv": [ On Tue, Sep 16, 2014 at 9:42 PM, Clayton Coleman notifications@github.com
|
Is there any workaround for this presently? the docker image I'm running expects to receive external host/port information as a command line flag : --host=myhost.com --port=mytcp port |
Maybe I don't understand. The image expects you to run it with CMD=["something", "--host="]. You have a service running, so you have SERVICE_HOST Why can't you do command = ["sh", "-c", "something --host=$SERVICE_HOST ? On Thu, Sep 18, 2014 at 10:50 AM, Brian Ketelsen notifications@github.com
|
That's exactly the workaround i was looking for! 👍 |
I agree this seems like it should be a very basic feature. Docker allows environment variables to be set at runtime that certain applications would depend on (or use default values). I'm not sure the original provided example makes sense as Perhaps this example might be more clear and demonstrates environment variables specific to the application and utilizing kubernetes aware environment variable substitution: Say I have an application that depends on some external application not running within the kubernetes domain.
|
Nope, you can't set that in the The issue is about reusing existing images that make use of environment variables, without needing to create kubernetes specific images, which is the workaround I had to do. |
Yeah sorry, I meant doing the expansion within the container context for that specific one you are talking about. |
Cody, I understand the use case to define env vars in terms of other env instead of running command = [ "foo" ], run command = [ "sh", "-c", It's not pretty, but it works. Someone should file an issue on this, though - I don't think there is one, On Fri, Sep 19, 2014 at 6:08 AM, Cody Lee notifications@github.com wrote:
|
Issue created: #1382 |
Looks like it works now ! It is documented here http://jeffmendoza.github.io/kubernetes/v1.1/docs/design/expansion.html I was able to pass the following env to a container:
It is important to use the syntax with rounded parenthesis |
Needs to be better documented. I'll file a website issue. https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/expansion.md |
This is fantastic, I would like to note that this isn't working when the environment comes from the |
Can you post a repro?
…On Wed, Sep 26, 2018 at 12:00 PM Gorka Lerchundi Osa < ***@***.***> wrote:
This is fantastic, I would like to note that this isn't working when the
environment comes from the envFrom statement no matter if it is a
ConfigMap or Secret key.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1331 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFVgVKezr_ArBORIK33Acgx0NUfDe31jks5ue86vgaJpZM4Cimsv>
.
|
Will try to make a full example ASAP, dont have time ATM, in the meantime
you can take a look to the issue i raised minutes ago and xrederenced with
this issue.
…On Wed, 26 Sep 2018 at 23:25, Tim Hockin ***@***.***> wrote:
Can you post a repro?
On Wed, Sep 26, 2018 at 12:00 PM Gorka Lerchundi Osa <
***@***.***> wrote:
> This is fantastic, I would like to note that this isn't working when the
> environment comes from the envFrom statement no matter if it is a
> ConfigMap or Secret key.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#1331 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AFVgVKezr_ArBORIK33Acgx0NUfDe31jks5ue86vgaJpZM4Cimsv
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1331 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACIPljuDpJ8NbsJ2qLcrGR-lHtsGvFM8ks5ue_C_gaJpZM4Cimsv>
.
|
@zioproto Finding the answer to a pressing question buried deep within an issue on github is disheartening to say the least but thank you nonetheless. |
The issue reported by Carlos Sanchez to google-containers@: "
Is it possible to use a service variable to create another environment variable?
For example I have a "jenkins" service running and JENKINS_SERVICE_PORT is available in the container, but the container expects a JENKINS_MASTER env var, that could easily be created as http://localhost:$JENKINS_SERVICE_PORT.
I could just extend the image with a startup script to do that, but I'd like to avoid creating extra images.
I've tried some things inside 'env' and 'command' in the ReplicationController but with no luck.
"
The text was updated successfully, but these errors were encountered: