I am trying to create a PipeLineRun/PipeLineRun from within a continer listening to a webhook and running tkn - but I need RBAC rights. I tried rolebinding role: tekton-pipelines-controller to default service account:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: webhook
namespace: tekton-pipelines
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: tekton-pipelines-controller
subjects:
- kind: ServiceAccount
name: default
namespace: default
But I can still not do this:
kubectl auth can-i create taskrun -n default --as=system:serviceaccount:default:default
no
I also tried creating a role for the resource:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: webhook-create-taskrun
namespace: tekton-pipelines
rules:
- apiGroups: ["tekton.dev/v1beta1"]
resources: ["taskrun"]
verbs: ["get", "create", "list"]
# [ delete deletecollection get list patch create update watch ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: webhook-create-taskrun
namespace: tekton-pipelines
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: webhook-create-taskrun
subjects:
- kind: ServiceAccount
name: default
namespace: default
Unfortunately still no access
I also looked for anything "taskrun" in all RoleBindings in tekton-pipelines, and found nothing
ns := "tekton-pipelines"
rbacClientSet := clientSet.RbacV1()
rolebindings, _ := rbacClientSet.RoleBindings(ns).List(context.Background(), metav1.ListOptions{})
for _, element := range rolebindings.Items {
fmt.Println(element)
}