-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example that uses environment variables (#698)
Signed-off-by: Pete Wall <[email protected]>
- Loading branch information
Showing
7 changed files
with
61,588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Environment Variables | ||
|
||
In this example, we show how to set environment variables in the Alloy instance and a few examples of how to use them. | ||
|
||
This can be extended to set environment variables in any of the Alloy instances. | ||
|
||
```yaml | ||
--- | ||
cluster: | ||
name: environment-variables-test | ||
|
||
externalServices: | ||
prometheus: | ||
host: https://prometheus.example.com | ||
basicAuth: | ||
username: 12345 | ||
password: "It's a secret to everyone" | ||
externalLabelsFrom: | ||
company: env("COMPANY") # label set from environment variable | ||
team: env("team") # label set from environment variable found in the ConfigMap | ||
loki: | ||
host: https://loki.example.com | ||
basicAuth: | ||
username: 12345 | ||
password: "It's a secret to everyone" | ||
|
||
metrics: | ||
# Environment variable used in a relabeling rule | ||
extraMetricRelabelingRules: |- | ||
rule { | ||
target_label = "region" | ||
replacement = env("region") | ||
} | ||
alloy: | ||
alloy: | ||
extraEnv: # Set environment variables directly | ||
- name: COMPANY | ||
value: "Widget Co" | ||
extraEnvFrom: # Set environment variables from a ConfigMap | ||
- configMapRef: | ||
name: team-params | ||
|
||
# Deploy the ConfigMap with the environment variables. Typically, this would already exist in your cluster. | ||
extraObjects: | ||
- apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: common-params | ||
data: | ||
team: "Team A" | ||
region: "midwest" | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.