Merge pull request #74089 from deads2k/aggregator-error-handling
prevent unhandled errors on colliding poststarthook registration Kubernetes-commit: c32ea74031e51296669eed3f94f408327f1b4fbb
This commit is contained in:
commit
e869466783
File diff suppressed because it is too large
Load Diff
|
|
@ -57,7 +57,7 @@ func TestNewWithDelegate(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
delegatePostStartHookChan := make(chan struct{})
|
delegatePostStartHookChan := make(chan struct{})
|
||||||
delegateServer.AddPostStartHook("delegate-post-start-hook", func(context PostStartHookContext) error {
|
delegateServer.AddPostStartHookOrDie("delegate-post-start-hook", func(context PostStartHookContext) error {
|
||||||
defer close(delegatePostStartHookChan)
|
defer close(delegatePostStartHookChan)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
@ -85,7 +85,7 @@ func TestNewWithDelegate(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
wrappingPostStartHookChan := make(chan struct{})
|
wrappingPostStartHookChan := make(chan struct{})
|
||||||
wrappingServer.AddPostStartHook("wrapping-post-start-hook", func(context PostStartHookContext) error {
|
wrappingServer.AddPostStartHookOrDie("wrapping-post-start-hook", func(context PostStartHookContext) error {
|
||||||
defer close(wrappingPostStartHookChan)
|
defer close(wrappingPostStartHookChan)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,9 @@ func (s *GenericAPIServer) AddPostStartHook(name string, hook PostStartHookFunc)
|
||||||
// done is closed when the poststarthook is finished. This is used by the health check to be able to indicate
|
// done is closed when the poststarthook is finished. This is used by the health check to be able to indicate
|
||||||
// that the poststarthook is finished
|
// that the poststarthook is finished
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
s.AddHealthzChecks(postStartHookHealthz{name: "poststarthook/" + name, done: done})
|
if err := s.AddHealthzChecks(postStartHookHealthz{name: "poststarthook/" + name, done: done}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
s.postStartHooks[name] = postStartHookEntry{hook: hook, done: done}
|
s.postStartHooks[name] = postStartHookEntry{hook: hook, done: done}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -496,7 +496,7 @@ func TestServerRunWithSNI(t *testing.T) {
|
||||||
|
|
||||||
// add poststart hook to know when the server is up.
|
// add poststart hook to know when the server is up.
|
||||||
startedCh := make(chan struct{})
|
startedCh := make(chan struct{})
|
||||||
s.AddPostStartHook("test-notifier", func(context PostStartHookContext) error {
|
s.AddPostStartHookOrDie("test-notifier", func(context PostStartHookContext) error {
|
||||||
close(startedCh)
|
close(startedCh)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue