Variables in Unifie
Victor Trapenok
Posted on May 3, 2024
Variables is poverfull mechanism for customization.
List of variables and values for deployment you can see on the specifications tab.
Additionally, in project configuration, we can create more variables.
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.
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
Then you can see your variable in deployment sync vars.
Good.
Now you can use this var in your yaml
But that is not all.
Value sources for variables
You can select where to take a value for this variable.
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.
Change this value and check the 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.
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.
Posted on May 3, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.