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
34365c1e
Commit
34365c1e
authored
Sep 22, 2016
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make genericapiserver.PostStartHooks private
parent
5af04d1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
genericapiserver.go
pkg/genericapiserver/genericapiserver.go
+1
-1
hooks.go
pkg/genericapiserver/hooks.go
+5
-5
No files found.
pkg/genericapiserver/genericapiserver.go
View file @
34365c1e
...
@@ -169,7 +169,7 @@ type GenericAPIServer struct {
...
@@ -169,7 +169,7 @@ type GenericAPIServer struct {
// PostStartHooks are each called after the server has started listening, in a separate go func for each
// PostStartHooks are each called after the server has started listening, in a separate go func for each
// with no guaranteee of ordering between them. The map key is a name used for error reporting.
// with no guaranteee of ordering between them. The map key is a name used for error reporting.
// It may kill the process with a panic if it wishes to by returning an error
// It may kill the process with a panic if it wishes to by returning an error
P
ostStartHooks
map
[
string
]
PostStartHookFunc
p
ostStartHooks
map
[
string
]
PostStartHookFunc
postStartHookLock
sync
.
Mutex
postStartHookLock
sync
.
Mutex
postStartHooksCalled
bool
postStartHooksCalled
bool
openAPIDefinitions
*
common
.
OpenAPIDefinitions
openAPIDefinitions
*
common
.
OpenAPIDefinitions
...
...
pkg/genericapiserver/hooks.go
View file @
34365c1e
...
@@ -61,14 +61,14 @@ func (s *GenericAPIServer) AddPostStartHook(name string, hook PostStartHookFunc)
...
@@ -61,14 +61,14 @@ func (s *GenericAPIServer) AddPostStartHook(name string, hook PostStartHookFunc)
if
s
.
postStartHooksCalled
{
if
s
.
postStartHooksCalled
{
return
fmt
.
Errorf
(
"unable to add %q because PostStartHooks have already been called"
,
name
)
return
fmt
.
Errorf
(
"unable to add %q because PostStartHooks have already been called"
,
name
)
}
}
if
s
.
P
ostStartHooks
==
nil
{
if
s
.
p
ostStartHooks
==
nil
{
s
.
P
ostStartHooks
=
map
[
string
]
PostStartHookFunc
{}
s
.
p
ostStartHooks
=
map
[
string
]
PostStartHookFunc
{}
}
}
if
_
,
exists
:=
s
.
P
ostStartHooks
[
name
];
exists
{
if
_
,
exists
:=
s
.
p
ostStartHooks
[
name
];
exists
{
return
fmt
.
Errorf
(
"unable to add %q because it is already registered"
,
name
)
return
fmt
.
Errorf
(
"unable to add %q because it is already registered"
,
name
)
}
}
s
.
P
ostStartHooks
[
name
]
=
hook
s
.
p
ostStartHooks
[
name
]
=
hook
return
nil
return
nil
}
}
...
@@ -79,7 +79,7 @@ func (s *GenericAPIServer) RunPostStartHooks(context PostStartHookContext) {
...
@@ -79,7 +79,7 @@ func (s *GenericAPIServer) RunPostStartHooks(context PostStartHookContext) {
defer
s
.
postStartHookLock
.
Unlock
()
defer
s
.
postStartHookLock
.
Unlock
()
s
.
postStartHooksCalled
=
true
s
.
postStartHooksCalled
=
true
for
hookName
,
hook
:=
range
s
.
P
ostStartHooks
{
for
hookName
,
hook
:=
range
s
.
p
ostStartHooks
{
go
runPostStartHook
(
hookName
,
hook
,
context
)
go
runPostStartHook
(
hookName
,
hook
,
context
)
}
}
}
}
...
...
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