GitOps
Manage GitOps agents, applications, clusters, and repositories with the Harness GitOps API.
The GitOps API manages Harness GitOps, which uses Argo CD to keep the state of your Kubernetes clusters in line with the manifests in Git.
Request basics
API key token: Send it in the
x-api-keyheader on every request. Go to Manage API keys to create a key and token.Account, organization, and project IDs: Send
accountIdentifier,orgIdentifier, andprojectIdentifieras query parameters to set the scope of the agent or application you are working with. Go to Organizations and projects to find these identifiers.Base URL: Send requests to
https://app.harness.io/gateway/gitops, followed by the endpoint path.
Example request
List the GitOps agents in a project:
curl "https://app.harness.io/gateway/gitops/api/v1/agents?accountIdentifier=ACCOUNT_ID&orgIdentifier=ORG_ID&projectIdentifier=PROJECT_ID" \
-H "x-api-key: $HARNESS_API_KEY"Replace ACCOUNT_ID, ORG_ID, and PROJECT_ID with your own values, and set HARNESS_API_KEY to your API key token.
Find an endpoint
Endpoint paths are relative to the base URL.
Agents: The Harness GitOps Agent you install in a cluster. It runs Argo CD and connects it to Harness. List agents with
GET /api/v1/agents. Go to Agents to install an agent.Applications: The link between a source of manifests in Git and a destination cluster and namespace. List applications with
POST /api/v1/applications, and sync one withPOST /api/v1/agents/{agentIdentifier}/applications/{request.name}/sync. Go to Applications to create an application.ApplicationSets: Templates that generate many applications at once, for example one per cluster. List them with
POST /api/v1/applicationsetsand read one withGET /api/v1/applicationset/{identifier}. Go to ApplicationSets to create an ApplicationSet.Clusters: The Kubernetes clusters an agent can deploy to. List an agent's clusters with
GET /api/v1/agents/{agentIdentifier}/clusters. Go to Clusters to add a cluster.Repositories and repository credentials: The Git and Helm repositories that hold your manifests, and the credentials used to read them. List an agent's repositories with
GET /api/v1/agents/{agentIdentifier}/repositories, and add credentials withPOST /api/v1/agents/{agentIdentifier}/repocreds. Go to Repositories to add a repository.Argo CD projects and project mappings: Argo CD projects and how they map to Harness projects. Read the mappings with
GET /api/v1/agents/{agentIdentifier}/appprojectsmapping. Go to Manage ArgoCD projects to manage Argo CD projects.
Last updated
Was this helpful?