Overview

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:

  1. Project Scope: Create Macros from the Project dashboard with project privileges.
  1. Tenant Admin Scope: Create Macros from the Tenant Admin dashboard with admin privileges.
  1. 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 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:

  1. Log in to the Palette Management Console as a Tenant Admin.
  1. From the menu on the left-hand side, click on Tenant Settings and select the Macros tab.
  1. Click on +Add Macro.
  1. Complete the following details for the same:
    • Name: A custom name for the Macro.
    • Value: The value to be assigned to the placeholder variable.
  1. Click the Save changes button to complete the wizard.

Example

manifests:
aws_ebs:
#Storage type should be one of io1, gp2, sc1, st1 types #Checkhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html for more details
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:

  1. Log in to the Palette console and navigate to Profiles.
  1. 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.

  1. 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.

  1. Save the changes to the Cluster Profile. This Macro can be replaced or edited later.

Delete Macros

  1. Log in to Palette Management Console as Tenant Admin.
  1. From the menu on the left-hand side, go to Tenant Settings and select the Macros tab.
  1. Click on the Delete button to remove the macro.
  1. Click the Save changes button to complete the wizard.
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.