mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #126671 from fusida/fix-ipallocator-repair-timeout
set service-ip-repair-controller wait time match with etcd dial timeout
This commit is contained in:
commit
fa75c8c749
@ -156,13 +156,14 @@ func (c *Repair) doRunOnce() error {
|
|||||||
snapshotByFamily := make(map[v1.IPFamily]*api.RangeAllocation)
|
snapshotByFamily := make(map[v1.IPFamily]*api.RangeAllocation)
|
||||||
storedByFamily := make(map[v1.IPFamily]ipallocator.Interface)
|
storedByFamily := make(map[v1.IPFamily]ipallocator.Interface)
|
||||||
|
|
||||||
err := wait.PollImmediate(time.Second, 10*time.Second, func() (bool, error) {
|
err := wait.PollUntilContextTimeout(context.Background(), time.Second, 30*time.Second, true, func(ctx context.Context) (bool, error) {
|
||||||
for family, allocator := range c.allocatorByFamily {
|
for family, allocator := range c.allocatorByFamily {
|
||||||
// get snapshot if it is not there
|
// get snapshot if it is not there
|
||||||
if _, ok := snapshotByFamily[family]; !ok {
|
if _, ok := snapshotByFamily[family]; !ok {
|
||||||
snapshot, err := allocator.Get()
|
snapshot, err := allocator.Get()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
runtime.HandleError(fmt.Errorf("unable to refresh the service IP block: %w", err))
|
||||||
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshotByFamily[family] = snapshot
|
snapshotByFamily[family] = snapshot
|
||||||
@ -172,7 +173,7 @@ func (c *Repair) doRunOnce() error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to refresh the service IP block: %v", err)
|
return fmt.Errorf("unable to refresh the service IP block: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that ranges are assigned
|
// ensure that ranges are assigned
|
||||||
|
@ -112,14 +112,17 @@ func (c *Repair) doRunOnce() error {
|
|||||||
// If etcd server is not running we should wait for some time and fail only then. This is particularly
|
// If etcd server is not running we should wait for some time and fail only then. This is particularly
|
||||||
// important when we start apiserver and etcd at the same time.
|
// important when we start apiserver and etcd at the same time.
|
||||||
var snapshot *api.RangeAllocation
|
var snapshot *api.RangeAllocation
|
||||||
|
|
||||||
err := wait.PollImmediate(time.Second, 10*time.Second, func() (bool, error) {
|
|
||||||
var err error
|
var err error
|
||||||
|
err = wait.PollUntilContextTimeout(context.Background(), time.Second, 30*time.Second, true, func(ctx context.Context) (bool, error) {
|
||||||
snapshot, err = c.alloc.Get()
|
snapshot, err = c.alloc.Get()
|
||||||
return err == nil, err
|
if err != nil {
|
||||||
|
runtime.HandleError(fmt.Errorf("unable to refresh the port allocations: %w", err))
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to refresh the port allocations: %v", err)
|
return fmt.Errorf("unable to refresh the port allocations: %w", err)
|
||||||
}
|
}
|
||||||
// If not yet initialized.
|
// If not yet initialized.
|
||||||
if snapshot.Range == "" {
|
if snapshot.Range == "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user