Select Delegates with Selectors

Updated 2 months ago by Michael Cretzman

Delegate Selectors were formerly called Tags. Now, Tags refers only to tagging Harness Application components as described in Using Tags.

When Harness makes a connection via its Delegates, it will select the best Delegate according to its history or round robin between Delegates. See How Does Harness Manager Pick Delegates?.

To ensure a specific Delegate is used by a Harness entity (such as a Workflow step), you can scope the Delegate as explained in Scope Delegates to Harness Components and Commands, or you can add Selectors to Delegates and then reference the Selectors in the entity.

In this topic:

Review: Implicit and Custom Selectors

There are two types of Selectors:

  • Implicit—Harness provides these Selectors as part of your account. They are generated automatically and can be used to identify the Delegate, and can be used in AWS Cloud Providers.
  • Custom—These are Selectors that you add to identify this Delegate and select it in other entities, such as the Shell Script Workflow step.

In this topic, we will focus on custom Selectors.

Step 1: Create a Selector

  1. In Harness, click Setup, and then click Harness Delegates.
  2. In the listing of the Delegate where you want to add a Selector, click Custom Selector.
  3. In Edit Selectors, type in the Selector name, such as dev, and press Enter. You can enter as many Selectors as you like.
  4. Click Submit. The Selector is added.

Step 2: Select Delegates Using Selectors

Elsewhere, such as in a Shell Script step in a Workflow, you can use the Selector to ensure that this Delegate is used when executing the command.

All of the Selectors that you enter must be in the Delegate(s) you are targeting.

Another common use of a Delegate Selector is in an AWS Cloud Provider.

For example, you can install a Delegate in an AWS VPC and then select it in the AWS Cloud Provider Credentials when you select Assume IAM Role on Delegate.

In the Delegate Selector setting, you select the Selector by name, such as ecs-delegate.

Now the Harness AWS Cloud Provider will use the Delegate's credentials to connect with AWS.

See Also

How did we do?