Create and Manage Variables
Variables let you inject custom configuration values into Workload Profiles with the macro syntax {{ .var.<variable-name> }}. PaletteAI stores variables in a VariableSet custom resource named mural-variables. Each namespace can contain only one VariableSet with that name. For field-level details, refer to VariableSet Structure.
Variables can be locked or required:
-
Locked variables cannot be overridden by a higher-precedence source. Variables locked at the Project or System scope also cannot be overridden in a Profile Bundle.
-
Required variables must have a value at deployment time. A variable cannot be both locked and required.
PaletteAI uses variables from four configuration sources:
-
Profile Bundle Variables: Declared directly in
ProfileBundle.spec.variableSet. They define bundle-specific defaults and metadata, and they cannot override variables locked at the Project or System scope. -
Workload Deployment Variables: Defined in
WorkloadDeployment.spec.variables. In supported bundle workflows, this field also receives values carried forward from inlineProfileBundle.spec.variableSetentries. Each key must already be declared in the effectiveVariableSetfor the namespace or in an inline Profile Bundle variable set. -
Project-Scoped Variables: Defined in the
mural-variablesVariableSetin a Project namespace. They apply to all Workload Deployments in that namespace and override system-wide variables. -
System-Wide Variables: Defined in the
mural-variablesVariableSetin themural-systemnamespace. They provide organization-wide defaults available across all Projects.
At render time, PaletteAI resolves variables in the following order of precedence:
-
Workload Deployment Variables: Includes values defined directly in
WorkloadDeployment.spec.variablesand values carried forward from inlineProfileBundle.spec.variableSetentries. -
Project-Scoped Variables
-
System-Wide Variables
For details, refer to Variable Resolution.
Limitations
-
VariableSetand the variables it contains are not intended for sensitive data. Thevaluefield, includingvariableType-specific sub-fields such asstring,int32, andbool, is stored in plain text in Kubernetes. Do not store secrets, passwords, API keys, or other sensitive values in aVariableSet.Instead, use Kubernetes Secrets or a dedicated secrets management solution. Reference the secret from your workload container with standard Kubernetes mechanisms such as environment variable injection (
secretKeyRef) or volume mounts, so the sensitive value never passes through aVariableSet. -
In the UI, you can create and manage only Project variables. System variables are scoped to the
mural-systemnamespace and require the YAML workflow. -
The
valuefield is optional. If you set it, PaletteAI uses it as the default value. To require a value at deployment time, setvalidationMode: requiredor toggle Required in the UI. -
PaletteAI does not allow a variable to be both
requiredandlocked. -
In a Project namespace, you can lock only a variable that already exists in the system
VariableSet. -
You cannot create a Project variable that uses a name already locked in the system
VariableSet. -
PaletteAI does not allow a variable locked in the Project or System scope to be overridden in a Profile Bundle.
-
The
variableTypefield must match the type of thevaluefield. For example, PaletteAI rejectsvariableType: 'bool'withvalue: { string: 'hello' }. -
When authoring YAML directly, set
inputTypefor every variable. Usetextfor standard single-line values ormultilinefor multi-line string values such as PEM certificates.
Create Variables
Add variables to a VariableSet to make them available in Workload Profiles through the macro syntax.
Prerequisites
- UI Workflow
- YAML Workflow
-
You have a Project in
Readystatus. -
You have Project Editor or Admin permissions.
-
kubectlis installed and available in your$PATH. -
You set the
KUBECONFIGenvironment variable to the path of the PaletteAI hub clusterkubeconfigfile.Set KUBECONFIGexport KUBECONFIG=<kubeconfig-location> -
You have a Project namespace where you want to add variables.
Enablement
- UI Workflow
- YAML Workflow
-
Log in to PaletteAI, then open your Project.
-
In the left main menu, select Variables.
-
Ensure the Project tab is selected. The System tab is read-only and displays variables defined by an administrator in the system namespace.
-
Select Add Variable.
-
In the Add new variable drawer, complete the following fields.
Field Description Default Name Enter a unique variable key. For compatibility with macros and the UI, start with a letter or underscore, then use only letters, digits, underscores, or hyphens. None Description (Optional) Provide a description explaining the variable's purpose. None Type Select the data type: string,bool,int32,int64,float32, orfloat64.stringInput Type (Optional) If Type is string, selectSingle lineorMulti-line(for example, for PEM certificates).Single lineDefault Value (Optional) Set a default value. This value is used when no override is provided. None Required (Optional) Toggle on if this variable must have a value at deployment time. Off Locked (Optional) Toggle on to prevent deployments from overriding this variable. A variable cannot be both required and locked. Off -
Select Confirm.
A success notification confirms that PaletteAI created the variable. The variable now appears in the Project variables table.
-
If no
VariableSetexists in your Project namespace, create one. TheVariableSetname must bemural-variables.Create VariableSetcat << 'EOF' > variableset.yaml
apiVersion: spectrocloud.com/v1beta1
kind: VariableSet
metadata:
name: mural-variables
namespace: <project-namespace>
spec:
variables:
- name: environment
variableType: 'string'
inputType: 'text'
value:
string: 'production'
description: 'Deployment environment'
- name: max-replicas
variableType: 'int32'
inputType: 'text'
value:
int32: 5
description: 'Maximum replica count'
EOFReplace
<project-namespace>with your Project namespace. -
Apply the manifest.
Apply VariableSetkubectl apply --filename variableset.yaml -
To add a variable to an existing
VariableSet, usekubectl patchwith a JSON patch.Patch VariableSetkubectl patch variableset mural-variables \
--namespace <project-namespace> \
--type json \
--patch '[{"op": "add", "path": "/spec/variables/-", "value": {"name": "debug-enabled", "variableType": "bool", "inputType": "text", "value": {"bool": false}, "description": "Enable debug mode"}}]' -
(Optional) To create system-scoped variables available across all Projects, apply a
VariableSetin themural-systemnamespace. This action requires cluster-admin permissions.Apply System VariableSetkubectl apply --filename - <<'EOF'
apiVersion: spectrocloud.com/v1beta1
kind: VariableSet
metadata:
name: mural-variables
namespace: mural-system
spec:
variables:
- name: company-name
variableType: 'string'
inputType: 'text'
value:
string: 'Acme Corp'
description: 'Company name used across all deployments'
locked: true
EOF
Edit Variables
Update the value, type, or settings of an existing variable.
- UI Workflow
- YAML Workflow
-
In the left main menu, select Variables.
-
Ensure the Project tab is selected.
-
In the row for the variable you want to edit, select the action menu, and then select Edit.
-
In the Edit variable drawer, update the desired fields.
infoIf one or more Profile Bundles with active deployments use the variable, a banner explains that changing the value can affect those deployments.
-
Select Confirm.
-
To update a single variable, use
kubectl patchwith a JSON patch. The index in thevariablesarray is zero-based.For example, to update the second variable (index
1):Patch VariableSetkubectl patch variableset mural-variables \
--namespace <project-namespace> \
--type json \
--patch '[{"op": "replace", "path": "/spec/variables/1", "value": {"name": "max-replicas", "variableType": "int32", "inputType": "text", "value": {"int32": 10}, "description": "Maximum replica count (updated)"}}]' -
(Optional) If you maintain the full manifest, update
variableset.yamland reapply it.Apply VariableSetkubectl apply --filename variableset.yaml
Delete Variables
Remove a variable from a VariableSet.
You cannot delete a variable through the UI if one or more Profile Bundles reference it. Update or remove those references before you delete the variable.
- UI Workflow
- YAML Workflow
-
In the left main menu, select Variables.
-
Ensure the Project tab is selected.
-
In the row for the variable you want to remove, select the action menu, and then select Delete.
PaletteAI removes the variable and displays a success notification.
-
To remove a single variable, use
kubectl patchwith a JSON patch. The index in thevariablesarray is zero-based.For example, to remove the first variable (index
0):Patch VariableSetkubectl patch variableset mural-variables \
--namespace <project-namespace> \
--type json \
--patch '[{"op": "remove", "path": "/spec/variables/0"}]' -
(Optional) If you maintain the full manifest, remove the variable from
variableset.yamland reapply it.Apply VariableSetkubectl apply --filename variableset.yaml
Bulk Edit Variables
The PaletteAI UI includes a bulk editor for editing all Project variables in YAML at once. Use it when you need to add, modify, or remove multiple variables in one operation.
-
In the left main menu, select Variables.
-
Ensure the Project tab is selected.
-
Select Bulk Editor.
-
In the YAML editor drawer, modify the
VariableSetmanifest. You can add, edit, or remove variables directly in the YAML. -
Review the YAML carefully before you apply the change.
warningThe bulk editor replaces the entire
variablesarray. Any variables that you remove from the YAML are deleted from theVariableSet. -
Select Confirm to apply all changes.
Validate
Confirm that your variables appear and resolve as expected.
- UI Workflow
- YAML Workflow
-
In the left main menu, select Variables.
-
In the Project tab, confirm that the variable appears in the table with the expected Variable Name, Default Value, and Description.
-
(Optional) Select the System tab to review system-scoped variables. The System tab is read-only.
-
(Optional) Use the Required variables filter to display only variables with
validationModeset torequired.
-
List the
VariableSetin your namespace.List VariableSetskubectl get variablesets --namespace <project-namespace>Example OutputNAME VARIABLE-COUNT AGE
mural-variables 3 5m -
View the full
VariableSetspecification and effective variables.View VariableSetkubectl get variableset mural-variables --namespace <project-namespace> --output yaml -
Confirm that
status.effectiveVariablescontains the expected variables with the correctsourcevalues (systemoractiveNamespace).
Next Steps
-
Reference variables in Workload Profiles using the
{{ .var.<variable-name> }}macro syntax. Refer to Macros. -
Create a Workload Profile that uses variables, then deploy it. Refer to Create Workload Profiles and Create App Deployments.
-
Override Project or System variables at the Profile Bundle level. Refer to Create Profile Bundles.