Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example SA permissions #848

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 4 additions & 31 deletions docs/eventlisteners.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,38 +80,11 @@ the following fields:
### ServiceAccountName

The `serviceAccountName` field is required. The ServiceAccount that the
EventListener sink uses to create the Tekton resources. The ServiceAccount needs
a role with the following rules:
EventListener sink uses to create the Tekton resources.
The ServiceAccount needs a Role that with "get", "list", and "watch" verbs for each Triggers resource as well as a ClusterRole with read access to ClusterTriggerBindings. In addition, it needs to have "create"
permissions on the Pipeline resources it needs to create. See a working example at [../examples/rbac.yaml](../examples/rbac.yaml).

<!-- FILE: examples/role-resources/triggerbinding-roles/role.yaml -->
```YAML
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tekton-triggers-example-minimal
rules:
# Permissions for every EventListener deployment to function
- apiGroups: ["triggers.tekton.dev"]
resources: ["eventlisteners", "triggerbindings", "triggertemplates", "triggers"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
# secrets are only needed for GitHub/GitLab interceptors
resources: ["configmaps", "secrets"]
verbs: ["get", "list", "watch"]
# Permissions to create resources in associated TriggerTemplates
- apiGroups: ["tekton.dev"]
resources: ["pipelineruns", "pipelineresources", "taskruns"]
verbs: ["create"]
- apiGroups: [""]
resources: ["serviceaccounts"]
verbs: ["impersonate"]
```


If your EventListener is using
[`ClusterTriggerBindings`](./clustertriggerbindings.md), you'll need a
ServiceAccount with a
[ClusterRole instead](../examples/role-resources/clustertriggerbinding-roles/clusterrole.yaml).
If your EventListener is using `namespaceSelectors`, the ServiceAccount will require a Cluster role to have read permissions for all Triggers resources across the cluster.

### Triggers

Expand Down
1 change: 1 addition & 0 deletions examples/bitbucket/rbac.yaml
62 changes: 0 additions & 62 deletions examples/bitbucket/role.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions examples/cron/binding.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/cron/eventlistener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: EventListener
metadata:
name: cron-listener
spec:
serviceAccountName: tekton-triggers-cron-sa
serviceAccountName: tekton-triggers-example-sa
triggers:
- name: cron-trig
bindings:
Expand Down
1 change: 1 addition & 0 deletions examples/cron/rbac.yaml
30 changes: 0 additions & 30 deletions examples/cron/role.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions examples/cron/secret.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions examples/cron/serviceaccount.yaml

This file was deleted.

1 change: 1 addition & 0 deletions examples/eventlistener-tls-connection/rbac.yaml
62 changes: 0 additions & 62 deletions examples/eventlistener-tls-connection/role.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions examples/eventlistener-tls-connection/secret.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/github/github-eventlistener-interceptor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
spec:
template:
spec:
serviceAccountName: tekton-triggers-github-sa
serviceAccountName: tekton-triggers-example-sa
containers:
- resources:
requests:
Expand Down
1 change: 1 addition & 0 deletions examples/github/rbac.yaml
62 changes: 0 additions & 62 deletions examples/github/role.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions examples/gitlab/binding.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/gitlab/gitlab-push-listener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: EventListener
metadata:
name: gitlab-listener
spec:
serviceAccountName: tekton-triggers-gitlab-sa
serviceAccountName: tekton-triggers-example-sa
triggers:
- name: gitlab-push-events-trigger
interceptors:
Expand Down
1 change: 1 addition & 0 deletions examples/gitlab/rbac.yaml
Loading