Custom resource definition
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
parent
cfaf47c8a2
commit
4c060a78cc
1348 changed files with 92364 additions and 55766 deletions
18
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
18
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
|
@ -43,7 +43,7 @@ var PanicHandlers = []func(interface{}){logPanic}
|
|||
// TODO: remove this function. We are switching to a world where it's safe for
|
||||
// apiserver to panic, since it will be restarted by kubelet. At the beginning
|
||||
// of the Kubernetes project, nothing was going to restart apiserver and so
|
||||
// catching panics was important. But it's actually much simpler for montoring
|
||||
// catching panics was important. But it's actually much simpler for monitoring
|
||||
// software if we just exit when an unexpected panic happens.
|
||||
func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
if r := recover(); r != nil {
|
||||
|
@ -63,7 +63,11 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
|
|||
// logPanic logs the caller tree when a panic occurs.
|
||||
func logPanic(r interface{}) {
|
||||
callers := getCallers(r)
|
||||
glog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
if _, ok := r.(string); ok {
|
||||
glog.Errorf("Observed a panic: %s\n%v", r, callers)
|
||||
} else {
|
||||
glog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
}
|
||||
}
|
||||
|
||||
func getCallers(r interface{}) string {
|
||||
|
@ -128,9 +132,8 @@ func (r *rudimentaryErrorBackoff) OnError(error) {
|
|||
r.lastErrorTimeLock.Lock()
|
||||
defer r.lastErrorTimeLock.Unlock()
|
||||
d := time.Since(r.lastErrorTime)
|
||||
if d < r.minPeriod && d >= 0 {
|
||||
if d < r.minPeriod {
|
||||
// If the time moves backwards for any reason, do nothing
|
||||
// TODO: remove check "d >= 0" after go 1.8 is no longer supported
|
||||
time.Sleep(r.minPeriod - d)
|
||||
}
|
||||
r.lastErrorTime = time.Now()
|
||||
|
@ -161,3 +164,10 @@ func RecoverFromPanic(err *error) {
|
|||
callers)
|
||||
}
|
||||
}
|
||||
|
||||
// Must panics on non-nil errors. Useful to handling programmer level errors.
|
||||
func Must(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue