Optimize the judgment mode to remove redundant transformations (#9588)
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
This commit is contained in:
parent
00086ab429
commit
fbdbc24a42
3 changed files with 5 additions and 9 deletions
|
@ -26,11 +26,11 @@ import (
|
|||
// if an object contains invalid configurations that may represent a security risk,
|
||||
// and returning an error in this case
|
||||
func DeepInspect(obj interface{}) error {
|
||||
switch obj.(type) {
|
||||
switch obj := obj.(type) {
|
||||
case *networking.Ingress:
|
||||
return InspectIngress(obj.(*networking.Ingress))
|
||||
return InspectIngress(obj)
|
||||
case *corev1.Service:
|
||||
return InspectService(obj.(*corev1.Service))
|
||||
return InspectService(obj)
|
||||
default:
|
||||
klog.Warningf("received invalid object to inspect: %T", obj)
|
||||
return nil
|
||||
|
|
|
@ -165,7 +165,7 @@ func downloadDatabase(dbName string) error {
|
|||
mmdbFile := dbName + dbExtension
|
||||
|
||||
tarReader := tar.NewReader(archive)
|
||||
for true {
|
||||
for {
|
||||
header, err := tarReader.Next()
|
||||
if err == io.EOF {
|
||||
break
|
||||
|
|
|
@ -76,11 +76,7 @@ func (c1 *Configuration) Equal(c2 *Configuration) bool {
|
|||
}
|
||||
}
|
||||
|
||||
if c1.BackendConfigChecksum != c2.BackendConfigChecksum {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return c1.BackendConfigChecksum == c2.BackendConfigChecksum
|
||||
}
|
||||
|
||||
// Equal tests for equality between two Backend types
|
||||
|
|
Loading…
Reference in a new issue