mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
repairip wait for the default servicecidr
This commit is contained in:
parent
8490273979
commit
418f98aae4
@ -42,6 +42,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
"k8s.io/kubernetes/pkg/api/servicecidr"
|
"k8s.io/kubernetes/pkg/api/servicecidr"
|
||||||
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||||
|
"k8s.io/kubernetes/pkg/controlplane/controller/defaultservicecidr"
|
||||||
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
||||||
"k8s.io/utils/clock"
|
"k8s.io/utils/clock"
|
||||||
netutils "k8s.io/utils/net"
|
netutils "k8s.io/utils/net"
|
||||||
@ -203,6 +204,20 @@ func (r *RepairIPAddress) RunUntil(onFirstSuccess func(), stopCh chan struct{})
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wait for the default ServiceCIDR
|
||||||
|
ctx := wait.ContextForChannel(stopCh)
|
||||||
|
err := wait.PollUntilContextCancel(ctx, 100*time.Millisecond, true, func(context.Context) (bool, error) {
|
||||||
|
_, err := r.serviceCIDRLister.Get(defaultservicecidr.DefaultServiceCIDRName)
|
||||||
|
if err != nil {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
runtime.HandleError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// First sync goes through all the Services and IPAddresses in the cache,
|
// First sync goes through all the Services and IPAddresses in the cache,
|
||||||
// once synced, it signals the main loop and works using the handlers, since
|
// once synced, it signals the main loop and works using the handlers, since
|
||||||
// it's less expensive and more optimal.
|
// it's less expensive and more optimal.
|
||||||
|
Loading…
Reference in New Issue
Block a user