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

Environment variables evaluated only at integration runtime #1916

Merged
merged 3 commits into from
Jan 19, 2021

Conversation

doru1004
Copy link
Contributor

@doru1004 doru1004 commented Jan 16, 2021

This patch adds a way to pass environment variables that only get resolved at integration runtime.

These values can be passed as modeline options in this way:

# camel-k: property=camel.component.kafka.brokers={{env:KAFKA_BROKERS}}

This allows images built locally with kamel local create to be deployed in the cloud. If the image depends on any such environment variables, their value needs to be resolved in the deployment script. This ensures that the same modeline option that is provided locally works when run in the cloud environment.

Moreover it provides a safe way to pass sensitive properties such as web hooks. The value of {{env:SLACK_WEBHOOK}} will only become available when the integrations is run. The value will be taken from the parent environment which is either the local machine or a container.

For the case when the parent environment is a container, this patch also adds an --env flag to kamel local run. Previously to run an existing image, it was sufficient to provide the image name:

kamel local run --image <registry>/<image-name>

This still holds if no delayed environment variables are used as modeline options.

If delayed environment variables such as {{env:KAFKA_BROKERS}} are used then the kamel local run command needs to also provide values for these variables:

kamel local run --image <registry>/<image-name> --env KAFKA_BROKERS=localhost:9092

(This is similar to what a docker run command would require)

Release Note

NONE

@nicolaferraro nicolaferraro merged commit 7bdb653 into apache:master Jan 19, 2021
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 this pull request may close these issues.

None yet

2 participants