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
4245fd7b
Commit
4245fd7b
authored
Dec 23, 2020
by
Erik Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return http.StatusOK instead of 0
Signed-off-by:
Erik Wilson
<
Erik.E.Wilson@gmail.com
>
parent
2fb411fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
router.go
pkg/server/router.go
+13
-13
No files found.
pkg/server/router.go
View file @
4245fd7b
...
...
@@ -140,9 +140,9 @@ func servingKubeletCert(server *config.Control, keyFile string, auth nodePassBoo
return
}
nodeName
,
c
ode
,
err
:=
auth
(
req
)
if
err
!=
nil
||
code
!=
0
{
sendError
(
err
,
resp
,
c
ode
)
nodeName
,
errC
ode
,
err
:=
auth
(
req
)
if
err
!=
nil
{
sendError
(
err
,
resp
,
errC
ode
)
return
}
...
...
@@ -188,9 +188,9 @@ func clientKubeletCert(server *config.Control, keyFile string, auth nodePassBoot
return
}
nodeName
,
c
ode
,
err
:=
auth
(
req
)
if
err
!=
nil
||
code
!=
0
{
sendError
(
err
,
resp
,
c
ode
)
nodeName
,
errC
ode
,
err
:=
auth
(
req
)
if
err
!=
nil
{
sendError
(
err
,
resp
,
errC
ode
)
return
}
...
...
@@ -271,19 +271,19 @@ func serveStatic(urlPrefix, staticDir string) http.Handler {
}
func
sendError
(
err
error
,
resp
http
.
ResponseWriter
,
status
...
int
)
{
code
:=
http
.
StatusInternalServerError
if
len
(
status
)
==
1
&&
status
[
0
]
!=
0
{
var
code
int
if
len
(
status
)
==
1
{
code
=
status
[
0
]
}
if
err
==
nil
{
err
=
errors
.
New
(
"unknown"
)
if
code
==
0
||
code
==
http
.
StatusOK
{
code
=
http
.
StatusInternalServerError
}
logrus
.
Error
(
err
)
resp
.
WriteHeader
(
code
)
resp
.
Write
([]
byte
(
err
.
Error
()))
}
// nodePassBootstrapper returns a node name,
http code,
and error
// nodePassBootstrapper returns a node name,
or http error code
and error
type
nodePassBootstrapper
func
(
req
*
http
.
Request
)
(
string
,
int
,
error
)
func
passwordBootstrap
(
ctx
context
.
Context
,
config
*
Config
)
nodePassBootstrapper
{
...
...
@@ -314,7 +314,7 @@ func passwordBootstrap(ctx context.Context, config *Config) nodePassBootstrapper
return
""
,
http
.
StatusForbidden
,
err
}
return
nodeName
,
0
,
nil
return
nodeName
,
http
.
StatusOK
,
nil
})
}
...
...
@@ -361,5 +361,5 @@ func verifyLocalPassword(ctx context.Context, config *Config, once *sync.Once, n
logrus
.
Debugf
(
"password verified locally for node '%s'"
,
nodeName
)
return
nodeName
,
0
,
nil
return
nodeName
,
http
.
StatusOK
,
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