Skip to content

Commit a794874

Browse files
authored
Merge pull request kubernetes#92191 from deads2k/azure-panic-protection
prevent panic in azure cloud provider from killing the process
2 parents ce5c89a + 7f17228 commit a794874

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/azure_routes.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"github.com/Azure/go-autorest/autorest/to"
3030

3131
"k8s.io/apimachinery/pkg/types"
32+
"k8s.io/apimachinery/pkg/util/wait"
3233
cloudprovider "k8s.io/cloud-provider"
3334
"k8s.io/klog/v2"
3435
azcache "k8s.io/legacy-cloud-providers/azure/cache"
@@ -90,9 +91,12 @@ func newDelayedRouteUpdater(az *Cloud, interval time.Duration) *delayedRouteUpda
9091

9192
// run starts the updater reconciling loop.
9293
func (d *delayedRouteUpdater) run() {
93-
for {
94+
err := wait.PollImmediateInfinite(d.interval, func() (bool, error) {
9495
d.updateRoutes()
95-
time.Sleep(d.interval)
96+
return false, nil
97+
})
98+
if err != nil { // this should never happen, if it does, panic
99+
panic(err)
96100
}
97101
}
98102

0 commit comments

Comments
 (0)