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
4cd0b7cd
Commit
4cd0b7cd
authored
Feb 21, 2017
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redact detailed errors from healthz and expose in default policy
parent
7a06e41f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
policy.go
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
+2
-2
cluster-roles.yaml
...thorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml
+1
-0
healthz.go
staging/src/k8s.io/apiserver/pkg/server/healthz/healthz.go
+4
-3
healthz_test.go
...g/src/k8s.io/apiserver/pkg/server/healthz/healthz_test.go
+2
-2
No files found.
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
View file @
4cd0b7cd
...
...
@@ -94,10 +94,10 @@ func ClusterRoles() []rbac.ClusterRole {
},
},
{
// a role which provides just enough power to d
iscovery
API versions for negotiation
// a role which provides just enough power to d
etermine if the server is ready and discover
API versions for negotiation
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"system:discovery"
},
Rules
:
[]
rbac
.
PolicyRule
{
rbac
.
NewRule
(
"get"
)
.
URLs
(
"/version"
,
"/swaggerapi"
,
"/swaggerapi/*"
,
"/api"
,
"/api/*"
,
"/apis"
,
"/apis/*"
)
.
RuleOrDie
(),
rbac
.
NewRule
(
"get"
)
.
URLs
(
"/
healthz"
,
"/
version"
,
"/swaggerapi"
,
"/swaggerapi/*"
,
"/api"
,
"/api/*"
,
"/apis"
,
"/apis/*"
)
.
RuleOrDie
(),
},
},
{
...
...
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml
View file @
4cd0b7cd
...
...
@@ -369,6 +369,7 @@ items:
-
/api/*
-
/apis
-
/apis/*
-
/healthz
-
/swaggerapi
-
/swaggerapi/*
-
/version
...
...
staging/src/k8s.io/apiserver/pkg/server/healthz/healthz.go
View file @
4cd0b7cd
...
...
@@ -96,9 +96,10 @@ func handleRootHealthz(checks ...HealthzChecker) http.HandlerFunc {
failed
:=
false
var
verboseOut
bytes
.
Buffer
for
_
,
check
:=
range
checks
{
err
:=
check
.
Check
(
r
)
if
err
!=
nil
{
fmt
.
Fprintf
(
&
verboseOut
,
"[-]%v failed: %v
\n
"
,
check
.
Name
(),
err
)
if
check
.
Check
(
r
)
!=
nil
{
// don't include the error since this endpoint is public. If someone wants more detail
// they should have explicit permission to the detailed checks.
fmt
.
Fprintf
(
&
verboseOut
,
"[-]%v failed: reason withheld
\n
"
,
check
.
Name
())
failed
=
true
}
else
{
fmt
.
Fprintf
(
&
verboseOut
,
"[+]%v ok
\n
"
,
check
.
Name
())
...
...
staging/src/k8s.io/apiserver/pkg/server/healthz/healthz_test.go
View file @
4cd0b7cd
...
...
@@ -51,10 +51,10 @@ func TestMulitipleChecks(t *testing.T) {
{
"/healthz?verbose"
,
"[+]ping ok
\n
healthz check passed
\n
"
,
http
.
StatusOK
,
false
},
{
"/healthz/ping"
,
"ok"
,
http
.
StatusOK
,
false
},
{
"/healthz"
,
"ok"
,
http
.
StatusOK
,
false
},
{
"/healthz?verbose"
,
"[+]ping ok
\n
[-]bad failed:
this will fail
\n
healthz check failed
\n
"
,
http
.
StatusInternalServerError
,
true
},
{
"/healthz?verbose"
,
"[+]ping ok
\n
[-]bad failed:
reason withheld
\n
healthz check failed
\n
"
,
http
.
StatusInternalServerError
,
true
},
{
"/healthz/ping"
,
"ok"
,
http
.
StatusOK
,
true
},
{
"/healthz/bad"
,
"internal server error: this will fail
\n
"
,
http
.
StatusInternalServerError
,
true
},
{
"/healthz"
,
"[+]ping ok
\n
[-]bad failed:
this will fail
\n
healthz check failed
\n
"
,
http
.
StatusInternalServerError
,
true
},
{
"/healthz"
,
"[+]ping ok
\n
[-]bad failed:
reason withheld
\n
healthz check failed
\n
"
,
http
.
StatusInternalServerError
,
true
},
}
for
i
,
test
:=
range
tests
{
...
...
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