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
dfa18ceb
Commit
dfa18ceb
authored
Aug 04, 2016
by
Andrey Kurilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix various typos in apiserver pkg
parent
7c326672
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
authz.go
pkg/apiserver/authz.go
+2
-2
authz_test.go
pkg/apiserver/authz_test.go
+1
-1
handlers_test.go
pkg/apiserver/handlers_test.go
+1
-1
index.go
pkg/apiserver/index.go
+1
-1
No files found.
pkg/apiserver/authz.go
View file @
dfa18ceb
...
@@ -90,7 +90,7 @@ var AuthorizationModeChoices = []string{ModeAlwaysAllow, ModeAlwaysDeny, ModeABA
...
@@ -90,7 +90,7 @@ var AuthorizationModeChoices = []string{ModeAlwaysAllow, ModeAlwaysDeny, ModeABA
type
AuthorizationConfig
struct
{
type
AuthorizationConfig
struct
{
// Options for ModeABAC
// Options for ModeABAC
// Path to a ABAC policy file.
// Path to a
n
ABAC policy file.
PolicyFile
string
PolicyFile
string
// Options for ModeWebhook
// Options for ModeWebhook
...
@@ -119,7 +119,7 @@ type AuthorizationConfig struct {
...
@@ -119,7 +119,7 @@ type AuthorizationConfig struct {
func
NewAuthorizerFromAuthorizationConfig
(
authorizationModes
[]
string
,
config
AuthorizationConfig
)
(
authorizer
.
Authorizer
,
error
)
{
func
NewAuthorizerFromAuthorizationConfig
(
authorizationModes
[]
string
,
config
AuthorizationConfig
)
(
authorizer
.
Authorizer
,
error
)
{
if
len
(
authorizationModes
)
==
0
{
if
len
(
authorizationModes
)
==
0
{
return
nil
,
errors
.
New
(
"Atleast one authorization mode should be passed"
)
return
nil
,
errors
.
New
(
"At
least one authorization mode should be passed"
)
}
}
var
authorizers
[]
authorizer
.
Authorizer
var
authorizers
[]
authorizer
.
Authorizer
...
...
pkg/apiserver/authz_test.go
View file @
dfa18ceb
...
@@ -83,7 +83,7 @@ func TestNewAuthorizerFromAuthorizationConfig(t *testing.T) {
...
@@ -83,7 +83,7 @@ func TestNewAuthorizerFromAuthorizationConfig(t *testing.T) {
msg
:
"should have errored when Authorization Policy File is used without ModeABAC"
,
msg
:
"should have errored when Authorization Policy File is used without ModeABAC"
,
},
},
{
{
// Atleast one authorizationMode is necessary
// At
least one authorizationMode is necessary
modes
:
[]
string
{},
modes
:
[]
string
{},
config
:
AuthorizationConfig
{
PolicyFile
:
examplePolicyFile
},
config
:
AuthorizationConfig
{
PolicyFile
:
examplePolicyFile
},
wantErr
:
true
,
wantErr
:
true
,
...
...
pkg/apiserver/handlers_test.go
View file @
dfa18ceb
...
@@ -71,7 +71,7 @@ func pathWithPrefix(prefix, resource, namespace, name string) string {
...
@@ -71,7 +71,7 @@ func pathWithPrefix(prefix, resource, namespace, name string) string {
// - we correctly recover after some "short" requests finish, i.e. we can process new ones.
// - we correctly recover after some "short" requests finish, i.e. we can process new ones.
func
TestMaxInFlight
(
t
*
testing
.
T
)
{
func
TestMaxInFlight
(
t
*
testing
.
T
)
{
const
AllowedInflightRequestsNo
=
3
const
AllowedInflightRequestsNo
=
3
// Size of inflightRequestsChannel determines how many concurent inflight requests
// Size of inflightRequestsChannel determines how many concur
r
ent inflight requests
// are allowed.
// are allowed.
inflightRequestsChannel
:=
make
(
chan
bool
,
AllowedInflightRequestsNo
)
inflightRequestsChannel
:=
make
(
chan
bool
,
AllowedInflightRequestsNo
)
// notAccountedPathsRegexp specifies paths requests to which we don't account into
// notAccountedPathsRegexp specifies paths requests to which we don't account into
...
...
pkg/apiserver/index.go
View file @
dfa18ceb
...
@@ -30,7 +30,7 @@ func IndexHandler(container *restful.Container, muxHelper *MuxHelper) func(http.
...
@@ -30,7 +30,7 @@ func IndexHandler(container *restful.Container, muxHelper *MuxHelper) func(http.
status
:=
http
.
StatusOK
status
:=
http
.
StatusOK
if
r
.
URL
.
Path
!=
"/"
&&
r
.
URL
.
Path
!=
"/index.html"
{
if
r
.
URL
.
Path
!=
"/"
&&
r
.
URL
.
Path
!=
"/index.html"
{
// Since "/" matches all paths, handleIndex is called for all paths for which there is no handler registered.
// Since "/" matches all paths, handleIndex is called for all paths for which there is no handler registered.
// We want to
to
return a 404 status with a list of all valid paths, incase of an invalid URL request.
// We want to return a 404 status with a list of all valid paths, incase of an invalid URL request.
status
=
http
.
StatusNotFound
status
=
http
.
StatusNotFound
}
}
var
handledPaths
[]
string
var
handledPaths
[]
string
...
...
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