mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
set service-ip-repair-controller wait time match with etcd dial timeout
This commit is contained in:
parent
9d140b136c
commit
fc07c23b73
@ -156,13 +156,14 @@ func (c *Repair) doRunOnce() error {
|
||||
snapshotByFamily := make(map[v1.IPFamily]*api.RangeAllocation)
|
||||
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 {
|
||||
// get snapshot if it is not there
|
||||
if _, ok := snapshotByFamily[family]; !ok {
|
||||
snapshot, err := allocator.Get()
|
||||
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
|
||||
@ -172,7 +173,7 @@ func (c *Repair) doRunOnce() error {
|
||||
})
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
// important when we start apiserver and etcd at the same time.
|
||||
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()
|
||||
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 {
|
||||
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 snapshot.Range == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user