Skip to content

Commit 072bbd0

Browse files
jacobseebertinatto
authored andcommitted
UPSTREAM: <carry>: bootstrap-rbac-policy: move over .well-known rules
OpenShift-Rebase-Source: 439ec41 UPSTREAM: <carry>: Update test fixtures
1 parent 1ffa279 commit 072bbd0

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-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
@@ -340,6 +340,15 @@ func clusterRoles() []rbacv1.ClusterRole {
340340
}
341341

342342
roles = append(roles, []rbacv1.ClusterRole{
343+
{
344+
// a role which provides unauthenticated access.
345+
ObjectMeta: metav1.ObjectMeta{Name: "system:openshift:public-info-viewer"},
346+
Rules: []rbacv1.PolicyRule{
347+
rbacv1helpers.NewRule("get").URLs(
348+
"/.well-known", "/.well-known/*",
349+
).RuleOrDie(),
350+
},
351+
},
343352
{
344353
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
345354
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
@@ -675,6 +684,7 @@ func clusterRoleBindings() []rbacv1.ClusterRoleBinding {
675684
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
676685
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
677686
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
687+
rbacv1helpers.NewClusterBinding("system:openshift:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
678688
rbacv1helpers.NewClusterBinding("system:node-proxier").Users(user.KubeProxy).BindingOrDie(),
679689
rbacv1helpers.NewClusterBinding("system:kube-controller-manager").Users(user.KubeControllerManager).BindingOrDie(),
680690
rbacv1helpers.NewClusterBinding("system:kube-dns").SAs("kube-system", "kube-dns").BindingOrDie(),

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,25 @@ items:
140140
- apiGroup: rbac.authorization.k8s.io
141141
kind: User
142142
name: system:kube-proxy
143+
- apiVersion: rbac.authorization.k8s.io/v1
144+
kind: ClusterRoleBinding
145+
metadata:
146+
annotations:
147+
rbac.authorization.kubernetes.io/autoupdate: "true"
148+
labels:
149+
kubernetes.io/bootstrapping: rbac-defaults
150+
name: system:openshift:public-info-viewer
151+
roleRef:
152+
apiGroup: rbac.authorization.k8s.io
153+
kind: ClusterRole
154+
name: system:openshift:public-info-viewer
155+
subjects:
156+
- apiGroup: rbac.authorization.k8s.io
157+
kind: Group
158+
name: system:authenticated
159+
- apiGroup: rbac.authorization.k8s.io
160+
kind: Group
161+
name: system:unauthenticated
143162
- apiVersion: rbac.authorization.k8s.io/v1
144163
kind: ClusterRoleBinding
145164
metadata:

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,20 @@ items:
13391339
verbs:
13401340
- list
13411341
- watch
1342+
- apiVersion: rbac.authorization.k8s.io/v1
1343+
kind: ClusterRole
1344+
metadata:
1345+
annotations:
1346+
rbac.authorization.kubernetes.io/autoupdate: "true"
1347+
labels:
1348+
kubernetes.io/bootstrapping: rbac-defaults
1349+
name: system:openshift:public-info-viewer
1350+
rules:
1351+
- nonResourceURLs:
1352+
- /.well-known
1353+
- /.well-known/*
1354+
verbs:
1355+
- get
13421356
- apiVersion: rbac.authorization.k8s.io/v1
13431357
kind: ClusterRole
13441358
metadata:

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,20 @@ items:
12821282
verbs:
12831283
- list
12841284
- watch
1285+
- apiVersion: rbac.authorization.k8s.io/v1
1286+
kind: ClusterRole
1287+
metadata:
1288+
annotations:
1289+
rbac.authorization.kubernetes.io/autoupdate: "true"
1290+
labels:
1291+
kubernetes.io/bootstrapping: rbac-defaults
1292+
name: system:openshift:public-info-viewer
1293+
rules:
1294+
- nonResourceURLs:
1295+
- /.well-known
1296+
- /.well-known/*
1297+
verbs:
1298+
- get
12851299
- apiVersion: rbac.authorization.k8s.io/v1
12861300
kind: ClusterRole
12871301
metadata:

0 commit comments

Comments
 (0)