Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Local Users and RBAC: Give One Teammate One Project
72%

Step 2: Grant Rights

argocd-rbac-cm accepts two kinds of lines, and that is the whole syntax:

  • A p line is a permission. It says a subject may (or may not) do something.
  • A g line is a group mapping. It says a subject belongs to a role and inherits that role's permissions.

You grant rights with p lines, with g lines, or with both.

Here is the skeleton of the ConfigMap we will apply to grant permissions. The ... means "and so on": you can have as many p and g lines as you need.

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-rbac-cm
  namespace: 
  labels:
    app.kubernetes.io/name: argocd-rbac-cm
    app.kubernetes.io/part-of: argocd
data:
  policy.csv: |
    p, , , , , 
    g, , 
    ...

The p Line

A p line has six comma-separated fields:

p, , , , , 

Below is what each field means and the possible values it can take.

FieldMeaningPossible values
subjectWho the rule applies toA local user (alice), an SSO user or group, or a role (role:readonly)
resourceWhat kind of thingapplications, clusters, projects, repositories, accounts, logs, exec, and a few more
actionThe operationget, create, update, delete, sync, plus special ones like action and override. Not every action is valid on every resource
objectWhich specific instancesThe format depends on the resource. For applications it is /. * matches all
effectAllow or blockallow or deny. A matching deny always wins over a matching allow

Which actions are valid depends on the resource. The official documentation lists every resource and the valid actions. The ones you will probably use most often are these:

ResourceWhat it controlsValid actions you care about
applicationsThe Application objects themselves: viewing, creating, syncing, and deleting deployed appsget, create, update, delete, sync, plus action and override
clustersThe external clusters Argo CD deploys to, registered as cluster credentialsget, create, update, delete
projectsAppProjects, which group apps and set guardrails on what they may deployget, create, update, delete
repositoriesThe Git and Helm repos Argo CD pulls manifests from, including their credentialsget, create, update, delete
logsViewing a pod's logs in the UI, the equivalent of kubectl logsget
execOpening a shell into a pod from the UI, the equivalent of kubectl exec (feature not active by default)create

You can read p lines as sentences. Let's see some examples.

Assigned to a local user:

p, alice, applications, sync, team-alpha/*, allow

Reads: allow alice to sync any application whose object matches team-alpha/*, meaning every app in the team-alpha project.

The subject does not have to be a user. The same p line works with a role or an SSO group in the subject field.

Assigned to a role:

p, role:team-alpha-dev, applications, get, team-alpha/*, allow

Reads: allow anyone in role:team-alpha-dev to get (view) any application in the team-alpha project.

(i) Nobody has this permission yet. A role only grants something once subjects are attached to it with g lines (g, alice, role:team-alpha-dev). We will see this in the next subsection.

Assigned to an SSO group:

p, my-org:platform-team, repositories, *, *, allow

Reads: allow any member of the SSO group my-org:platform-team to perform every action (*) on every repository (*). The group string must match what your identity provider puts in the token claim.

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.