mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
commit
5b34d95ec5
@ -236,10 +236,7 @@ func (o *Options) Complete() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates); err != nil {
|
return utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a new filesystem watcher and adds watches for the config file.
|
// Creates a new filesystem watcher and adds watches for the config file.
|
||||||
|
@ -282,7 +282,7 @@ func (ect *EndpointChangeTracker) endpointsToEndpointsMap(endpoints *v1.Endpoint
|
|||||||
// The changes map is cleared after applying them.
|
// The changes map is cleared after applying them.
|
||||||
// In addition it returns (via argument) and resets the lastChangeTriggerTimes for all endpoints
|
// In addition it returns (via argument) and resets the lastChangeTriggerTimes for all endpoints
|
||||||
// that were changed and will result in syncing the proxy rules.
|
// that were changed and will result in syncing the proxy rules.
|
||||||
func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint,
|
func (em EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint,
|
||||||
staleServiceNames *[]ServicePortName, lastChangeTriggerTimes *[]time.Time) {
|
staleServiceNames *[]ServicePortName, lastChangeTriggerTimes *[]time.Time) {
|
||||||
if changes == nil {
|
if changes == nil {
|
||||||
return
|
return
|
||||||
@ -290,8 +290,8 @@ func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndp
|
|||||||
changes.lock.Lock()
|
changes.lock.Lock()
|
||||||
defer changes.lock.Unlock()
|
defer changes.lock.Unlock()
|
||||||
for _, change := range changes.items {
|
for _, change := range changes.items {
|
||||||
endpointsMap.Unmerge(change.previous)
|
em.Unmerge(change.previous)
|
||||||
endpointsMap.Merge(change.current)
|
em.Merge(change.current)
|
||||||
detectStaleConnections(change.previous, change.current, staleEndpoints, staleServiceNames)
|
detectStaleConnections(change.previous, change.current, staleEndpoints, staleServiceNames)
|
||||||
}
|
}
|
||||||
changes.items = make(map[types.NamespacedName]*endpointsChange)
|
changes.items = make(map[types.NamespacedName]*endpointsChange)
|
||||||
|
@ -284,15 +284,15 @@ func (sct *ServiceChangeTracker) serviceToServiceMap(service *v1.Service) Servic
|
|||||||
|
|
||||||
// apply the changes to ServiceMap and update the stale udp cluster IP set. The UDPStaleClusterIP argument is passed in to store the
|
// apply the changes to ServiceMap and update the stale udp cluster IP set. The UDPStaleClusterIP argument is passed in to store the
|
||||||
// udp protocol service cluster ip when service is deleted from the ServiceMap.
|
// udp protocol service cluster ip when service is deleted from the ServiceMap.
|
||||||
func (serviceMap *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) {
|
func (sm *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) {
|
||||||
changes.lock.Lock()
|
changes.lock.Lock()
|
||||||
defer changes.lock.Unlock()
|
defer changes.lock.Unlock()
|
||||||
for _, change := range changes.items {
|
for _, change := range changes.items {
|
||||||
serviceMap.merge(change.current)
|
sm.merge(change.current)
|
||||||
// filter out the Update event of current changes from previous changes before calling unmerge() so that can
|
// filter out the Update event of current changes from previous changes before calling unmerge() so that can
|
||||||
// skip deleting the Update events.
|
// skip deleting the Update events.
|
||||||
change.previous.filter(change.current)
|
change.previous.filter(change.current)
|
||||||
serviceMap.unmerge(change.previous, UDPStaleClusterIP)
|
sm.unmerge(change.previous, UDPStaleClusterIP)
|
||||||
}
|
}
|
||||||
// clear changes after applying them to ServiceMap.
|
// clear changes after applying them to ServiceMap.
|
||||||
changes.items = make(map[types.NamespacedName]*serviceChange)
|
changes.items = make(map[types.NamespacedName]*serviceChange)
|
||||||
|
@ -33,12 +33,12 @@ type NetworkInterfacer interface {
|
|||||||
type RealNetwork struct{}
|
type RealNetwork struct{}
|
||||||
|
|
||||||
// Addrs wraps net.Interface.Addrs(), it's a part of NetworkInterfacer interface.
|
// Addrs wraps net.Interface.Addrs(), it's a part of NetworkInterfacer interface.
|
||||||
func (_ RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) {
|
func (RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) {
|
||||||
return intf.Addrs()
|
return intf.Addrs()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interfaces wraps net.Interfaces(), it's a part of NetworkInterfacer interface.
|
// Interfaces wraps net.Interfaces(), it's a part of NetworkInterfacer interface.
|
||||||
func (_ RealNetwork) Interfaces() ([]net.Interface, error) {
|
func (RealNetwork) Interfaces() ([]net.Interface, error) {
|
||||||
return net.Interfaces()
|
return net.Interfaces()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user