Overview
You can use this document to learn how to create and implement variables.
Review Frequently Used Environment Variables
You can use this section to learn about the environment variable parameters that can be passed when you install and deploy the Edge Delta agent.
An environment variable is used to pass secrets to the Edge Delta agent in a secure manner. To accomplish this, the variable is added to the agent's configuration file. During runtime, the agent's local operating system environment obtains the values for the environment variables.
ED_API_KEY
This variable pulls an agent's configuration details, which is generated via the Edge Delta App.
Review the following example:
0a3a6ca3-0df0-45f8-8ea2-d1329ee3de60
ED_WORKFLOWS
This variable uses a colon-separated list of workflow names to enable matching workflows.
All other workflow names are disabled, in conjunction with the edWorkflowPrefixes parameter.
Review the following example:
workflow_1:workflow_2
ED_WORKFLOW_PREFIXES
This variable uses a colon-separated list of workflow prefixes to enable all matching workflows.
All other workflow are disabled, in conjunction with the edWorkflows parameter.
Review the following example:
workflow_prod_:workflow_cache_
ED_LEADER_ELECTION_ENABLED
This variable enables or disables agent leader election mechanism in Kubernetes.
Enter 1 to enable agent leader election mechanism in a Kubernetes environment.
If not enabled, then the Kubernetes event ingestion will be disabled, even if this is activated through configuration.
Review the following sample value:
1
HTTP_PROXY
This variable uses proxy details to route the agent's outbound traffic through an HTTP internal proxy.
Review the following example:
http://127.0.0.1:3128 127.0.0.1:3128
HTTPS_PROXY
This variable uses proxy details to route the agent's outbound traffic through an HTTPS internal proxy.
Review the following example:
https://127.0.0.1:3128 127.0.0.1:3128
NO_PROXY
This variable disables the proxy for requests that hit a specific destination.
Review the following example:
https://your-endpoint.com
STORE_PORT
This variable uses a port number to expose agent metrics storage.
Review the following example:
6062
Review Kubernetes (via kubectl) Example
The following example is a snippet pulled from Edge Delta's GitHub repository:
spec:
containers:
- name: edgedelta
image: docker.io/edgedelta/agent:latest
env:
- name: ED_API_KEY
valueFrom:
secretKeyRef:
key: ed-api-key
name: ed-api-key
- name: HTTPS_PROXY
value: <your proxy details>
Note
The ED_API_KEY variable is not defined in the configuration file as clear text.
The secret value should be defined using the Kubernetes secrets mechanism within the Kubernetes cluster.
Review the following example:
kubectl create secret generic ed-api-key --namespace=edgedelta --from-literal=ed-api-key="YOUR_API_KEY_VALUE"
Review Kubernetes (via helm) Example
- Download the values.yaml file.
- Edit the YAML file to configure the following optional parameters:
- Enter a secret API key instead of clear text API key
- Edit the frequently used environment variables
- Define one or more custom environment variables
- To learn more, see Review Frequently Used Environment Variables.
- One or more custom secret environment variables, which can be used as custom environment variables but also kept as a Kubernetes secret
- After the file is updated, follow the steps in the Install the Agent for Kubernetes with Helm document.
- After you create a namespace, you must also create secrets, based on the instructions in the YAML file. If not, then the agent will fail to start.
Review Linux / Mac Example
During installation, the ED_ENV_VARS variable is used when multiple environment variables are specified in a comma-separated format, such as variable1=value1,variable2=value2.
sudo ED_API_KEY=<your api key> \
ED_ENV_VARS="HTTPS_PROXY=<your proxy details>" \
bash -c "$(curl -L https://release.edgedelta.com/release/install.sh)"
Review Docker Example
docker run --rm -d --name edgedelta \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-e "ED_API_KEY=<your api key>" \
-e "HTTPS_PROXY=<your proxy details>" \
edgedelta/agent:latest
Review Windows Example
On a Windows system, use the following command to define environment variables globally.
- After you set a variable, the agent service will need to be restarted.
[System.Environment]::SetEnvironmentVariable('HTTP_PROXY', '<your proxy details>',[System.EnvironmentVariableTarget]::Machine)
Add a Variable to a Configuration File
There are 2 ways to reference variables in the configuration file:
'{{ Env "MY_VARIABLE_NAME" }}' '{{ Env "MY_VARIABLE_NAME" "my default value" }}'
If the default value is not provided, then the variable in the agent execution environment must exist. If not, then the agent will stop with an error.
If the default value is provided, but the variable does not exist in the agent execution environment, then the default value will be used.
Note
Environment variables can only be used with string-typed inputs. In other words, if a configuration parameter expects anything besides a string, then the environment variable substitution cannot be used.
In another example, the Slack endpoint is a secret that allows posts to be directly made into a Slack channel. Instead of explicitly putting the variable into the configuration file, the variable can be referred from the agent execution environment.
Review the following example:
triggers: - name: slack-integration type: slack endpoint: '{{ Env "MY_SLACK_ENDPOINT" }}'
Create a Global Configuration Variable
If your account contains multiple agents, you may want to consider setting variables that can be globally applied to several agents via the agent's configuration file.
To better understand, review the following examples of configuration variables that you can create:
Name | Value |
AGENT_LOG_LEVEL | error |
API_FILTER_PATTERN | INFO |
- In the Edge Delta App, on the left-side navigation, click Data Pipeline, and then click Agent Settings.
- Under Configuration Variables, click Add Variable.
- Under Name, enter a descriptive name for the global variable.
- Under Value, enter a configuration variable.
- Click Save.
- The newly created variable will display in the Configuration Variables table.