Add new flag to watch ingressclass by name instead of spec (#7609)
This commit is contained in:
parent
89eee0deba
commit
cda59ccc9c
8 changed files with 201 additions and 5 deletions
|
|
@ -426,7 +426,12 @@ func New(
|
|||
ingressClassEventHandler := cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj interface{}) {
|
||||
ingressclass := obj.(*networkingv1.IngressClass)
|
||||
if ingressclass.Spec.Controller != icConfig.Controller {
|
||||
foundClassByName := false
|
||||
if icConfig.IngressClassByName && ingressclass.Name == icConfig.AnnotationValue {
|
||||
klog.InfoS("adding ingressclass as ingress-class-by-name is configured", "ingressclass", klog.KObj(ingressclass))
|
||||
foundClassByName = true
|
||||
}
|
||||
if !foundClassByName && ingressclass.Spec.Controller != icConfig.Controller {
|
||||
klog.InfoS("ignoring ingressclass as the spec.controller is not the same of this ingress", "ingressclass", klog.KObj(ingressclass))
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue