diff --git a/docs/user-guide/global-configurations/scoped-variables.md b/docs/user-guide/global-configurations/scoped-variables.md index f5126646b..71f82c8bd 100644 --- a/docs/user-guide/global-configurations/scoped-variables.md +++ b/docs/user-guide/global-configurations/scoped-variables.md @@ -2,15 +2,20 @@ ## Introduction -In any piece of software or code, variables are used for holding data such as numbers or strings. Variables are created by declaring them, which involves specifying the variable's name and type, followed by assigning it a value. +In Devtron, many configuration values such as a database name, memory limit, or service endpoint may need to be used in multiple places. Instead of entering the same value repeatedly, you can store it in a scoped variable. -Devtron offers super-admins the capability to define scoped variables (key-value pairs). It means, while the key remains the same, its value may change depending on the following context: +A scoped variable (key-value pair) allows you to define a value once and reuse it. The value of the variable will depend on the scopes mentioned below: -* **Global**: Variable value will be universally same throughout Devtron. -* **Cluster**: Variable value might differ for each Kubernetes cluster. -* **Environment**: Variable value might differ for each environment within a cluster, e.g., staging, dev, prod. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) -* **Application**: Variable value might differ for each application. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) -* **Environment + Application**: Variable value might differ for each application on a specific environment. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) +| Category | Description | +| :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| **Global** | Variable value will be universally same throughout Devtron. | +| **Cluster** | Variable value might differ for each Kubernetes cluster. | +| **Environment** | Variable value might differ for each environment within a cluster, e.g., staging, dev, prod. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) | +| **Application** | Variable value might differ for each application. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) | +| **Environment + Application** | Variable value might differ for each application on a specific environment. [![](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/elements/EnterpriseTag.svg)](https://devtron.ai/pricing) | + + +For example, you can create a variable named `db_name` to store the database name and set its value to `dev-db` for development environment, and for production environment you can set its value to `prod-db`, at the time of deployment, Devtron will automatically choose the correct value based on the environment. **Advantages of using scoped variables** @@ -22,7 +27,19 @@ Devtron offers super-admins the capability to define scoped variables (key-value ## How to Define a Scoped Variable -On Devtron, a super-admin can download a YAML template. It will contain a schema for defining the variables. +{% hint style="warning" %} +### Who can Perform this Action? + Only super admins can define scoped variables. +{% endhint %} + +In Devtron, you can define scoped variables by using a YAML template. It will contain a schema for defining the scoped variables. + +Depending on your use case, you can do either one of the following: + +| Action | Description | +|:---|:---| +| **Download the YAML Template and define variables from scratch** | In case you are defining the Scoped Variables for the first time:
  1. [Download the YAML template](#download-the-template) to your local system.
  2. [Define your variables](#enter-the-values)
  3. [Upload it back to the Devtron](#upload-the-template)
  4. | +| **Edit the existing saved YAML configuration** | If you wish to add, update or delete the existing scoped variables, you can edit the existing saved YAML configuration using any of the following methods: