Configure Stage Infrastructure
Configure infrastructure for pipeline and template workflows.
Within the Harness Platform, there are certain modules - CI, STO, IACM, or IDP - that require the user to configure infrastructure. When developing a pipeline with these modules a user must choose a build infrastructure type: Kubernetes or Cloud. This page documents reusable code snippets that can be used for allowing user customization when writing pipeline template and Template workflows.
IDP template workflow
The following can be used for both pipeline infrastructure or step/group infrastructure.
- title: How should the pipeline run?
properties:
build_infrastructure_type:
title: Choose your Build Farm Infrastructure configuration
type: string
default: build_farm
enum:
- build_farm
- cloud
- custom
enumNames:
- Central Build Farm Infrastructure Only
- Leverage Harness CI Cloud Infrastructure
- Self-Hosted Kubernetes Infrastructure
infra_defaults:
title: infra_defaults
type: object
ui:widget: hidden
properties:
kubernetes_connector:
type: string
default: account.buildfarm_infrastructure
kubernetes_namespace:
type: string
default: default
kubernetes_override_image_connector:
type: string
default: ""
kubernetes_node_selectors:
type: string
default: ""
dependencies:
build_infrastructure_type:
allOf:
- if:
properties:
build_infrastructure_type:
const: "custom"
then:
required:
- kubernetes_connector
- kubernetes_namespace
properties:
kubernetes_connector:
title: Existing Kubernetes Infrastructure Connector Reference
type: string
description: Enter the existing Kubernetes connector if local K8s execution should be used when running the Execution pipeline. Must exist before execution.
kubernetes_namespace:
title: Existing Kubernetes Infrastructure Namespace
type: string
description: Enter the existing Kubernetes namespace if local K8s execution should be used when running the Execution pipeline. Must exist before execution
kubernetes_override_image_connector:
title: Existing Override Image Container Connector Reference
type: string
description: Enter an existing Container Registry connector to use which overrides the default connector. Must exist before execution
kubernetes_node_selectors:
title: Map of Kubernetes Node Selectors (Must be in key:value JSON)
type: object
description: Optional Kubernetes Node Selectors
additionalProperties:
type: string Then pass these parameters to your Terraform:
And create variables in your Terraform to retrieve them:
Add a template file to your Terraform templates directory templates/pipelines/snippets/:
Then add a spot for the snippet to be rendered in your pipeline:
Finally, when rendering your pipeline with templatefile just pass the inputs from the workflow:
Last updated
Was this helpful?