mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
don't stop informer delivery on error
This commit is contained in:
parent
23226c24d4
commit
2fa93da6d5
@ -1630,6 +1630,10 @@
|
|||||||
"ImportPath": "k8s.io/client-go/util/integer",
|
"ImportPath": "k8s.io/client-go/util/integer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "k8s.io/client-go/util/retry",
|
||||||
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||||
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
||||||
|
4
staging/src/k8s.io/apiserver/Godeps/Godeps.json
generated
4
staging/src/k8s.io/apiserver/Godeps/Godeps.json
generated
@ -1762,6 +1762,10 @@
|
|||||||
"ImportPath": "k8s.io/client-go/util/integer",
|
"ImportPath": "k8s.io/client-go/util/integer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "k8s.io/client-go/util/retry",
|
||||||
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||||
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
||||||
|
@ -83,6 +83,7 @@ go_library(
|
|||||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/tools/pager:go_default_library",
|
"//vendor/k8s.io/client-go/tools/pager:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/util/buffer:go_default_library",
|
"//vendor/k8s.io/client-go/util/buffer:go_default_library",
|
||||||
|
"//vendor/k8s.io/client-go/util/retry:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/util/buffer"
|
"k8s.io/client-go/util/buffer"
|
||||||
|
"k8s.io/client-go/util/retry"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
@ -540,20 +541,35 @@ func (p *processorListener) pop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *processorListener) run() {
|
func (p *processorListener) run() {
|
||||||
defer utilruntime.HandleCrash()
|
// this call blocks until the channel is closed. When a panic happens during the notification
|
||||||
|
// we will catch it, **the offending item will be skipped!**, and after a short delay (one second)
|
||||||
|
// the next notification will be attempted. This is usually better than the alternative of never
|
||||||
|
// delivering again.
|
||||||
|
stopCh := make(chan struct{})
|
||||||
|
wait.Until(func() {
|
||||||
|
// this gives us a few quick retries before a long pause and then a few more quick retries
|
||||||
|
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
|
||||||
|
for next := range p.nextCh {
|
||||||
|
switch notification := next.(type) {
|
||||||
|
case updateNotification:
|
||||||
|
p.handler.OnUpdate(notification.oldObj, notification.newObj)
|
||||||
|
case addNotification:
|
||||||
|
p.handler.OnAdd(notification.newObj)
|
||||||
|
case deleteNotification:
|
||||||
|
p.handler.OnDelete(notification.oldObj)
|
||||||
|
default:
|
||||||
|
utilruntime.HandleError(fmt.Errorf("unrecognized notification: %#v", next))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// the only way to get here is if the p.nextCh is empty and closed
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
|
||||||
for next := range p.nextCh {
|
// the only way to get here is if the p.nextCh is empty and closed
|
||||||
switch notification := next.(type) {
|
if err == nil {
|
||||||
case updateNotification:
|
close(stopCh)
|
||||||
p.handler.OnUpdate(notification.oldObj, notification.newObj)
|
|
||||||
case addNotification:
|
|
||||||
p.handler.OnAdd(notification.newObj)
|
|
||||||
case deleteNotification:
|
|
||||||
p.handler.OnDelete(notification.oldObj)
|
|
||||||
default:
|
|
||||||
utilruntime.HandleError(fmt.Errorf("unrecognized notification: %#v", next))
|
|
||||||
}
|
}
|
||||||
}
|
}, 1*time.Minute, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// shouldResync deterimines if the listener needs a resync. If the listener's resyncPeriod is 0,
|
// shouldResync deterimines if the listener needs a resync. If the listener's resyncPeriod is 0,
|
||||||
|
@ -1614,6 +1614,10 @@
|
|||||||
"ImportPath": "k8s.io/client-go/util/integer",
|
"ImportPath": "k8s.io/client-go/util/integer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "k8s.io/client-go/util/retry",
|
||||||
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go/util/workqueue",
|
"ImportPath": "k8s.io/client-go/util/workqueue",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
@ -1606,6 +1606,10 @@
|
|||||||
"ImportPath": "k8s.io/client-go/util/integer",
|
"ImportPath": "k8s.io/client-go/util/integer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "k8s.io/client-go/util/retry",
|
||||||
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
"ImportPath": "k8s.io/kube-openapi/pkg/builder",
|
||||||
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
"Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3"
|
||||||
|
@ -890,6 +890,10 @@
|
|||||||
"ImportPath": "k8s.io/client-go/util/integer",
|
"ImportPath": "k8s.io/client-go/util/integer",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"ImportPath": "k8s.io/client-go/util/retry",
|
||||||
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "k8s.io/client-go/util/workqueue",
|
"ImportPath": "k8s.io/client-go/util/workqueue",
|
||||||
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
Loading…
Reference in New Issue
Block a user