summaryrefslogtreecommitdiffstats
path: root/roles/template_service_broker/files/rbac-template.yaml
blob: 0937a9065ba122453834a52ec3ccb4e0f95a5bfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
apiVersion: template.openshift.io/v1
kind: Template
metadata:
  name: template-service-broker-rbac
parameters:
- name: NAMESPACE
  value: openshift-template-service-broker
- name: KUBE_SYSTEM
  value: kube-system
objects:

# Grant the service account permission to call the TSB
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: ClusterRoleBinding
  metadata:
    name: templateservicebroker-client
  roleRef:
    kind: ClusterRole
    name: system:openshift:templateservicebroker-client
  subjects:
  - kind: ServiceAccount
    namespace: ${NAMESPACE}
    name: templateservicebroker-client

# to delegate authentication and authorization
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: ClusterRoleBinding
  metadata:
    name: auth-delegator-${NAMESPACE}
  roleRef:
    kind: ClusterRole
    name: system:auth-delegator
  subjects:
  - kind: ServiceAccount
    namespace: ${NAMESPACE}
    name: apiserver

# to have the template service broker powers
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: ClusterRoleBinding
  metadata:
    name: tsb-${NAMESPACE}
  roleRef:
    kind: ClusterRole
    name: system:openshift:controller:template-service-broker
  subjects:
  - kind: ServiceAccount
    namespace: ${NAMESPACE}
    name: apiserver

# to read the config for terminating authentication
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: RoleBinding
  metadata:
    namespace: ${KUBE_SYSTEM}
    name: extension-apiserver-authentication-reader-${NAMESPACE}
  roleRef:
    kind: Role
    name: extension-apiserver-authentication-reader
  subjects:
  - kind: ServiceAccount
    namespace: ${NAMESPACE}
    name: apiserver

# allow the kube service catalog's SA to read the static secret defined
# above, which will contain the token for the SA that can call the TSB.
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: Role
  metadata:
    name: templateservicebroker-auth-reader
    namespace: ${NAMESPACE}
  rules:
  - apiGroups:
    - ""
    resourceNames:
    - templateservicebroker-client
    resources:
    - secrets
    verbs:
    - get
- apiVersion: rbac.authorization.k8s.io/v1beta1
  kind: RoleBinding
  metadata:
    namespace: ${NAMESPACE}
    name: templateservicebroker-auth-reader
  roleRef:
    kind: Role
    name: templateservicebroker-auth-reader
  subjects:
  - kind: ServiceAccount
    namespace: kube-service-catalog
    name: service-catalog-controller