Updated on 2024-05-28 GMT+08:00

Managing Component Labels

Labels are key-value pairs and can be attached to workloads. Workload labels are often used for affinity and anti-affinity scheduling. You can add labels to multiple workloads or a specified workload.

You can manage the labels of stateless workloads, stateful workloads, and Daemon sets based on service requirements. This section uses Deployments as an example to describe how to manage labels.

In the following figure, three labels (release, env, and role) are defined for workload APP 1, APP 2, and APP 3. The values of these labels vary with workload.

  • APP 1: [release:alpha;env:development;role:frontend]
  • APP 2: [release:beta;env:testing;role:frontend]
  • APP 3: [release:alpha;env:production;role:backend]

If you set key to role and value to frontend when using workload scheduling or another function, APP 1 and APP 2 will be selected.

Figure 1 Label example

Labels cannot be added to components that are abnormal or deployed based on VM.

Adding Component Labels

  1. Log in to ServiceStage.
  2. Use either of the following methods to go to the component Overview page.

    • On the Application Management page, click the application to which the component belongs, and click the target component in Component List. Alternatively, right-click the component and go to the component Overview page from the shortcut menu.
    • On the Component Management page, click the target component. Alternatively, right-click the component and go to the component Overview page from the shortcut menu.

  3. Click Manage Label.

    Figure 2 Managing labels

  4. Click Add Label.

    1. Enter the key and value.

      The key must be unique.

    2. Click Save.
    Figure 3 Adding a label

Deleting a Component Label

  1. Log in to ServiceStage.
  2. Use either of the following methods to go to the component Overview page.

    • On the Application Management page, click the application to which the component belongs, and click the target component in Component List. Alternatively, right-click the component and go to the component Overview page from the shortcut menu.
    • On the Component Management page, click the target component. Alternatively, right-click the component and go to the component Overview page from the shortcut menu.

  3. Click Manage Label.
  4. Select the label to be deleted and click Delete in the Operation column.

    Figure 4 Deleting a label

  5. Click Save.