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
536a1bcd
Unverified
Commit
536a1bcd
authored
May 27, 2017
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow initialization when no authorizer present
Running without an authorizer is a valid configuration.
parent
4ce39076
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
initialization.go
plugin/pkg/admission/initialization/initialization.go
+7
-3
No files found.
plugin/pkg/admission/initialization/initialization.go
View file @
536a1bcd
...
...
@@ -20,6 +20,8 @@ import (
"fmt"
"io"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/validation"
...
...
@@ -56,9 +58,6 @@ func NewInitializer() admission.Interface {
}
func
(
i
*
initializer
)
Validate
()
error
{
if
i
.
authorizer
==
nil
{
return
fmt
.
Errorf
(
"requires authorizer"
)
}
return
nil
}
...
...
@@ -131,6 +130,11 @@ func (i *initializer) Admit(a admission.Attributes) (err error) {
}
func
(
i
*
initializer
)
canInitialize
(
a
admission
.
Attributes
)
error
{
// if no authorizer is present, the initializer plugin allows modification of uninitialized resources
if
i
.
authorizer
==
nil
{
glog
.
V
(
4
)
.
Infof
(
"No authorizer provided to initialization admission control, unable to check permissions"
)
return
nil
}
// caller must have the ability to mutate un-initialized resources
authorized
,
reason
,
err
:=
i
.
authorizer
.
Authorize
(
authorizer
.
AttributesRecord
{
Name
:
a
.
GetName
(),
...
...
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