Support namespaced ingressClass without accessing the IngresClass object and using the annotation.
suggestions: IngressController needn't cluster level permission to access the IngressClass for namespaced Ingress consumer drop annotation "kubernetes.io/ingress.class" from ingress Consumer set the ingressClassName by ingress.Spec.IngressClassName IngressController accept the incoming ingress object when a) IngressController has permission to IngressClass, keep the current implementation. b) IngressController dont' have permission to access the IngressClass but ingress.Spec.IngressClassName is equals to the ingress class name specified by CLI parameter "--ingress-class"
This commit is contained in:
parent
8ede0f777f
commit
61343bbc91
1 changed files with 9 additions and 5 deletions
|
@ -1049,12 +1049,16 @@ func (s *k8sStore) GetService(key string) (*corev1.Service, error) {
|
||||||
|
|
||||||
func (s *k8sStore) GetIngressClass(ing *networkingv1.Ingress, icConfig *ingressclass.Configuration) (string, error) {
|
func (s *k8sStore) GetIngressClass(ing *networkingv1.Ingress, icConfig *ingressclass.Configuration) (string, error) {
|
||||||
// First we try ingressClassName
|
// First we try ingressClassName
|
||||||
if !icConfig.IgnoreIngressClass && ing.Spec.IngressClassName != nil {
|
if ing.Spec.IngressClassName != nil {
|
||||||
iclass, err := s.listers.IngressClass.ByKey(*ing.Spec.IngressClassName)
|
if icConfig.IgnoreIngressClass && icConfig.AnnotationValue == *ing.Spec.IngressClassName {
|
||||||
if err != nil {
|
return *ing.Spec.IngressClassName, nil
|
||||||
return "", err
|
} else {
|
||||||
|
iclass, err := s.listers.IngressClass.ByKey(*ing.Spec.IngressClassName)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return iclass.Name, nil
|
||||||
}
|
}
|
||||||
return iclass.Name, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then we try annotation
|
// Then we try annotation
|
||||||
|
|
Loading…
Reference in a new issue