mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
update kube-proxy
This commit is contained in:
parent
ddfc4d3e58
commit
e340a07ccf
@ -573,7 +573,7 @@ func (s *ProxyServer) Run(ctx context.Context) error {
|
|||||||
go endpointSliceConfig.Run(ctx.Done())
|
go endpointSliceConfig.Run(ctx.Done())
|
||||||
|
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.MultiCIDRServiceAllocator) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.MultiCIDRServiceAllocator) {
|
||||||
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1beta1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
|
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
|
||||||
serviceCIDRConfig.RegisterEventHandler(s.Proxier)
|
serviceCIDRConfig.RegisterEventHandler(s.Proxier)
|
||||||
go serviceCIDRConfig.Run(wait.NeverStop)
|
go serviceCIDRConfig.Run(wait.NeverStop)
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
discoveryv1 "k8s.io/api/discovery/v1"
|
discoveryv1 "k8s.io/api/discovery/v1"
|
||||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
networkingv1 "k8s.io/api/networking/v1"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
v1informers "k8s.io/client-go/informers/core/v1"
|
v1informers "k8s.io/client-go/informers/core/v1"
|
||||||
discoveryv1informers "k8s.io/client-go/informers/discovery/v1"
|
discoveryv1informers "k8s.io/client-go/informers/discovery/v1"
|
||||||
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
|
networkingv1informers "k8s.io/client-go/informers/networking/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
@ -404,7 +404,7 @@ type ServiceCIDRConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewServiceCIDRConfig creates a new ServiceCIDRConfig.
|
// NewServiceCIDRConfig creates a new ServiceCIDRConfig.
|
||||||
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
|
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
|
||||||
result := &ServiceCIDRConfig{
|
result := &ServiceCIDRConfig{
|
||||||
cidrs: sets.New[string](),
|
cidrs: sets.New[string](),
|
||||||
logger: klog.FromContext(ctx),
|
logger: klog.FromContext(ctx),
|
||||||
@ -448,11 +448,11 @@ func (c *ServiceCIDRConfig) Run(stopCh <-chan struct{}) {
|
|||||||
// handleServiceCIDREvent is a helper function to handle Add, Update and Delete
|
// handleServiceCIDREvent is a helper function to handle Add, Update and Delete
|
||||||
// events on ServiceCIDR objects and call downstream event handlers.
|
// events on ServiceCIDR objects and call downstream event handlers.
|
||||||
func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
|
func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
|
||||||
var oldServiceCIDR, newServiceCIDR *networkingv1beta1.ServiceCIDR
|
var oldServiceCIDR, newServiceCIDR *networkingv1.ServiceCIDR
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
if oldObj != nil {
|
if oldObj != nil {
|
||||||
oldServiceCIDR, ok = oldObj.(*networkingv1beta1.ServiceCIDR)
|
oldServiceCIDR, ok = oldObj.(*networkingv1.ServiceCIDR)
|
||||||
if !ok {
|
if !ok {
|
||||||
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", oldObj))
|
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", oldObj))
|
||||||
return
|
return
|
||||||
@ -460,7 +460,7 @@ func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if newObj != nil {
|
if newObj != nil {
|
||||||
newServiceCIDR, ok = newObj.(*networkingv1beta1.ServiceCIDR)
|
newServiceCIDR, ok = newObj.(*networkingv1.ServiceCIDR)
|
||||||
if !ok {
|
if !ok {
|
||||||
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", newObj))
|
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", newObj))
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user