Skip to content

Commit 6a4d042

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

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
@@ -250,6 +250,15 @@ func clusterRoles() []rbacv1.ClusterRole {
250250
}
251251

252252
roles = append(roles, []rbacv1.ClusterRole{
253+
{
254+
// a role which provides unauthenticated access.
255+
ObjectMeta: metav1.ObjectMeta{Name: "system:openshift:public-info-viewer"},
256+
Rules: []rbacv1.PolicyRule{
257+
rbacv1helpers.NewRule("get").URLs(
258+
"/.well-known", "/.well-known/*",
259+
).RuleOrDie(),
260+
},
261+
},
253262
{
254263
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
255264
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
@@ -637,6 +646,7 @@ func clusterRoleBindings() []rbacv1.ClusterRoleBinding {
637646
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
638647
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
639648
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
649+
rbacv1helpers.NewClusterBinding("system:openshift:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
640650
rbacv1helpers.NewClusterBinding("system:node-proxier").Users(user.KubeProxy).BindingOrDie(),
641651
rbacv1helpers.NewClusterBinding("system:kube-controller-manager").Users(user.KubeControllerManager).BindingOrDie(),
642652
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
@@ -1206,6 +1206,21 @@ items:
12061206
verbs:
12071207
- list
12081208
- watch
1209+
- apiVersion: rbac.authorization.k8s.io/v1
1210+
kind: ClusterRole
1211+
metadata:
1212+
annotations:
1213+
rbac.authorization.kubernetes.io/autoupdate: "true"
1214+
creationTimestamp: null
1215+
labels:
1216+
kubernetes.io/bootstrapping: rbac-defaults
1217+
name: system:openshift:public-info-viewer
1218+
rules:
1219+
- nonResourceURLs:
1220+
- /.well-known
1221+
- /.well-known/*
1222+
verbs:
1223+
- get
12091224
- apiVersion: rbac.authorization.k8s.io/v1
12101225
kind: ClusterRole
12111226
metadata:

0 commit comments

Comments
 (0)