Skip to content

Commit

Permalink
Merge pull request kubernetes#126689 from wedaly/automated-cherry-pic…
Browse files Browse the repository at this point in the history
…k-of-#126532-upstream-release-1.29

Automated cherry pick of kubernetes#126532: kube-proxy: initialization wait for service and endpoint
  • Loading branch information
k8s-ci-robot authored Aug 28, 2024
2 parents 32f2b29 + c8ead7a commit 80c1fd3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/proxy/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ type EndpointSliceConfig struct {

// NewEndpointSliceConfig creates a new EndpointSliceConfig.
func NewEndpointSliceConfig(endpointSliceInformer discoveryinformers.EndpointSliceInformer, resyncPeriod time.Duration) *EndpointSliceConfig {
result := &EndpointSliceConfig{
listerSynced: endpointSliceInformer.Informer().HasSynced,
}
result := &EndpointSliceConfig{}

endpointSliceInformer.Informer().AddEventHandlerWithResyncPeriod(
handlerRegistration, _ := endpointSliceInformer.Informer().AddEventHandlerWithResyncPeriod(
cache.ResourceEventHandlerFuncs{
AddFunc: result.handleAddEndpointSlice,
UpdateFunc: result.handleUpdateEndpointSlice,
Expand All @@ -84,6 +82,8 @@ func NewEndpointSliceConfig(endpointSliceInformer discoveryinformers.EndpointSli
resyncPeriod,
)

result.listerSynced = handlerRegistration.HasSynced

return result
}

Expand Down Expand Up @@ -162,11 +162,9 @@ type ServiceConfig struct {

// NewServiceConfig creates a new ServiceConfig.
func NewServiceConfig(serviceInformer coreinformers.ServiceInformer, resyncPeriod time.Duration) *ServiceConfig {
result := &ServiceConfig{
listerSynced: serviceInformer.Informer().HasSynced,
}
result := &ServiceConfig{}

serviceInformer.Informer().AddEventHandlerWithResyncPeriod(
handlerRegistration, _ := serviceInformer.Informer().AddEventHandlerWithResyncPeriod(
cache.ResourceEventHandlerFuncs{
AddFunc: result.handleAddService,
UpdateFunc: result.handleUpdateService,
Expand All @@ -175,6 +173,8 @@ func NewServiceConfig(serviceInformer coreinformers.ServiceInformer, resyncPerio
resyncPeriod,
)

result.listerSynced = handlerRegistration.HasSynced

return result
}

Expand Down

0 comments on commit 80c1fd3

Please sign in to comment.