Skip to content

Commit adee171

Browse files
stttsbertinatto
authored andcommitted
UPSTREAM: <carry>: bootstrap-rbac-policy: move over .well-known rules
OpenShift-Rebase-Source: 439ec41
1 parent 2be51e1 commit adee171

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go

+10
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,15 @@ func clusterRoles() []rbacv1.ClusterRole {
332332
}
333333

334334
roles = append(roles, []rbacv1.ClusterRole{
335+
{
336+
// a role which provides unauthenticated access.
337+
ObjectMeta: metav1.ObjectMeta{Name: "system:openshift:public-info-viewer"},
338+
Rules: []rbacv1.PolicyRule{
339+
rbacv1helpers.NewRule("get").URLs(
340+
"/.well-known", "/.well-known/*",
341+
).RuleOrDie(),
342+
},
343+
},
335344
{
336345
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
337346
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
@@ -662,6 +671,7 @@ func clusterRoleBindings() []rbacv1.ClusterRoleBinding {
662671
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
663672
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
664673
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
674+
rbacv1helpers.NewClusterBinding("system:openshift:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
665675
rbacv1helpers.NewClusterBinding("system:node-proxier").Users(user.KubeProxy).BindingOrDie(),
666676
rbacv1helpers.NewClusterBinding("system:kube-controller-manager").Users(user.KubeControllerManager).BindingOrDie(),
667677
rbacv1helpers.NewClusterBinding("system:kube-dns").SAs("kube-system", "kube-dns").BindingOrDie(),

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ items:
149149
- apiGroup: rbac.authorization.k8s.io
150150
kind: User
151151
name: system:kube-proxy
152+
- apiVersion: rbac.authorization.k8s.io/v1
153+
kind: ClusterRoleBinding
154+
metadata:
155+
annotations:
156+
rbac.authorization.kubernetes.io/autoupdate: "true"
157+
creationTimestamp: null
158+
labels:
159+
kubernetes.io/bootstrapping: rbac-defaults
160+
name: system:openshift:public-info-viewer
161+
roleRef:
162+
apiGroup: rbac.authorization.k8s.io
163+
kind: ClusterRole
164+
name: system:openshift:public-info-viewer
165+
subjects:
166+
- apiGroup: rbac.authorization.k8s.io
167+
kind: Group
168+
name: system:authenticated
169+
- apiGroup: rbac.authorization.k8s.io
170+
kind: Group
171+
name: system:unauthenticated
152172
- apiVersion: rbac.authorization.k8s.io/v1
153173
kind: ClusterRoleBinding
154174
metadata:

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,21 @@ items:
12211221
verbs:
12221222
- list
12231223
- watch
1224+
- apiVersion: rbac.authorization.k8s.io/v1
1225+
kind: ClusterRole
1226+
metadata:
1227+
annotations:
1228+
rbac.authorization.kubernetes.io/autoupdate: "true"
1229+
creationTimestamp: null
1230+
labels:
1231+
kubernetes.io/bootstrapping: rbac-defaults
1232+
name: system:openshift:public-info-viewer
1233+
rules:
1234+
- nonResourceURLs:
1235+
- /.well-known
1236+
- /.well-known/*
1237+
verbs:
1238+
- get
12241239
- apiVersion: rbac.authorization.k8s.io/v1
12251240
kind: ClusterRole
12261241
metadata:

0 commit comments

Comments
 (0)