Skip to content

Commit 2edbf2c

Browse files
ivanmatmatiMo3m3n
authored andcommitted
REORG/MINOR: reduce complexity in function called 'supported'
1 parent 421eb4d commit 2edbf2c

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

controller/ingress/ingress.go

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,18 @@ func (i Ingress) supported(k8s store.K8s) (supported bool) {
6767
}
6868
}()
6969

70+
emptyClass := igClassAnn == "" && i.resource.Class == ""
71+
7072
if i.controllerClass == "" {
71-
if igClassAnn == "" && i.resource.Class == "" {
72-
supported = true
73-
return
74-
}
75-
if igClassSpec == CONTROLLER {
76-
supported = true
77-
return
78-
}
73+
supported = emptyClass || igClassSpec == CONTROLLER
7974
} else {
80-
if igClassAnn == "" && i.resource.Class == "" && i.allowEmptyClass {
81-
supported = true
82-
return
83-
}
84-
if igClassAnn == i.controllerClass {
85-
supported = true
86-
return
87-
}
88-
if igClassSpec == filepath.Join(CONTROLLER, i.controllerClass) {
89-
supported = true
90-
return
91-
}
75+
supported = (emptyClass && i.allowEmptyClass) ||
76+
igClassAnn == i.controllerClass ||
77+
igClassSpec == filepath.Join(CONTROLLER, i.controllerClass)
78+
}
79+
if !supported {
80+
i.resource.Ignored = true
9281
}
93-
i.resource.Ignored = true
9482
return
9583
}
9684

0 commit comments

Comments
 (0)