mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-09 17:45:35 +00:00
allow for passing a custom handler to the empty delegate
This commit is contained in:
@@ -271,14 +271,20 @@ func (s *GenericAPIServer) NextDelegate() DelegationTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type emptyDelegate struct {
|
type emptyDelegate struct {
|
||||||
|
handler http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEmptyDelegate() DelegationTarget {
|
func NewEmptyDelegate() DelegationTarget {
|
||||||
return emptyDelegate{}
|
return emptyDelegate{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewEmptyDelegateWithCustomHandler allows for registering a custom handler usually for special handling of 404 requests
|
||||||
|
func NewEmptyDelegateWithCustomHandler(handler http.Handler) DelegationTarget {
|
||||||
|
return emptyDelegate{handler}
|
||||||
|
}
|
||||||
|
|
||||||
func (s emptyDelegate) UnprotectedHandler() http.Handler {
|
func (s emptyDelegate) UnprotectedHandler() http.Handler {
|
||||||
return nil
|
return s.handler
|
||||||
}
|
}
|
||||||
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
|
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
|
||||||
return map[string]postStartHookEntry{}
|
return map[string]postStartHookEntry{}
|
||||||
|
|||||||
Reference in New Issue
Block a user