Manage GitOps application access with labels
Configure label-based role-based access control (RBAC) to control which GitOps applications each user can view and sync
Harness uses role-based access control (RBAC) across the platform, including GitOps. In addition to standard RBAC, you can restrict access to GitOps applications using labels on those applications. The GitOps application list shows only the applications each user is authorized to access based on label-based RBAC.
What you will learn from this topic
Label-based RBAC: How Harness matches application labels to resource groups and roles.
Labeling strategy: How to define labels that scale across many applications.
Resource groups and roles: How to create resource groups, assign GitOps permissions, and bind roles to users.
Harness default labels: Which labels Harness applies automatically and how to use them in resource groups.
Before you begin
Review these topics before you configure label-based RBAC:
ApplicationSets: Go to ApplicationSet basics to understand how ApplicationSets generate applications.
Harness ApplicationSets: Go to ApplicationSets to review Harness ApplicationSet workflows.
Harness RBAC: Go to RBAC in Harness to understand roles, resource groups, and role bindings.
Benefits of label-based RBAC
Label-based RBAC gives you finer control than name- or namespace-based permissions alone. The main benefits are:
Granular control: Define permissions from application characteristics instead of individual application names.
Scalability: Manage access for large application portfolios without one-off role assignments.
Consistency: Apply uniform access policies across teams and environments.
Flexibility: Adapt to organizational changes without rebuilding your entire RBAC model.
Implement label-based RBAC
The following walkthrough configures label-based access from labeling strategy through role binding.
Add labels to your application
Add labels that match your strategy on each GitOps application, or generate them from an ApplicationSet template.
Add a label on an existing application
In your project, do the following:
Click GitOps.
Click Applications, then select your application.
On the options bar, select App Details.
Add a Label that matches your labeling strategy.
Add labels through ApplicationSet templates
Instead of labeling each application manually, add labels in your ApplicationSet template. For example:
Create resource groups in Harness
Resource groups let you scope GitOps applications by label.
In Project Settings, navigate to Access Control > Resource Groups.
Click New Resource Group.
Enter a name, then click Save.
On the left, select Resources, then select GitOps > Applications.
Select All, then click Save.
Create a role with permissions
Create a role that grants the GitOps permissions users need on applications in the resource group.
In Project Settings, navigate to Access Control > Roles.
Click New Role.
Enter a name, then click Save.
Under GitOps, enable View and Sync (or the permissions your workflow requires).
Bind roles and resource groups to users
Assign the role and resource group to the users or groups who need access.
In Project Settings, navigate to Access Control > Role Bindings.
Create a binding that maps your role and resource group to a user or user group.
After the binding is in place, those users can sync applications that match the labels in the resource group.
Harness default labels
When Harness generates applications from ApplicationSets, it can apply default labels that associate applications with Harness services and environments. You can use these labels in resource group filters:
harness.io/envRef: Enter the environment identifier to associate the application with a Harness environment.harness.io/serviceRef: Enter the service identifier to associate the application with a Harness service.
Troubleshooting
Next steps
You configured label-based RBAC for GitOps applications. Extend access control and application management with these topics:
Manage GitOps applications: View, sync, and manage individual applications.
ApplicationSets: Generate labeled applications at scale.
RBAC in Harness: Review platform-wide access control patterns.
Last updated
Was this helpful?