- two layers
- Argo CD RBAC: who can do what in Argo CD (
argocd-rbac-cm)
- k8s RBAC: what Argo CD itself can do in target clusters
- built-in roles:
role:admin (everything), role:readonly (read everything)
policy.default is the role given to authenticated users with no matching policy (empty by default = no access)
p, <subject>, <resource>, <action>, <object>, <effect>
g, <user-or-group>, <role>
- resources:
applications, applicationsets, clusters, projects, repositories, accounts, certificates, gpgkeys, logs, exec
- actions:
get, create, update, delete, sync, override, action/<group>/<kind>/<action> (action/*)
- object
applications/applicationsets: <project>/<app> e.g. team-a/*, */*
projects: project name
clusters: cluster URL, repositories: <project>/<repo>
- effect:
allow or deny
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
namespace: argocd
data:
policy.default: role:readonly
scopes: '[groups, email]' # OIDC claims used for `g` matching, default is [groups]
policy.csv: |
p, role:developer, applications, get, */*, allow
p, role:developer, applications, sync, */*, allow
p, role:developer, applications, create, */*, allow
p, role:developer, repositories, get, *, allow
p, role:team-a, applications, *, team-a/*, allow
p, role:team-a, projects, get, team-a, allow
p, role:sre, applications, action/*, */*, allow
p, role:sre, applications, override, */*, allow
g, dev-team, role:developer
g, my-org:platform-admins, role:admin # github org:team via Dex
g, ops@example.com, role:sre
override = sync with local manifests (--local), bypasses git
action/* = run resource actions (e.g. restart a Deployment)
- project roles can also be defined inside the
AppProject (spec.roles) with JWT tokens
- built in Dex (
dex.config in argocd-cm) or direct OIDC (oidc.config)
- set
url in argocd-cm, needed for the callback URL
- secrets go in
argocd-secret and are referenced with $key
- local
admin should be disabled once SSO works (admin.enabled: "false")
data:
url: https://argocd.example.com
dex.config: |
connectors:
- type: github
id: github
name: GitHub
config:
clientID: $dex.github.clientID
clientSecret: $dex.github.clientSecret
orgs:
- name: my-org
teams:
- developers
# argocd-secret
stringData:
dex.github.clientID: <id>
dex.github.clientSecret: <secret>
- connector types:
github, gitlab, ldap, saml, oidc, …
- callback URL is
https://<argocd>/api/dex/callback
data:
url: https://argocd.example.com
oidc.config: |
name: Okta
issuer: https://example.okta.com
clientID: <id>
clientSecret: $oidc.okta.clientSecret
requestedScopes: ["openid", "profile", "email", "groups"]
- callback URL is
https://<argocd>/auth/callback
# argocd-cm
data:
accounts.developer: apiKey, login
accounts.ci-pipeline: apiKey
login = can use the UI/CLI, apiKey = can have API tokens
- grant permissions in
argocd-rbac-cm, e.g. p, ci-pipeline, applications, sync, */*, allow
argocd account list
argocd account update-password --account developer --new-password <pw>
argocd account generate-token --account ci-pipeline --expires-in 24h
argocd account delete-token --account ci-pipeline <id>
argocd account can-i sync applications '*/*'
- repo credentials: Secret with label
argocd.argoproj.io/secret-type: repository (type: git|helm, url, username/password or sshPrivateKey)
- cluster credentials: label
argocd.argoproj.io/secret-type: cluster (see multi-cluster)
- argo doesn’t solve secrets in git, use External Secrets Operator, Sealed Secrets, Vault plugin, etc.
- e.g. an
ExternalSecret with target.template.metadata.labels carrying the secret-type label to generate the repo Secret
- skip the polling delay, point the git provider at
https://argocd.example.com/api/webhook
- secrets go in
argocd-secret:
- GitHub:
webhook.github.secret
- GitLab:
webhook.gitlab.secret
- Bitbucket:
webhook.bitbucket.uuid
- ingress must route
/api/webhook to argocd-server