Add an OrDie version for AddPostStartHook
Simplifies usage and consolidate the error message so it is always the same everywhere. Signed-off-by: Simo Sorce <simo@redhat.com> Kubernetes-commit: 15c54ffa7750c3037f464933c2b678a9a94cea82
This commit is contained in:
parent
3be1849274
commit
91f15f8472
|
|
@ -90,6 +90,13 @@ func (s *GenericAPIServer) AddPostStartHook(name string, hook PostStartHookFunc)
|
|||
return nil
|
||||
}
|
||||
|
||||
// AddPostStartHookOrDie allows you to add a PostStartHook, but dies on failure
|
||||
func (s *GenericAPIServer) AddPostStartHookOrDie(name string, hook PostStartHookFunc) {
|
||||
if err := s.AddPostStartHook(name, hook); err != nil {
|
||||
glog.Fatalf("Error registering PostStartHook %q: %v", name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// RunPostStartHooks runs the PostStartHooks for the server
|
||||
func (s *GenericAPIServer) RunPostStartHooks(stopCh <-chan struct{}) {
|
||||
s.postStartHookLock.Lock()
|
||||
|
|
|
|||
Loading…
Reference in New Issue