Skip to content

Commit

Permalink
Add the missing RBAC for leaderelection
Browse files Browse the repository at this point in the history
The components need to be able to create leases.

When we update knative.dev/pkg (not in this change) the webhook will need to be able to read config-leader-election as well.
  • Loading branch information
mattmoor authored and tekton-robot committed Jun 22, 2020
1 parent a7ce319 commit c42657b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
13 changes: 13 additions & 0 deletions config/200-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,16 @@ rules:
resources: ["podsecuritypolicies"]
resourceNames: ["tekton-pipelines"]
verbs: ["use"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tekton-pipelines-leader-election
labels:
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
rules:
# We uses leases for leaderelection
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
2 changes: 1 addition & 1 deletion config/200-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get"]
resourceNames: ["config-logging", "config-observability"]
resourceNames: ["config-logging", "config-observability", "config-leader-election"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "watch"]
Expand Down
35 changes: 35 additions & 0 deletions config/201-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ roleRef:
name: tekton-pipelines-controller-cluster-access
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tekton-pipelines-controller-leaderelection
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
subjects:
- kind: ServiceAccount
name: tekton-pipelines-controller
namespace: tekton-pipelines
roleRef:
kind: ClusterRole
name: tekton-pipelines-leader-election
apiGroup: rbac.authorization.k8s.io
---
# If this ClusterRoleBinding is replaced with a RoleBinding
# then the ClusterRole would be namespaced. The access described by
# the tekton-pipelines-controller-tenant-access ClusterRole would
Expand Down Expand Up @@ -66,3 +83,21 @@ roleRef:
kind: ClusterRole
name: tekton-pipelines-webhook-cluster-access
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tekton-pipelines-webhook-leaderelection
labels:
app.kubernetes.io/component: webhook
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-pipelines
subjects:
- kind: ServiceAccount
name: tekton-pipelines-webhook
namespace: tekton-pipelines
roleRef:
kind: ClusterRole
name: tekton-pipelines-leader-election
apiGroup: rbac.authorization.k8s.io

0 comments on commit c42657b

Please sign in to comment.