For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add a Tanzu Application Service (TAS) connector

Connect Harness to your Tanzu Application Service (TAS) accounts and spaces.

Use a Harness Tanzu Application Service (TAS) connector to connect Harness to your TAS environment. Use the TAS connector to deploy applications to your Tanzu cloud from Harness pipelines.


What you will learn from this topic


Before you begin

  • Harness Delegate: A running Harness Delegate that can reach your TAS environment. Go to Delegate installation overview to install one. Connect through a Harness Delegate rather than the Harness Platform, because you need a delegate later to deploy to your TAS environment.

  • TAS Endpoint URL: The API endpoint of your TAS environment, for example https://api.system.tas-mycompany.com.

  • TAS credentials: A TAS username and password, stored as a Harness secret.


Install the Cloud Foundry Command Line Interface (cf CLI) on your Harness Delegate

After your delegate pods are created, edit your Harness Delegate YAML to install cf CLI v7, the autoscaler plugin, and the Create-Service-Push plugin. Harness uses these on the delegate to run Tanzu deployment steps in your pipelines.

Harness Delegate uses Red Hat-based distributions such as Red Hat Enterprise Linux (RHEL) or Red Hat Universal Base Image (UBI). Use microdnf commands to install cf CLI on your delegate. If your delegate runs a Debian-based distribution such as Ubuntu, use apt-get commands instead.

Use your Pivotal Network (Pivnet) API token in the pivnet login command in the script.

  1. Open delegate.yaml in a text editor.

  2. Locate the INIT_SCRIPT environment variable in the Deployment object.

  3. Replace value: "" with the installation script for your delegate's operating system.

Use microdnf commands to install cf CLI on delegates running Red Hat-based distributions such as RHEL or Red Hat UBI.

INIT_SCRIPT for microdnf

Use apt-get commands to install cf CLI on delegates running Debian-based distributions such as Ubuntu.

INIT_SCRIPT for apt-get
  1. Apply the script to the delegate and check the logs.

    The output for cf --version is cf version 7.2.0+be4a5ce2b.2020-12-10. The output for cf plugins lists the installed plugins, including App Autoscaler and Create-Service-Push.

The CF Command script does not require cf login. Harness logs in using the credentials in the TAS connector configured for the infrastructure definition that runs the CF command.


Create a TAS connector

Perform the following steps to create the TAS connector using the Harness Manager.

  1. Open a Harness project, and select Connectors under Project Setup. You can also create connectors at the account or organization levels.

  2. Select New Connector, and then select Tanzu Application Service under Cloud Providers.

Overview

Enter a Name for the connector. Description and Tags are optional. Harness automatically creates an Id (entity identifier) for the connector based on the Name. Select Continue to proceed to Credentials.

TAS connector overview step

Credentials

Select Continue after entering the following details:

  • Endpoint URL: Enter the TAS API endpoint URL, for example https://api.system.tas-mycompany.com.

  • Authentication: Select one of the following options for the username and password:

    • Plaintext: Enter the username, and select Create or Select a Secret to add the password.

    • Encrypted: Create or select a secret for both the username and the password.

  • Refresh Token (optional): Create or select a secret for the refresh token used to authenticate with TAS. Go to Refresh token support for details.

TAS connector credentials step

Select Connectivity Mode

Under Connect to the provider, select how you want Harness to connect to TAS, and then select Save and Continue:

  • Connect through Harness Platform: Harness communicates with TAS securely through the Harness Platform. Credentials are encrypted and stored in the Secret Manager configured in Harness.

  • Connect through a Harness Delegate: Harness communicates with TAS through a Harness Delegate installed in your environment. Select this option if TAS is behind a corporate firewall.

A Harness Delegate is used for deployment operations even if you select Connect through Harness Platform.

TAS connector connectivity mode step

Delegates Setup

This step appears only if you selected Connect through a Harness Delegate. Select one of the following options, and then select Save and Continue:

  • Use any available Delegate.

  • Only use Delegates with all of the following tags: Enter the tag of the delegate you installed.

TAS connector delegates setup step

Connection Test

Harness validates the TAS connector authentication and permissions. Once verification succeeds, select Finish.

TAS connector connection test step

The connector now appears in the Connectors list.


YAML example

The following YAML defines a TAS connector that authenticates using a username and password, and connects through a Harness Delegate.

TAS connector YAML

Refresh token support

Harness Delegate version 23.12.81804 or later is required to use this feature.

Harness provides the option to use a refresh token to authenticate with the Tanzu connector. Harness uses this refresh token to verify your Tanzu instance. You still need to provide a username and password to authenticate with Tanzu. Harness uses these credentials to obtain a new refresh token. Once you provide the refresh token in the connector, Harness uses it to authenticate and perform each task. Harness authenticates with the refresh token before executing each Tanzu step defined in the pipeline.

You can retrieve the refresh token from the config.json file you receive when authenticating with the CF client. You can pass the refresh token as a secret stored in the Harness Secrets Manager or your secrets manager of choice.

To generate the refresh token using a client ID and client secret instead, go to Custom configuration for extensible authentication.


Custom configuration for extensible authentication

For Harness Delegate version 23.12.81811 and later, you can create a Tanzu connector by setting the ENABLE_TAS_REFRESH_TOKEN_CLIENT_ID, TAS_REFRESH_TOKEN_CLIENT_ID, and TAS_REFRESH_TOKEN_CLIENT_SECRET parameters, and providing the refresh token. The connector generates a refresh token using the client ID and secret ID environment variables.

  • ENABLE_TAS_REFRESH_TOKEN_CLIENT_ID: The setting to configure the alternative authentication mode on the Harness Delegate for Tanzu.

  • TAS_REFRESH_TOKEN_CLIENT_ID: The client ID parameter for Tanzu authentication.

  • TAS_REFRESH_TOKEN_CLIENT_SECRET: The client secret parameter for Tanzu authentication.

To configure the delegate YAML, do the following:

  1. Go to the Kubernetes delegate YAML (deployment) or the actual deployed resource.

  2. Under spec.template.spec.containers.env, add the following environment variables.


Next steps

Last updated

Was this helpful?