Link Resource Files or Helm Charts in Git Repos

Updated 1 week ago by Michael Cretzman

You can use your Git repo for the configuration files in Manifests and Harness will use them at runtime. You have two options for remote files:

  • Standard Kubernetes Resources in YAML - These files are simply the YAML manifest files stored on a remote Git repo.
  • Helm Chart Source Files - These are Helm chart files stored in standard Helm syntax in YAML on a remote Git repo or Helm repo.
You can also use a Git repo for your entire Harness Application, and sync it unidirectionally or bidirectionally. For more information, see  Configuration as Code. There is no conflict between the Git repo used for remote Manifests files and the Git repo used for the entire Harness Application.

In this topic:

Before You Begin

Step 1: Add a Source Repo Provider

  1. To use a remote Git repo for your resource files or Helm charts, you must set up a Harness Source Repo Provider to connect to your repo. To set up the connection, see one of the following:
  1. In your Harness Kubernetes Service, in Manifests, click the vertical ellipsis and click Link Remote Manifests.
    The Remote Manifests dialog appears.

Step 3: Select a Manifest Format

  1. In Manifest Format, select one of the following options:

Step 4: Configure the Repo Settings

  1. In Source Repository, select a SourceRepo Provider for the Git repo you added to your Harness account. For more information, see  Add Source Repo Providers.
  2. In Commit ID , select Latest from Branch or Specific Commit ID.
  3. In Branch/Commit ID (required), enter the branch or commit ID for the remote repo.
  4. In File/Folder path(s),  enter the repo file and folder path.
If you want to use Go templating in your remote repo for your configuration files in Manifests, ensure that the values.yaml file is at the root of the folder path you select.

When the remote manifests are added, the Manifests section displays the connection details.

How Does Harness Use the Remote Files?

At deployment runtime, the Harness Delegate pulls the remote configuration files from the repo and then uses them to create resources via the Kubernetes API. It does not matter if the Delegate runs in the same Kubernetes cluster as the deployed pods. The Kubernetes API is used by the Delegate regardless of the cluster networking topology.

When you deploy a Workflow or Pipeline that uses this Service, you can see the Delegate fetch the Manifests files from the repo in the Fetch Files section of the log Harness Deployments:

Fetching files from git
            

Git connector Url: https://github.com/michaelcretzman/harness-example # remote manifest files

Branch: example # Git repo branch

Fetching NGINX/values.yaml # values.yaml file in repo

Successfully fetched NGINX/values.yaml

Fetching manifest files at path: NGINX/ # manifest files in repo

Successfully fetched following manifest [.yaml] files:

- templates/spec.yaml # manifest file with ConfigMap and Deployment objects

Done.

If you experience errors fetching the remote files, it is most likely because the wrong branch has been configured in the Branch/Commit ID.

To return to local configuration files, click the vertical ellipsis and select Use Inline Manifests.

Your remote files are not copied locally. You are simply presented with the local configuration files you used last.

Next Steps


How did we do?