Select Delegates for Specific Tasks with Selectors
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
- Step 1: Create a Selector
- Step 2: Select Delegates Using Selectors
- See Also
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
- In Harness, click Setup, and then click Harness Delegates.
- In the listing of the Delegate where you want to add a Selector, click Custom Selector.
- In Edit Selectors, type in the Selector name, such as dev, and press Enter. You can enter as many Selectors as you like.
- Click Submit. The Selector is added.
Step 2: Select Delegates Using Selectors
Elsewhere, such as in a Shell Script command in a Workflow, you can use the Selector to ensure that this Delegate is used when executing the command.
The most common use of a Delegate Selector is in a Cloud Provider. For example, you can install a Delegate in an AWS VPC and select in with a name such as ecs-delegate.
When you set up an AWS Cloud Provider, you can select the Delegate installed in your AWS VPC using its Selector.
Now the AWS Cloud Provider will use the Delegate's credentials to connect with AWS.