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

Set env var with Kamel #606

Closed
abouchama opened this issue Apr 11, 2019 · 5 comments · Fixed by #696
Closed

Set env var with Kamel #606

abouchama opened this issue Apr 11, 2019 · 5 comments · Fixed by #696
Assignees

Comments

@abouchama
Copy link

Is it possible to set env var directly from the CLI Kamel ?

@nicolaferraro
Copy link
Member

I think the answer is no.

What's the use case... Can you do an equivalent thing using config properties?

@abouchama
Copy link
Author

Many times we need to extend JAVA_OPTIONS, or to set JAVA_MAX_MEM_RATIO, NO_PROXY arguments. Those arguments are treated by the (run-java.sh) https://github.com/fabric8io-images/run-java-sh/blob/master/fish-pepper/run-java-sh/fp-files/run-java.sh#L22

@astefanutti
Copy link
Member

I think that's possible by using a configuration of type env in the integration spec, e.g.:

apiVersion: camel.apache.org/v1alpha1
kind: Integration
spec:
  configuration:
  - type: env
    value: JAVA_OPTIONS=...

I don't think you can add it using kamel run, but you can kubectl edit ... the integration.

@lburgazzoli
Copy link
Contributor

The reason why the env option is not exposes is that you can easily break things but if you can list the env var you need to tweak, we can create a trait so people won't risk to break camel-k

@abouchama
Copy link
Author

abouchama commented Apr 11, 2019

Thanks @astefanutti & @lburgazzoli , i can set the env var by using:

oc set env dc/sample JAVA_OPTS=-Dhttp.nonProxyHosts='*.google.com|*.yahoo.fr'

But the deployment config is recreated after a new deployment with 'kamel run', hence we loose this env.

The other approach proposed by @astefanutti , is to set this env directly in the integration spec:

$ oc get integrations.camel.apache.org
NAME                PHASE     CONTEXT
rest-with-restlet   Running   ctx-binj5qi78n55k4851cig

$ oc edit integrations.camel.apache.org/rest-with-restlet
spec:
  configuration:
  - type: env
    value: JAVA_MAX_MEM_RATIO=60
  - type: property
    value: logging.level.org.apache.camel=DEBUG

$ oc describe deployment.apps/rest-with-restlet | grep JAVA_MAX_MEM_RATIO
      JAVA_MAX_MEM_RATIO:       60

With this one also we loose the env var after a new deployment with 'kamel run'

@jamesnetherton jamesnetherton self-assigned this May 20, 2019
jamesnetherton added a commit to jamesnetherton/camel-k that referenced this issue May 28, 2019
lburgazzoli pushed a commit that referenced this issue May 28, 2019
ipolyzos pushed a commit to ipolyzos/camel-k that referenced this issue Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants