Merge pull request #92191 from deads2k/azure-panic-protection

prevent panic in azure cloud provider from killing the process
This commit is contained in:
Kubernetes Prow Robot 2020-07-01 23:12:29 -07:00 committed by GitHub
commit a794874fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@ import (
"github.com/Azure/go-autorest/autorest/to"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
cloudprovider "k8s.io/cloud-provider"
"k8s.io/klog/v2"
azcache "k8s.io/legacy-cloud-providers/azure/cache"
@ -90,9 +91,12 @@ func newDelayedRouteUpdater(az *Cloud, interval time.Duration) *delayedRouteUpda
// run starts the updater reconciling loop.
func (d *delayedRouteUpdater) run() {
for {
err := wait.PollImmediateInfinite(d.interval, func() (bool, error) {
d.updateRoutes()
time.Sleep(d.interval)
return false, nil
})
if err != nil { // this should never happen, if it does, panic
panic(err)
}
}