Skip to content

Commit

Permalink
Merge pull request #924 from andreaskaris/bz2031926
Browse files Browse the repository at this point in the history
Bug 2031926: Shared gateway: Modification of ClusterIPs shall trigger svc update
  • Loading branch information
openshift-merge-robot committed Jan 28, 2022
2 parents 0e53cfc + bfdee73 commit 5e1ad49
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions go-controller/pkg/node/gateway_shared_intf.go
Expand Up @@ -504,10 +504,11 @@ func delServiceRules(service *kapi.Service, npw *nodePortWatcher) {
delGatewayIptRules(service, false)
}

func serviceUpdateNeeded(old, new *kapi.Service) bool {
func serviceUpdateNotNeeded(old, new *kapi.Service) bool {
return reflect.DeepEqual(new.Spec.Ports, old.Spec.Ports) &&
reflect.DeepEqual(new.Spec.ExternalIPs, old.Spec.ExternalIPs) &&
reflect.DeepEqual(new.Spec.ClusterIP, old.Spec.ClusterIP) &&
reflect.DeepEqual(new.Spec.ClusterIPs, old.Spec.ClusterIPs) &&
reflect.DeepEqual(new.Spec.Type, old.Spec.Type) &&
reflect.DeepEqual(new.Status.LoadBalancer.Ingress, old.Status.LoadBalancer.Ingress) &&
reflect.DeepEqual(new.Spec.ExternalTrafficPolicy, old.Spec.ExternalTrafficPolicy)
Expand Down Expand Up @@ -543,9 +544,9 @@ func (npw *nodePortWatcher) AddService(service *kapi.Service) {
func (npw *nodePortWatcher) UpdateService(old, new *kapi.Service) {
name := ktypes.NamespacedName{Namespace: old.Namespace, Name: old.Name}

if serviceUpdateNeeded(old, new) {
if serviceUpdateNotNeeded(old, new) {
klog.V(5).Infof("Skipping service update for: %s as change does not apply to any of .Spec.Ports, "+
".Spec.ExternalIP, .Spec.ClusterIP, .Spec.Type, .Status.LoadBalancer.Ingress, .Spec.ExternalTrafficPolicy", new.Name)
".Spec.ExternalIP, .Spec.ClusterIP, .Spec.ClusterIPs, .Spec.Type, .Status.LoadBalancer.Ingress, .Spec.ExternalTrafficPolicy", new.Name)
return
}
// Update the service in svcConfig if we need to so that other handler
Expand Down Expand Up @@ -708,9 +709,9 @@ func (npwipt *nodePortWatcherIptables) AddService(service *kapi.Service) {
}

func (npwipt *nodePortWatcherIptables) UpdateService(old, new *kapi.Service) {
if serviceUpdateNeeded(old, new) {
if serviceUpdateNotNeeded(old, new) {
klog.V(5).Infof("Skipping service update for: %s as change does not apply to any of .Spec.Ports, "+
".Spec.ExternalIP, .Spec.ClusterIP, .Spec.Type, .Status.LoadBalancer.Ingress", new.Name)
".Spec.ExternalIP, .Spec.ClusterIP, .Spec.ClusterIPs, .Spec.Type, .Status.LoadBalancer.Ingress", new.Name)
return
}

Expand Down

0 comments on commit 5e1ad49

Please sign in to comment.