mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #126687 from wedaly/automated-cherry-pick-of-#126532-upstream-release-1.31
Automated cherry pick of #126532: kube-proxy: initialization wait for service and endpoint
This commit is contained in:
commit
6572754297
@ -78,11 +78,10 @@ type EndpointSliceConfig struct {
|
|||||||
// NewEndpointSliceConfig creates a new EndpointSliceConfig.
|
// NewEndpointSliceConfig creates a new EndpointSliceConfig.
|
||||||
func NewEndpointSliceConfig(ctx context.Context, endpointSliceInformer discoveryv1informers.EndpointSliceInformer, resyncPeriod time.Duration) *EndpointSliceConfig {
|
func NewEndpointSliceConfig(ctx context.Context, endpointSliceInformer discoveryv1informers.EndpointSliceInformer, resyncPeriod time.Duration) *EndpointSliceConfig {
|
||||||
result := &EndpointSliceConfig{
|
result := &EndpointSliceConfig{
|
||||||
listerSynced: endpointSliceInformer.Informer().HasSynced,
|
logger: klog.FromContext(ctx),
|
||||||
logger: klog.FromContext(ctx),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = endpointSliceInformer.Informer().AddEventHandlerWithResyncPeriod(
|
handlerRegistration, _ := endpointSliceInformer.Informer().AddEventHandlerWithResyncPeriod(
|
||||||
cache.ResourceEventHandlerFuncs{
|
cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: result.handleAddEndpointSlice,
|
AddFunc: result.handleAddEndpointSlice,
|
||||||
UpdateFunc: result.handleUpdateEndpointSlice,
|
UpdateFunc: result.handleUpdateEndpointSlice,
|
||||||
@ -91,6 +90,8 @@ func NewEndpointSliceConfig(ctx context.Context, endpointSliceInformer discovery
|
|||||||
resyncPeriod,
|
resyncPeriod,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
result.listerSynced = handlerRegistration.HasSynced
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,11 +172,10 @@ type ServiceConfig struct {
|
|||||||
// NewServiceConfig creates a new ServiceConfig.
|
// NewServiceConfig creates a new ServiceConfig.
|
||||||
func NewServiceConfig(ctx context.Context, serviceInformer v1informers.ServiceInformer, resyncPeriod time.Duration) *ServiceConfig {
|
func NewServiceConfig(ctx context.Context, serviceInformer v1informers.ServiceInformer, resyncPeriod time.Duration) *ServiceConfig {
|
||||||
result := &ServiceConfig{
|
result := &ServiceConfig{
|
||||||
listerSynced: serviceInformer.Informer().HasSynced,
|
logger: klog.FromContext(ctx),
|
||||||
logger: klog.FromContext(ctx),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = serviceInformer.Informer().AddEventHandlerWithResyncPeriod(
|
handlerRegistration, _ := serviceInformer.Informer().AddEventHandlerWithResyncPeriod(
|
||||||
cache.ResourceEventHandlerFuncs{
|
cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: result.handleAddService,
|
AddFunc: result.handleAddService,
|
||||||
UpdateFunc: result.handleUpdateService,
|
UpdateFunc: result.handleUpdateService,
|
||||||
@ -184,6 +184,8 @@ func NewServiceConfig(ctx context.Context, serviceInformer v1informers.ServiceIn
|
|||||||
resyncPeriod,
|
resyncPeriod,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
result.listerSynced = handlerRegistration.HasSynced
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user