3 - PCF Environments

Updated 1 month ago by Michael Cretzman

In this topic, you will add a description of the target PCF infrastructure where Harness will deploy your applications.

PCF Environments Overview

You can specify the PCF deployment environment for you application in a Harness Environment. In the Environment, you specify the following:

  • The Service you created.
  • The PCF deployment type.
  • The PCF Cloud Provider that you added, as described in Add Cloud Providers.

To set up your PCF deployment Environment, do the following:

  1. In your Harness Application, click Environments.
  2. Click Add Environment. The Environment dialog appears.
    1. In Name, enter a name for the PCF Environment, such as Staging.
    2. In Environment Type, select Production or Non-Production.
    3. Click SUBMIT. The Environment is created.

PCF Infrastructure Definitions

Infrastructure Definitions are a feature-flagged replacement for Service Infrastructure.

The Infrastructure Definition is where you specify the PCF deployment infrastructure, using a Cloud Provider, a PCF Deployment Type, and the specific infrastructure details for the deployment, like route maps.

  1. Add an Infrastructure Definition.

    In the Environment, click Add Infrastructure Definition. The Infrastructure Definition dialog appears.

In Infrastructure Definition, you will specify the PCF org, space, and route maps for the app deployment.

The Infrastructure Definition dialog has the following fields.

Fields

Description

Name

Enter a name for your Infrastructure Definition.

Cloud Provider

Select the PCF Cloud Provider that you set up in PCF Cloud Provider.

Deployment Type

Select Pivotal Cloud Foundry.

Cloud Provider

Select the cloud provider to use to connect to the foundation. This will be one of the cloud providers you set up in Add Cloud Providers.

Organization

Select the PCF org for the development account.

Space

Select the space where the application you are deploying is scoped.

Route Maps

Select or create the final route map for the app.

In a Blue/Green Workflow, this route is the Green route.You will use the route when defining the deployment Workflow. In a Workflow, the expression for this route is ${infra.pcf.route}. Here is an example of the route being used in the Map Route step of a workflow:

Temporary Route Maps

Select or create a temporary route for the app. A temporary route can be used to verify an app deployment and, once verified, the workflow can map the app to the primary route, defined in Route Maps.You will use the route when defining the deployment Workflow. The expression for this route is ${infra.pcf.tempRoute}.If you do not have route maps inside PCF, Harness will generate route maps with random names.

Scope to Specific Services

Select this option to scope this Infrastructure Definition to the Harness PCF Service you want to deploy.

You can create route maps (add a URL route to an app) in the Infrastructure Definition dialog. This setting will perform the same operation as the Cloud Foundry create-route CLI command.

To create Route Maps and Temporary Route Maps, do the following:

  1. For either Route Maps or Temporary Route Maps, click Add Route Map. The Route Type assistant appears.
  2. Select HTTP Route or TCP Route. HTTP Route is the most common. Hostname and path are not supported for TCP routes. For information on the differences, see HTTP vs. TCP Routes from Cloud Foundry.
  3. In Domain Name, enter a public name such as myapp.io.
  4. In Host Name, enter a hostname, such as checkout-1. In Cloud Foundry, a host name is the label that indicates a subdomain of the domain associated with the route.
  5. In Path, enter the path for the route. Developers can use paths to route requests for the same hostname and domain to different apps. See Create an HTTP Route with a Path from Cloud Foundry.
  6. Click SUBMIT. Repeat for additional route maps.
With multiple routes, you can map and unmap an app to temporary and final routes. This enables workflows such as Blue/Green.

When you are finished configuring your Infrastructure Definition, it will look something like this:

PCF Service Infrastructures

The Service Infrastructure is where you specify the PCF deployment infrastructure, using a Cloud Provider, a PCF deployment type, and the specific infrastructure details for the deployment, like route maps.

  1. Add a Service Infrastructure. In the Environment, click Add Service Infrastructure. The Service Infrastructure dialog appears.

In Service Infrastructure, you will specify the PCF org, space, and route maps for the app deployment.

The Service Infrastructure dialog has the following fields.

Fields

Description

Name

You can enter a name for your Service Infrastructure or let Harness generate one automatically,

Service

Select the Harness Service to be deployed. Only Services of the PCF type are displayed.

Cloud Provider

Select the PCF Cloud Provider that you set up in PCF Cloud Provider.

Deployment Type

Select PCF.

Cloud Provider

Select the cloud provider to use to connect to the foundation. This will be one of the cloud providers you set up in Add Cloud Providers.

Configuration

These are the foundation-specific settings that determine where in your foundation the application is deployed.

Organization

Select the PCF org for the development account.

Space

Select the space where the application you are deploying is scoped.

Route Maps

Select or create the final route map for the app. In a Blue/Green Workflow, this route is the Green route.You will use the route when defining the deployment Workflow. In a Workflow, the expression for this route is ${infra.pcf.route}. Here is an example of the route being used in the Map Route step of a workflow:

Temporary Route Maps

Select or create a temporary route for the app. A temporary route can be used to verify an app deployment and, once verified, the workflow can map the app to the primary route, defined in Route Maps.You will use the route when defining the deployment Workflow. The expression for this route is ${infra.pcf.tempRoute}.If you do not have route maps inside PCF, Harness will generate route maps with random names.

You can create route maps (add a URL route to an app) in the Service Infrastructure dialog. This setting will perform the same operation as the Cloud Foundry create-route CLI command.

To create Route Maps and Temporary Route Maps, do the following:

  1. For either Route Maps or Temporary Route Maps, click Add Route Map. The Route Type assistant appears.
  2. Select HTTP Route or TCP Route. HTTP Route is the most common. Hostname and path are not supported for TCP routes. For information on the differences, see HTTP vs. TCP Routes from Cloud Foundry.
  3. In Domain Name, enter a public name such as myapp.io.
  4. In Host Name, enter a hostname, such as checkout-1. In Cloud Foundry, a host name is the label that indicates a subdomain of the domain associated with the route.
  5. In Path, enter the path for the route. Developers can use paths to route requests for the same hostname and domain to different apps. See Create an HTTP Route with a Path from Cloud Foundry.
  6. Click SUBMIT. Repeat for additional route maps.
With multiple routes, you can map and unmap an app to temporary and final routes. This enables workflows such as Blue/Green.

When you are finished configuring your service infrastructure, it will look something like this:

Service Configuration Overrides

You can configure your environment to override settings of the services that use the environment. For example, a service might use a specific YAML file with specific metadata, but your environment might need to change the name and namespace of the metadata because it is deploying the service to a QA environment.

For more information, see Override a Service Configuration.

Next Step


How did we do?