Link Resource Files or Helm Charts in Git Repos
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.
In this topic:
- Before You Begin
- Step 1: Add a Source Repo Provider
- Step 2: Link Remote Manifests
- Step 3: Select a Manifest Format
- Step 4: Configure the Repo Settings
- How Does Harness Use the Remote Files?
- Next Steps
Before You Begin
Step 1: Add a Source Repo Provider
- 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:
Step 2: Link Remote Manifests
- 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
- In Manifest Format, select one of the following options:
- Kubernetes Resource Specs in YAML format — Use any manifest and values files from a Git repo.
- Helm Chart from Source Repository — Use a Helm chart stored in a Git repo.
- Helm Chart from Helm Repository — For Helm Chart from Helm Repositories, see Use a Helm Repository with Kubernetes.
- Kustomization Configuration — Use the manifest file from a Git repo. See Use Kustomize for Kubernetes Deployments.
- OpenShift Template — Use the manifest file from a Git repo. See Using OpenShift with Harness Kubernetes.
Step 4: Configure the Repo Settings
- 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.
- In Commit ID , select Latest from Branch or Specific Commit ID.
- In Branch/Commit ID (required), enter the branch or commit ID for the remote repo.
- In File/Folder path(s), enter the repo file and folder path.
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
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.