Synchronize GCP Labels and Commander Custom Attributes
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.
Custom attribute values are updated as part of the automatic GCP synchronization task, as well as when you manually synchronize the inventory.
GCP label synchronizing overview
You can configure label synchronization when you add a GCP cloud account, or at a later time. Label import provides:
- Better targeting of power schedule recommendations — For example, you can automatically set one power schedule for VMs with the label "dev" and another for those labeled "prod". For more information, see Configure VM Power Schedules.
- Advanced search and reporting — Filter searches and reports by label, such as application ID or environment, or group report data by label. For more information, see Searching and Reporting.
- Workflow conditions based on label values — Automatically select the right Chef recipe or Ansible playbook to run during post-provisioning, depending on tag compliance requirements. For more information, see Make Workflow Steps Conditional.
Commander supports synchronization of labels for projects, deployments, VM instances, and VM images.
If a GCP label doesn't match an existing 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.
If you don't want to sync all GCP labels, you can specify which to exclude.
- 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
Commander doesn't current support the following
How GCP labels and custom attributes 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, 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.
- It's recommended that you clear the Edit in Service Portal option 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 isn't enabled.
- 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.
Synchronize GCP labels and Commander custom attributes
This procedure assumes you're configuring synchronization for an existing GCP cloud account. The steps are similar when you add a GCP account to Commander.
Access: | Views > Inventory |
Available to: | Commander Roles of Superuser and Enterprise Admin |
- Click the Infrastructure or Applications tab.
- In the Infrastructure or Applications view, select a GCP cloud account in the tree.
- Select Actions > Sync Tags and Custom Attributes.
- In the Synchronize GCP Labels and Commander Custom Attributes dialog, enable Import GCP Labels as Commander Custom Attributes.
- 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.
- Click OK.
Commander imports label values from GCP and creates custom attributes for any labels that don't match existing custom attributes.
Exclude 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.
Access: | Views > Inventory |
Available to: | Commander Roles of Superuser and Enterprise Admin |
- Click the Infrastructure or Applications tab.
- In the Infrastructure or Applications view, select a GCP cloud account in the tree.
- Select Actions > Sync Tags and Custom Attributes.
- In the Synchronize GCP Labels and Commander Custom Attributes dialog, enter a comma-separated list of label keys in the Excluded Labels field.
GCP labels are case-sensitive; enter labels with the correct case. You can enter up to 5000 characters in this field.
- 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.
Synchronize labels that had been excluded
You can synchronize a label that you had previously excluded but now want to synchronize.
Access: | Views > Inventory |
Available to: | Commander Roles of Superuser and Enterprise Admin |
- In the Infrastructure or Applications view, select the GCP cloud account in the tree.
- In the Commands pane, click Sync Tags and Custom Attributes.
- In the Synchronize GCP Labels and Commander Custom Attributes dialog, remove the label from the list and click OK.
Commander will now include this label in future synchronizations.