Skip to content

Configure Jenkins RBAC

JenkinsRole defines Jenkins permissions. JenkinsRoleBinding assigns a role to users or groups on selected controllers and Jenkins objects.

Varroa owns the managed controllers’ role-strategy configuration. Configure it with these resources. JCasC authorizationStrategy entries and manual Jenkins role edits are not retained.

apiVersion: varroa.dev/v1alpha1
kind: JenkinsRole
metadata:
name: payments-builder
spec:
roleType: Item
permissions:
- hudson.model.Item.Read
- hudson.model.Item.Build
- hudson.model.Item.Cancel
---
apiVersion: varroa.dev/v1alpha1
kind: JenkinsRoleBinding
metadata:
name: payments-builders
spec:
roleRef: payments-builder
subjects:
- kind: Group
name: payments-team
controllerScope:
namespaces:
- teams-payments
jenkinsScope:
type: Folder
folder: payments
propagate: Subtree
Terminal window
kubectl apply -f jenkins-rbac.yaml

Connected controllers receive role changes without reprovisioning.

FieldValuesEffect
roleTypeGlobal, Item, AgentPermission category, default Global
controllerScope.namespacesNamespace namesLimits selected controllers
controllerScope.controllerSelectorLabel selectorLimits selected controllers
jenkinsScope.typeGlobal, Folder, PatternLimits Jenkins objects
jenkinsScope.propagateNone, Children, SubtreeControls folder inheritance

Pattern scope accepts a regular expression over full item names:

jenkinsScope:
type: Pattern
pattern: "payments/.*-production"

Prefer folder scope when a folder is the security boundary.

A VarroaRole can set jenkinsRoleRef to a Global JenkinsRole. Its bindings then grant both control-plane permissions and that Jenkins role within the same controller scope. Use a separate JenkinsRoleBinding for Item or Agent roles.

Varroa reconciles the built-in Jenkins role resources varroa-admin, varroa-operator, varroa-developer, varroa-viewer, varroa-system-mite, and varroa-system-operator. Create custom roles instead of editing built-ins. The privileged operator role is covered by executeGroovy security.

SymptomCheck
Jenkins returns 403Subject, scope, role, and permission
JCasC authorization disappearsUse Jenkins RBAC resources
Manual role edit revertsEdit the Varroa resource
Job action failsAdd the required Item grant