mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
OAS-9996 Better panic handling (#1706)
This commit is contained in:
parent
f2daa8a975
commit
91793bce16
2 changed files with 8 additions and 5 deletions
|
@ -15,6 +15,7 @@
|
||||||
- (Feature) Gateway config loader
|
- (Feature) Gateway config loader
|
||||||
- (Feature) ConfigV1 Integration Service
|
- (Feature) ConfigV1 Integration Service
|
||||||
- (Feature) Integration Service Authentication
|
- (Feature) Integration Service Authentication
|
||||||
|
- (Improvement) Better panic handling
|
||||||
|
|
||||||
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
|
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
|
||||||
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
|
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// DISCLAIMER
|
// DISCLAIMER
|
||||||
//
|
//
|
||||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -21,6 +21,8 @@
|
||||||
package k8sutil
|
package k8sutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
|
@ -29,7 +31,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
informerLogger = logging.Global().Get("kubernetes-informer")
|
informerLogger = logging.Global().RegisterAndGetLogger("kubernetes-informer", logging.Info)
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResourceWatcher is a helper to watch for events in a specific type
|
// ResourceWatcher is a helper to watch for events in a specific type
|
||||||
|
@ -52,7 +54,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
informerLogger.Interface("error", err).Error("Recovered from panic")
|
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if h.AddFunc != nil {
|
if h.AddFunc != nil {
|
||||||
|
@ -62,7 +64,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
|
||||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
informerLogger.Interface("error", err).Error("Recovered from panic")
|
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if h.UpdateFunc != nil {
|
if h.UpdateFunc != nil {
|
||||||
|
@ -72,7 +74,7 @@ func NewResourceWatcher(getter cache.Getter, resource, namespace string,
|
||||||
DeleteFunc: func(obj interface{}) {
|
DeleteFunc: func(obj interface{}) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
informerLogger.Interface("error", err).Error("Recovered from panic")
|
informerLogger.Interface("error", err).Error("Recovered from panic. Stack trace:", string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if h.DeleteFunc != nil {
|
if h.DeleteFunc != nil {
|
||||||
|
|
Loading…
Reference in a new issue