Macros Support
Palette supports placeholder variables as Macros in our cluster profile layers. These macros make regression and update of variables, across multiple-running clusters, easier. We encourage creating these macros and using them within any of our cluster profile layers. Hence, changes to the existing Macros get updated to the corresponding cluster profile and the clusters with these profiles attached.
Scope of Palette Macros
Palette users can declare the Macros under three different scopes:
-
Project Scope: Create
Macros
from the project dashboard with project privileges. -
Tenant Admin Scope: Create macros from the
Tenant Admin Dashboard
with administrative privileges. -
System Scope: Includes the default system macros and user-created system macros.
The Macros must have unique names within a given application, but Macros with a different Scope can have a unique name. In such cases, the precedence followed is in decreasing order (the highest precedence being Project Scope).
Project Scope > Tenant Scope > System Scope
Create your Macro
Palette users can use Macros in three different Scopes. Following the user preferences and privileges, log in as a Tenant Admin or Project Admin, to create macros under Tenant Admin scope and Project Scope, respectively. System Scope Macros can be created via API's. The steps to create a macro are as below:
- Tenant Scope Macro
- Project Scope Macro
- System Scope Macro
-
Log in to the Palette Management Console as a Tenant Admin.
-
From the menu on the left-hand side, click on Tenant Settings and select the Macros tab.
-
Click on +Add Macro.
-
Complete the following details for the same:
- Name: A custom name for the Macro.
- Value: The value to be assigned to the placeholder variable.
-
Click the Save changes button to complete the wizard.
-
Log in to the Palette Management Console as a Project Admin.
-
From the menu on the left-hand side, click on Project Settings and select the Macros tab.
-
Click on +Add Macro.
-
Complete the following details for the same:
- Name: A custom name for the Macro
- Value: The value to be assigned to the placeholder variable.
-
Click the Save changes button to complete the wizard.
Create and list your System Level macros via an API.
manifests:
aws_ebs:
storageType: "gp2"
#Allowed reclaim policies are Delete, Retain
reclaimPolicy: "Delete"
#Toggle for Volume expansion
allowVolumeExpansion: "true"
#Toggle for Default class
isDefaultClass: "true"
#Supported binding modes are Immediate, WaitForFirstConsumer
#Setting this to WaitForFirstConsumer for AWS, so that the volumes gets created in the same AZ as that of the pods
volumeBindingMode: "{{.spectro.macro.volumeBindingMode}}"
Use your Macros
The Macros are overridden into the Cluster Profile layers:
-
During a Cluster Profile creation.
-
For a Cluster Profile used by a running cluster or during cluster provisioning.
Add a Macro to a Cluster Profile Pack:
-
Log in to the Palette console and navigate to Profiles.
-
From the Cluster Profiles tab, select the Cluster Profile to which the Macro is to be added.
Note: A macro can be attached to any Infrastructure or Add-on layers of a Profile.
-
Add the macro name to the desired layer of the profile in the format:
{{.spectro.macro.macro-name}}
, where the macro-name is the Custom name, created by the user.
- Save the changes to the Cluster Profile. This Macro can be replaced or edited later.
Replace or Add a Macro to a running Cluster:
-
Log in to Palette Console and go to the Clusters tab.
-
Select the Cluster Name to which the Macro is to be updated and navigate to the Cluster Details page.
-
Go to the Profiles tab to select the layer to which the Macro is to be added.
-
In the desired existing pack, replace the value with the Macro name as:
{{.spectro.macro.macro-name}}
- Save the changes to the Cluster Profile.
Delete Macros
- Tenant Scope Macro
- Project Scope Macro
- System Scope Macro
-
Log in to Palette Management Console as Tenant Admin.
-
From the menu on the left-hand side, go to Tenant Settings and select the Macros tab.
-
Click the Delete button to remove the macro.
-
Click the Save changes button to complete the wizard.
-
Log in to Palette Management Console as Project Admin.
-
From the menu on the left-hand side, go to Project Settings and select the Macros tab.
-
Click on the Delete button to remove the macro.
-
Click the Save changes button to complete the wizard.
Delete your system level macros via an API.
When a Macro is deleted from the UI, it needs to be cleared from the cluster profile to avoid Macro deletion anomalies in the running cluster.