Refactor equals

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-04-02 10:56:12 -03:00
parent 39ecab8d5a
commit 951f7d7c1b
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
9 changed files with 330 additions and 145 deletions

View file

@ -28,6 +28,7 @@ import (
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
ing_errors "k8s.io/ingress-nginx/internal/ingress/errors"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/sets"
)
// Config returns external authentication configuration for an Ingress rule
@ -62,18 +63,12 @@ func (e1 *Config) Equal(e2 *Config) bool {
if e1.Method != e2.Method {
return false
}
for _, ep1 := range e1.ResponseHeaders {
found := false
for _, ep2 := range e2.ResponseHeaders {
if ep1 == ep2 {
found = true
break
}
}
if !found {
return false
}
match := sets.StringElementsMatch(e1.ResponseHeaders, e2.ResponseHeaders)
if !match {
return false
}
if e1.RequestRedirect != e2.RequestRedirect {
return false
}