DEV Community

Victor Trapenok
Victor Trapenok

Posted on

Variables in Unifie

Variables is poverfull mechanism for customization.

List of variables and values for deployment you can see on the specifications tab.

List of variables and values

Additionally, in project configuration, we can create more variables.

Create variables form

If you use helm chart in your service – the variables tab will contain a lot of variables parsed from values.yaml file. You can edit these vars and get changes in the resulting yaml.

helm vars

This variables specified for service and are not available in other services in the same project.

Let`s try to add a new variable and save

add a new variable and save

Then you can see your variable in deployment sync vars.

variable in deployment sync vars

Good.

Now you can use this var in your yaml

use var in your yaml

resulting yaml

But that is not all.

Value sources for variables

You can select where to take a value for this variable.

Vars types

You can select one of these options:

  • Values defined at a Project Level - The simplest – hardcoded value in this form
  • Deployment Specific Variables - The link to other existing variable (copy value from other variable)
  • Deployment Configuration - Most useful – Take the value from deployment configuration UI. You can have different values in different deployments. Unified dynamically creates UI for your service configuration.

For our test var TestVar we will set type Deployment Configuration and check deployments configuration. You will see a new tab and input for your variable.

vars ui

Change this value and check the resulting yaml.

resulting yaml

Variable types

You can define variable type and Variable input type.

  • Variable type – like in programming languages with strong typization. can be a boolean, string, number, array, map. (Type any means that unifie will not change your variable type. It will use the exact value.)
  • UI Variable Input Type – Affect only for UI.

UI Variable Input Type

Type conversion is important for kubernetes. For example, such params as “replicas” or “containerPort”. Kubernetes expects the int number. If you pass a string it will not work.

Top comments (0)