Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4aeb3f3f
Commit
4aeb3f3f
authored
Dec 12, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update pod RBAC roles to work against head
parent
6421405d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
1 deletion
+96
-1
policy.go
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
+1
-1
policy_test.go
...n/pkg/auth/authorizer/rbac/bootstrappolicy/policy_test.go
+16
-0
cluster-role-bindings.yaml
.../rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml
+78
-0
cluster-roles.yaml
...thorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml
+1
-0
No files found.
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
View file @
4aeb3f3f
...
@@ -184,7 +184,7 @@ func ClusterRoles() []rbac.ClusterRole {
...
@@ -184,7 +184,7 @@ func ClusterRoles() []rbac.ClusterRole {
// TODO: restrict to creating a node with the same name they announce
// TODO: restrict to creating a node with the same name they announce
rbac
.
NewRule
(
"create"
,
"get"
,
"list"
,
"watch"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"nodes"
)
.
RuleOrDie
(),
rbac
.
NewRule
(
"create"
,
"get"
,
"list"
,
"watch"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"nodes"
)
.
RuleOrDie
(),
// TODO: restrict to the bound node once supported
// TODO: restrict to the bound node once supported
rbac
.
NewRule
(
"update"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"nodes/status"
)
.
RuleOrDie
(),
rbac
.
NewRule
(
"update"
,
"patch"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"nodes/status"
)
.
RuleOrDie
(),
// TODO: restrict to the bound node as creator once supported
// TODO: restrict to the bound node as creator once supported
rbac
.
NewRule
(
"create"
,
"update"
,
"patch"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"events"
)
.
RuleOrDie
(),
rbac
.
NewRule
(
"create"
,
"update"
,
"patch"
)
.
Groups
(
legacyGroup
)
.
Resources
(
"events"
)
.
RuleOrDie
(),
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy_test.go
View file @
4aeb3f3f
...
@@ -167,6 +167,22 @@ func TestBootstrapClusterRoles(t *testing.T) {
...
@@ -167,6 +167,22 @@ func TestBootstrapClusterRoles(t *testing.T) {
testObjects
(
t
,
list
,
"cluster-roles.yaml"
)
testObjects
(
t
,
list
,
"cluster-roles.yaml"
)
}
}
func
TestBootstrapClusterRoleBindings
(
t
*
testing
.
T
)
{
list
:=
&
api
.
List
{}
names
:=
sets
.
NewString
()
roleBindings
:=
map
[
string
]
runtime
.
Object
{}
bootstrapRoleBindings
:=
bootstrappolicy
.
ClusterRoleBindings
()
for
i
:=
range
bootstrapRoleBindings
{
role
:=
bootstrapRoleBindings
[
i
]
names
.
Insert
(
role
.
Name
)
roleBindings
[
role
.
Name
]
=
&
role
}
for
_
,
name
:=
range
names
.
List
()
{
list
.
Items
=
append
(
list
.
Items
,
roleBindings
[
name
])
}
testObjects
(
t
,
list
,
"cluster-role-bindings.yaml"
)
}
func
TestBootstrapControllerRoles
(
t
*
testing
.
T
)
{
func
TestBootstrapControllerRoles
(
t
*
testing
.
T
)
{
list
:=
&
api
.
List
{}
list
:=
&
api
.
List
{}
names
:=
sets
.
NewString
()
names
:=
sets
.
NewString
()
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml
0 → 100644
View file @
4aeb3f3f
apiVersion
:
v1
items
:
-
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
creationTimestamp
:
null
labels
:
kubernetes.io/bootstrapping
:
rbac-defaults
name
:
cluster-admin
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
cluster-admin
subjects
:
-
kind
:
Group
name
:
system:masters
-
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
creationTimestamp
:
null
labels
:
kubernetes.io/bootstrapping
:
rbac-defaults
name
:
system:basic-user
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
system:basic-user
subjects
:
-
kind
:
Group
name
:
system:authenticated
-
kind
:
Group
name
:
system:unauthenticated
-
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
creationTimestamp
:
null
labels
:
kubernetes.io/bootstrapping
:
rbac-defaults
name
:
system:discovery
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
system:discovery
subjects
:
-
kind
:
Group
name
:
system:authenticated
-
kind
:
Group
name
:
system:unauthenticated
-
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
creationTimestamp
:
null
labels
:
kubernetes.io/bootstrapping
:
rbac-defaults
name
:
system:node
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
system:node
subjects
:
-
kind
:
Group
name
:
system:nodes
-
apiVersion
:
rbac.authorization.k8s.io/v1alpha1
kind
:
ClusterRoleBinding
metadata
:
creationTimestamp
:
null
labels
:
kubernetes.io/bootstrapping
:
rbac-defaults
name
:
system:node-proxier
roleRef
:
apiGroup
:
rbac.authorization.k8s.io
kind
:
ClusterRole
name
:
system:node-proxier
subjects
:
-
kind
:
Group
name
:
system:nodes
kind
:
List
metadata
:
{}
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml
View file @
4aeb3f3f
...
@@ -436,6 +436,7 @@ items:
...
@@ -436,6 +436,7 @@ items:
resources
:
resources
:
-
nodes/status
-
nodes/status
verbs
:
verbs
:
-
patch
-
update
-
update
-
apiGroups
:
-
apiGroups
:
-
"
"
-
"
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment