Synchronizing GCP Labels and Commander Custom Attributes

Access through:

Views menu > Inventory > Infrastructure or Applications

Available to:

Commander Roles of Superuser and Enterprise Admin

You can synchronize GCP labels, such as Cost Center, Business Unit, Product, Tier or Version, with Commander custom attributes. Like GCP, Commander uses key-value pairs to allow you to assign metadata to services and cloud infrastructure. Once assigned, this metadata persists throughout a service's lifecycle, enabling administrators to understand the purpose of each service.

Label import provides:

  • better targeting of power schedule recommendations — automatically set one power schedule for VMs with the label "dev" and another for those labeled "prod"
  • advanced search and reporting — filter searches and reports by label, such as application ID or environment, or group report data by label
  • workflow conditions based on label values — automatically select the right Chef recipe or Ansible playbook to run during post-provisioning, depending on compliance requirements

Commander can also make power schedule recommendations based on imported GCP label values.

In this topic:

About GCP label synchronization

Commander supports synchronization of labels for projects, deployments, VM instances and VM images.

In this release, you can import GCP labels as custom attributes. The following are not yet supported:

  • exporting custom attributes as new GCP labels
  • exporting custom attribute values as GCP label values
  • synchronizing GCP expiry and ownership information with Commander metadata
  • retrieving labels from GCP billing data

You can configure label synchronization when you add a GCP managed system, or at a later time. If you don't want to sync all GCP labels, you can specify which to exclude.

When Commander finds a GCP label without an existing matching custom attribute, the label is imported as a free-form text-type custom attribute that applies to all service types. By default, Service Portal users can't set values for these custom attributes.

Here's an example of a custom attribute created from an imported GCP label. Notice the description.

GCP label imported as custom attribute

Custom attribute values are updated as part of the automatic GCP synchronization task, as well as when you manually synchronize the inventory.

How custom attributes and GCP labels are matched

When importing GCP labels, if Commander finds an existing custom attribute with the same name, it automatically populates the value for VMs with that label assignment. Note that a match will only be made if the existing custom attribute is configured to apply to "All Types" or "Services". In the case of a matching list-type custom attribute, in order for a value to be updated in Commander, the value in GCP must match one of the preconfigured values for the custom attribute.

While GCP label keys are case-sensitive and must be lowercase, Commander custom attribute names aren't case-sensitive. When importing GCP labels, Commander matches label keys and values, regardless of case.

If no match is found, the label is imported as a free-form text-type custom attribute that applies to services.

If a match is found between a label key and an existing custom attribute name, Commander applies the label value to the custom attribute value.

Best practices

  • If you use GCP labels to store expiry and ownership information, exclude them from import. Commander has distinct properties to store this information. If you import a label used for expiry or ownership, Commander will create a custom attribute to store this information, and users may be confused by the duplication.
  • We recommend keeping the Edit in Service Portal option disabled for all custom attributes created from labels. Otherwise, if a user sets an attribute value, the value will be removed during the next synchronization with GCP. By default, this option is disabled for all custom attributes created from imported labels.
  • If you have a GCP label that serves the same purpose as an existing Commander custom attribute, make sure that the label key and the custom attribute key are identical, and make sure that label values match the preconfigured custom attribute values.

Synchronizing GCP labels and Commander custom attributes

This procedure assumes you're configuring synchronization for an existing GCP managed system. The steps are similar when you add a GCP account to Commander.

  1. In the Infrastructure or Applications view, select a GCP managed system in the tree.
  2. Right-click and select Sync Tags and Custom Attributes.
  3. In the Synchronize GCP Labels and vCommander Custom Attributes dialog, enable Import GCP Labels as vCommander Custom Attributes.
  4. To exclude certain GCP labels from synchronization, enter them as a comma-separated list in the Excluded Labels field.

    You can enter up to 5000 characters in this field.

    GCP labels are case-sensitive, so be sure to enter labels with the correct case.

  5. Click OK.

    Commander imports label values from GCP and creates custom attributes for any labels that don't match existing custom attributes.

Excluding specific labels from synchronization

If you've configured synchronization and you decide you don't want to import particular GCP labels, you can exclude them.

  1. In the Infrastructure or Applications view, select a GCP managed system in the tree.
  2. In the Commands pane, click Sync Tags and Custom Attributes.
  3. In the Synchronize GCP Labels and vCommander Custom Attributes dialog, enter a comma-separated list of label keys in the Excluded Labels field.

    GCP labels are case-sensitive, so be sure to enter labels with the correct case.

    You can enter up to 5000 characters in this field.

  4. Click OK.

    Commander will now no longer import this label during synchronization with GCP.

    If a GCP label was previously imported, excluding it doesn't automatically delete the custom attribute. You may want to delete the custom attribute manually.

Synchronizing a label that had been excluded

If you had previously excluded a label that you now want to synchronize, follow this procedure.

  1. In the Infrastructure or Applications view, select the GCP managed system in the tree.
  2. In the Commands pane, click Sync Tags and Custom Attributes.
  3. In the Synchronize GCP Labels and vCommander Custom Attributes dialog, remove the label from the list and click OK.

    Commander will now include this label in future synchronizations.