2 - Services for PCF

Updated 2 months ago by Michael Cretzman

The topic describes how to create a Harness Application with a PCF Service containing your artifact and PCF manifest.

In this topic:

Add a PCF Service

Before you configure a PCF Service Infrastructure/Infrastructure Definition in Harness, you can create your route maps using the cf CLI cf map-route command to associate an app and route. If you do not, you can create them using Harness during setup. For more information, see Routes and Domains from Pivotal.

To add a PCF service, do the following:

  1. Ensure you have set up a PCF cloud provider connection in Harness, as described in Add Cloud Providers. This connection will log into the foundation.
  2. Ensure you have set up an artifact server connection in Harness, as described in Add Artifact Servers.
  3. Create a Harness application. The PCF service is managed within a Harness application, along with its environment, workflows, pipelines, etc. For more information, see Application Components.
    1. Click Setup, and then click Add Application. The Application dialog appears.
    2. Enter a name for your application, such as PCF_App, and click SUBMIT. The application is created.
    3. Click your application’s name. The application entities appear.
      Next, add the PCF services to your application, including its artifact sources, container types, configuration variables, and files.
  4. Add the PCF service and artifact.
    1. In your application, click Services. On the Services page, click Add Service. The Service dialog appears.
    2. In Name, enter a name for your service. Typically, the name is the same as the micro-service or app you are going to deploy.
    3. In Artifact Type, select Pivotal Cloud Foundry. Once you select an artifact type, Harness will only present configuration options related to that type.
    4. Click SUBMIT. The new service is added.
  5. Next, add an artifact source for the service. Click Add Artifact Source, and select the artifact source.
    For a list of the PCF-supported artifact sources, see Artifact Sources below.

Artifact Sources

The artifact source for your Harness Service is taken from one of the Artifact Servers set up in Add Artifact Servers and is compatible with PCF.

For more information, see Service Types and Artifact Sources.

Deployment Specification

When you create the PCF service, the Deployment Specification section is created and a default PCF manifest file is added.

Manifest File

Manifests provide consistency and reproducibility, and help automate in deploying apps. For more information about the manifests file, see Deploying with Application Manifest from Pivotal.

The comments in the manifest file identify the required fields and their placeholders.

Do not replace the placeholders with information about your application. The values for the placeholders are picked up by Harness at runtime, according to the deployment workflow, and any infrastructure mapping. Anything you enter here will not be used.

Here is an example manifest made from the placeholders at runtime:

- name: my-app
memory: 750M
path: /path/to/application/bits
- route: example.com

Configuration Variables and Files

Configuration variables and files enable you to specify information in the service that can be referenced in other parts of the Harness application. For example, you can specify a variable in the service once, and then use it in multiple workflows without having to manage multiple values.

  • Config Variables - You can create Service-level variables to use throughout your service configuration settings. Any Service variables are added as environment variables when the app is created in the Pivotal environment (cf push).
  • Config Files - You can upload config files with variables to be used when deploying the Service. The secrets variable file is an example.

For details on configuration variables and files, see Configuration Variables and Files.

Secrets Variable File

A secrets.yml defines a format for mapping a variable to a location where a secret is stored.

You can add a secrets.yml variable file to your service and when the service is deployed, the secrets.yml file will be added to the cf push command.

Next Step

How did we do?