Variables and Shared Config
You find yourself typing the same value — a registry URL, a region, an
environment name — into Component after Component, and changing it later means
editing every one of them. Variables let you define the value once and
reference it everywhere.
When to use a variable
Use a variable when a value is the same for every Component within a scope, but
differs between scopes. A registry URL that differs per cloud, a domain suffix
that differs per stage, an environment-specific endpoint — all good candidates.
A value used by exactly one Component is usually clearer left inline.
Variables are scoped by stage, cloud, environment, or namespace.
A Component only sees the variables whose scope matches where it is deployed.
Creating a variable
- In the left sidebar, open the Variables section under Deployment.
- Click + New.
- Enter the variable's name and value, and select its scope.
Using a variable
Inside a Component's configuration editor, reference a variable with the
.VARIABLE notation. The templating engine works like Helm templates, but
uses << and >> as the delimiters instead of {{ and }}.
image:
repository: .REGISTRY_URL/my-appA Variables tab appears next to the editor listing the variables available
to the Component you are editing. If a variable you expect is not there, its
scope does not match this Component.
Reserved variables
These are predefined and always available, with no need to create them:
| Variable | Value |
|---|---|
._METADATA.CLOUD | The cluster's cloud provider (aws, gcp) |
._METADATA.INSTANCE | The Component's name |
._METADATA.ENVIRONMENT | The Environment name |
._METADATA.STAGE | The stage (dev, prod, and so on) |
._METADATA.NAMESPACE | The namespace the Component is deployed to |
Related articles
- Shared ConfigMaps (K8s Config) — for sharing whole blocks of
configuration data between applications rather than single values
Updated about 5 hours ago