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
08deddfd
Unverified
Commit
08deddfd
authored
Nov 06, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70671 from deads2k/delegated-system-master
allow delegated authorization to have privileged groups
parents
a13599be
0b70b7a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
authorization.go
.../src/k8s.io/apiserver/pkg/server/options/authorization.go
+13
-0
No files found.
staging/src/k8s.io/apiserver/pkg/server/options/authorization.go
View file @
08deddfd
...
@@ -56,6 +56,9 @@ type DelegatingAuthorizationOptions struct {
...
@@ -56,6 +56,9 @@ type DelegatingAuthorizationOptions struct {
// AlwaysAllowPaths are HTTP paths which are excluded from authorization. They can be plain
// AlwaysAllowPaths are HTTP paths which are excluded from authorization. They can be plain
// paths or end in * in which case prefix-match is applied. A leading / is optional.
// paths or end in * in which case prefix-match is applied. A leading / is optional.
AlwaysAllowPaths
[]
string
AlwaysAllowPaths
[]
string
// AlwaysAllowGroups are groups which are allowed to take any actions. In kube, this is system:masters.
AlwaysAllowGroups
[]
string
}
}
func
NewDelegatingAuthorizationOptions
()
*
DelegatingAuthorizationOptions
{
func
NewDelegatingAuthorizationOptions
()
*
DelegatingAuthorizationOptions
{
...
@@ -66,6 +69,12 @@ func NewDelegatingAuthorizationOptions() *DelegatingAuthorizationOptions {
...
@@ -66,6 +69,12 @@ func NewDelegatingAuthorizationOptions() *DelegatingAuthorizationOptions {
}
}
}
}
// WithAlwaysAllowGroups appends the list of paths to AlwaysAllowGroups
func
(
s
*
DelegatingAuthorizationOptions
)
WithAlwaysAllowGroups
(
groups
...
string
)
*
DelegatingAuthorizationOptions
{
s
.
AlwaysAllowGroups
=
append
(
s
.
AlwaysAllowGroups
,
groups
...
)
return
s
}
func
(
s
*
DelegatingAuthorizationOptions
)
Validate
()
[]
error
{
func
(
s
*
DelegatingAuthorizationOptions
)
Validate
()
[]
error
{
allErrors
:=
[]
error
{}
allErrors
:=
[]
error
{}
return
allErrors
return
allErrors
...
@@ -115,6 +124,10 @@ func (s *DelegatingAuthorizationOptions) ApplyTo(c *server.AuthorizationInfo) er
...
@@ -115,6 +124,10 @@ func (s *DelegatingAuthorizationOptions) ApplyTo(c *server.AuthorizationInfo) er
func
(
s
*
DelegatingAuthorizationOptions
)
toAuthorizer
(
client
kubernetes
.
Interface
)
(
authorizer
.
Authorizer
,
error
)
{
func
(
s
*
DelegatingAuthorizationOptions
)
toAuthorizer
(
client
kubernetes
.
Interface
)
(
authorizer
.
Authorizer
,
error
)
{
var
authorizers
[]
authorizer
.
Authorizer
var
authorizers
[]
authorizer
.
Authorizer
if
len
(
s
.
AlwaysAllowGroups
)
>
0
{
authorizers
=
append
(
authorizers
,
authorizerfactory
.
NewPrivilegedGroups
(
s
.
AlwaysAllowGroups
...
))
}
if
len
(
s
.
AlwaysAllowPaths
)
>
0
{
if
len
(
s
.
AlwaysAllowPaths
)
>
0
{
a
,
err
:=
path
.
NewAuthorizer
(
s
.
AlwaysAllowPaths
)
a
,
err
:=
path
.
NewAuthorizer
(
s
.
AlwaysAllowPaths
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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