Skip to content

Add support for defining environment variables for all containers in a component #530

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

Closed
amisevsk opened this issue Jul 29, 2021 · 0 comments · Fixed by #538
Closed

Add support for defining environment variables for all containers in a component #530

amisevsk opened this issue Jul 29, 2021 · 0 comments · Fixed by #538

Comments

@amisevsk
Copy link
Collaborator

amisevsk commented Jul 29, 2021

Description

Since devfile/api#149 will not be included in the Devfile 2.0 spec, we should consider supporting similar functionality via a controller-specific attribute on components. Some Che components (e.g. telemetry for the publicly hosted deployment) require the feature to function correctly, and reimplementing it as suggested in devfile/api#239 is difficult.

Options

1. Implement workspaceEnv as global variables

This would require

  1. A plugin to define a devfile 2.0 global variable, e.g.
    template:
      variables:
        MY_ENV: "desired_value"
  2. All plugins that expect to use the variable to have an environment variable defined
    env:
      - name: MY_ENV
        value: "{{MY_ENV}}"

However, the dependent plugins from step 2 cannot assume that the variable will be provided. If the plugin from step 1 is not included in a DevWorkspace, the DevWorkspace will issue a warning that there's no replacement for {{MY_ENV}}.

2. Implement workspaceEnv as an attribute

A plugin could define an attribute

attributes:
  workspaceEnv:
    name: MY_ENV
    value: "desired_value"

This would signal the controller to add the env var MY_ENV=desired_value to all containers in the DevWorkspace. However, this would be DevWorkspace controller-specific behaviour and completely outside the Devfile 2.0 spec as it's currently written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant