Skip to content

Commit

Permalink
REORG/MINOR: reduce complexity in function called 'supported'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmatmati authored and Mo3m3n committed Nov 12, 2021
1 parent 421eb4d commit 2edbf2c
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions controller/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,18 @@ func (i Ingress) supported(k8s store.K8s) (supported bool) {
}
}()

emptyClass := igClassAnn == "" && i.resource.Class == ""

if i.controllerClass == "" {
if igClassAnn == "" && i.resource.Class == "" {
supported = true
return
}
if igClassSpec == CONTROLLER {
supported = true
return
}
supported = emptyClass || igClassSpec == CONTROLLER
} else {
if igClassAnn == "" && i.resource.Class == "" && i.allowEmptyClass {
supported = true
return
}
if igClassAnn == i.controllerClass {
supported = true
return
}
if igClassSpec == filepath.Join(CONTROLLER, i.controllerClass) {
supported = true
return
}
supported = (emptyClass && i.allowEmptyClass) ||
igClassAnn == i.controllerClass ||
igClassSpec == filepath.Join(CONTROLLER, i.controllerClass)
}
if !supported {
i.resource.Ignored = true
}
i.resource.Ignored = true
return
}

Expand Down

0 comments on commit 2edbf2c

Please sign in to comment.