Skip to main content

Select delegates with delegate selectors and tags

Harness runs tasks by using Harness Delegate to connect your environment to resources. Harness selects the best delegate based on previous use or round-robin selection. See How Does Harness Manager Pick Delegates?

In some cases, you might want Harness to select specific delegates. In these cases, you can use the Delegate Selector settings in Pipelines, Connectors, and so on, with corresponding delegate tags.

Review: Delegate tags

A delegate tag with the same name as your delegate is automatically added to your delegate during the configuration process. You can add one or more comma-separated tags on the helm command line or in the Kubernetes YAML file, as shown in the following example.

value: "tag1,tag2"

You can also add tags to the Tags field during the setup process:

For detailed information on how delegates are selected during execution, see Delegates Overview.

You can select a delegate based on its tags in the Delegate Selector settings of Harness entities like pipelines and connectors.

Review: Delegate selector priority

You can use delegate selectors at multiple places, such as the pipeline, stage, and step levels.

It's important to know which delegate selectors are given priority so that you ensure the correct delegate is used when you want it used.

The delegate selector priority is:

  1. Step
  2. Step Group
  3. Stage
  4. Pipeline
  5. Connector

The step level has the highest priority. Any delegate selected in a step's Delegate Selector setting overrides any Delegates selected in 2-5 above.

A connector can be used in multiple places in a pipeline, such as a stage infrastructure's Cloud Provider setting or even in certain step settings.

Option: Step and step group delegate selector

Delegates can be selected for steps and step groups in their Advanced settings.

Here is a step example:

Here is a step group example:

Option: Select a delegate for a connector using tags

When you add a connector you are given the option of connecting to your third part account using any available delegate or specific delegates.

You select specific delegates using their tags.

You only need to select one of a delegate's tags to select it. All delegates with the tag are selected.

Here, the tag is test1, and you can see multiple delegates match it:

Option: Pipeline delegate selector

Delegates can be selected for an entire pipeline in the pipeline Advanced Options settings.

Option: Stage delegate selector

Delegates can be selected for an entire stage in the stage Advanced settings.

Option: Infrastructure connector

Delegates can be selected for the connector used in a stage's Infrastructure settings, such as a CD stage's Cluster Details > Connector setting.

Option: Select a delegate for a step using tags

You can select one or more delegates for each pipeline step.

In each step, in Advanced, there in the Delegate Selector option:

You only need to select one of a delegate's tags to select it. All delegates with the tag are selected.

Option: Modify tags using Harness API

See Delegate Group Tags Resource.

See also