Fix equals comparsion returing False if both objects have nil Targets or Services.
@@ -149,6 +149,7 @@ func (b1 *Backend) Equal(b2 *Backend) bool {
return false
}
+ if b1.Service != b2.Service {
if b1.Service == nil || b2.Service == nil {
return false
}
@@ -161,6 +162,7 @@ func (b1 *Backend) Equal(b2 *Backend) bool {
if b1.Service.GetResourceVersion() != b2.Service.GetResourceVersion() {
return false
}
+ }
if b1.Port != b2.Port {
return false
@@ -255,6 +257,7 @@ func (e1 *Endpoint) Equal(e2 *Endpoint) bool {
return false
}
+ if e1.Target != e2.Target {
if e1.Target == nil || e2.Target == nil {
return false
}
@@ -264,6 +267,7 @@ func (e1 *Endpoint) Equal(e2 *Endpoint) bool {
if e1.Target.ResourceVersion != e2.Target.ResourceVersion {
return false
}
+ }
return true
}
@@ -336,6 +340,7 @@ func (l1 *Location) Equal(l2 *Location) bool {
return false
}
+ if l1.Service != l2.Service {
if l1.Service == nil || l2.Service == nil {
return false
}
@@ -348,6 +353,7 @@ func (l1 *Location) Equal(l2 *Location) bool {
if l1.Service.GetResourceVersion() != l2.Service.GetResourceVersion() {
return false
}
+ }
if l1.Port.StrVal != l2.Port.StrVal {
return false
@@ -410,6 +416,7 @@ func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool {
return false
}
+ if ptb1.Service != ptb2.Service {
if ptb1.Service == nil || ptb2.Service == nil {
return false
}
@@ -422,6 +429,7 @@ func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool {
if ptb1.Service.GetResourceVersion() != ptb2.Service.GetResourceVersion() {
return false
}
+ }
return true
}
