Skip to content

Commit 178adb5

Browse files
stttsatiratree
authored andcommitted
UPSTREAM: <carry>: bootstrap-rbac-policy: move over .well-known rules
OpenShift-Rebase-Source: 439ec41
1 parent 5ce6921 commit 178adb5

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ func clusterRoles() []rbacv1.ClusterRole {
239239
}
240240

241241
roles = append(roles, []rbacv1.ClusterRole{
242+
{
243+
// a role which provides unauthenticated access.
244+
ObjectMeta: metav1.ObjectMeta{Name: "system:openshift:public-info-viewer"},
245+
Rules: []rbacv1.PolicyRule{
246+
rbacv1helpers.NewRule("get").URLs(
247+
"/.well-known", "/.well-known/*",
248+
).RuleOrDie(),
249+
},
250+
},
242251
{
243252
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
244253
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
@@ -619,6 +628,7 @@ func clusterRoleBindings() []rbacv1.ClusterRoleBinding {
619628
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
620629
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
621630
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
631+
rbacv1helpers.NewClusterBinding("system:openshift:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
622632
rbacv1helpers.NewClusterBinding("system:node-proxier").Users(user.KubeProxy).BindingOrDie(),
623633
rbacv1helpers.NewClusterBinding("system:kube-controller-manager").Users(user.KubeControllerManager).BindingOrDie(),
624634
rbacv1helpers.NewClusterBinding("system:kube-dns").SAs("kube-system", "kube-dns").BindingOrDie(),

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

Lines changed: 20 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,21 @@ items:
11981198
verbs:
11991199
- list
12001200
- watch
1201+
- apiVersion: rbac.authorization.k8s.io/v1
1202+
kind: ClusterRole
1203+
metadata:
1204+
annotations:
1205+
rbac.authorization.kubernetes.io/autoupdate: "true"
1206+
creationTimestamp: null
1207+
labels:
1208+
kubernetes.io/bootstrapping: rbac-defaults
1209+
name: system:openshift:public-info-viewer
1210+
rules:
1211+
- nonResourceURLs:
1212+
- /.well-known
1213+
- /.well-known/*
1214+
verbs:
1215+
- get
12011216
- apiVersion: rbac.authorization.k8s.io/v1
12021217
kind: ClusterRole
12031218
metadata:

0 commit comments

Comments
 (0)