Clean out Ingress field in store.Lister struct

This field isn't used anywhere. The ingresses are actually stored
alongside their parsed annotations in the IngressWithAnnotation field.

Signed-off-by: Hervé Werner <dud225@hotmail.com>
This commit is contained in:
Hervé Werner 2023-01-23 16:02:19 +01:00 committed by Hervé Werner
parent dc999d81da
commit aa4106191d
No known key found for this signature in database
GPG key ID: 21D6E057A0A02794
2 changed files with 0 additions and 21 deletions

View file

@ -141,7 +141,6 @@ type Informer struct {
// Lister contains object listers (stores). // Lister contains object listers (stores).
type Lister struct { type Lister struct {
Ingress IngressLister
IngressClass IngressClassLister IngressClass IngressClassLister
Service ServiceLister Service ServiceLister
EndpointSlice EndpointSliceLister EndpointSlice EndpointSliceLister
@ -330,7 +329,6 @@ func New(
) )
store.informers.Ingress = infFactory.Networking().V1().Ingresses().Informer() store.informers.Ingress = infFactory.Networking().V1().Ingresses().Informer()
store.listers.Ingress.Store = store.informers.Ingress.GetStore()
if !icConfig.IgnoreIngressClass { if !icConfig.IgnoreIngressClass {
store.informers.IngressClass = infFactory.Networking().V1().IngressClasses().Informer() store.informers.IngressClass = infFactory.Networking().V1().IngressClasses().Informer()

View file

@ -1389,7 +1389,6 @@ func newStore() *k8sStore {
listers: &Lister{ listers: &Lister{
// add more listers if needed // add more listers if needed
IngressClass: IngressClassLister{cache.NewStore(cache.MetaNamespaceKeyFunc)}, IngressClass: IngressClassLister{cache.NewStore(cache.MetaNamespaceKeyFunc)},
Ingress: IngressLister{cache.NewStore(cache.MetaNamespaceKeyFunc)},
IngressWithAnnotation: IngressWithAnnotationsLister{cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc)}, IngressWithAnnotation: IngressWithAnnotationsLister{cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc)},
}, },
sslStore: NewSSLCertTracker(), sslStore: NewSSLCertTracker(),
@ -1409,18 +1408,12 @@ func TestUpdateSecretIngressMap(t *testing.T) {
Namespace: "testns", Namespace: "testns",
}, },
} }
if err := s.listers.Ingress.Add(ingTpl); err != nil {
t.Errorf("error adding the Ingress template: %v", err)
}
t.Run("with TLS secret", func(t *testing.T) { t.Run("with TLS secret", func(t *testing.T) {
ing := ingTpl.DeepCopy() ing := ingTpl.DeepCopy()
ing.Spec = networking.IngressSpec{ ing.Spec = networking.IngressSpec{
TLS: []networking.IngressTLS{{SecretName: "tls"}}, TLS: []networking.IngressTLS{{SecretName: "tls"}},
} }
if err := s.listers.Ingress.Update(ing); err != nil {
t.Errorf("error updating the Ingress: %v", err)
}
s.updateSecretIngressMap(ing) s.updateSecretIngressMap(ing)
if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/tls")) { if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/tls")) {
@ -1433,9 +1426,6 @@ func TestUpdateSecretIngressMap(t *testing.T) {
ing.ObjectMeta.SetAnnotations(map[string]string{ ing.ObjectMeta.SetAnnotations(map[string]string{
parser.GetAnnotationWithPrefix("auth-secret"): "auth", parser.GetAnnotationWithPrefix("auth-secret"): "auth",
}) })
if err := s.listers.Ingress.Update(ing); err != nil {
t.Errorf("error updating the Ingress: %v", err)
}
s.updateSecretIngressMap(ing) s.updateSecretIngressMap(ing)
if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/auth")) { if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/auth")) {
@ -1448,9 +1438,6 @@ func TestUpdateSecretIngressMap(t *testing.T) {
ing.ObjectMeta.SetAnnotations(map[string]string{ ing.ObjectMeta.SetAnnotations(map[string]string{
parser.GetAnnotationWithPrefix("auth-secret"): "testns/auth", parser.GetAnnotationWithPrefix("auth-secret"): "testns/auth",
}) })
if err := s.listers.Ingress.Update(ing); err != nil {
t.Errorf("error updating the Ingress: %v", err)
}
s.updateSecretIngressMap(ing) s.updateSecretIngressMap(ing)
if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/auth")) { if l := s.secretIngressMap.Len(); !(l == 1 && s.secretIngressMap.Has("testns/auth")) {
@ -1463,9 +1450,6 @@ func TestUpdateSecretIngressMap(t *testing.T) {
ing.ObjectMeta.SetAnnotations(map[string]string{ ing.ObjectMeta.SetAnnotations(map[string]string{
parser.GetAnnotationWithPrefix("auth-secret"): "anotherns/auth", parser.GetAnnotationWithPrefix("auth-secret"): "anotherns/auth",
}) })
if err := s.listers.Ingress.Update(ing); err != nil {
t.Errorf("error updating the Ingress: %v", err)
}
s.updateSecretIngressMap(ing) s.updateSecretIngressMap(ing)
if l := s.secretIngressMap.Len(); l != 0 { if l := s.secretIngressMap.Len(); l != 0 {
@ -1478,9 +1462,6 @@ func TestUpdateSecretIngressMap(t *testing.T) {
ing.ObjectMeta.SetAnnotations(map[string]string{ ing.ObjectMeta.SetAnnotations(map[string]string{
parser.GetAnnotationWithPrefix("auth-secret"): "ns/name/garbage", parser.GetAnnotationWithPrefix("auth-secret"): "ns/name/garbage",
}) })
if err := s.listers.Ingress.Update(ing); err != nil {
t.Errorf("error updating the Ingress: %v", err)
}
s.updateSecretIngressMap(ing) s.updateSecretIngressMap(ing)
if l := s.secretIngressMap.Len(); l != 0 { if l := s.secretIngressMap.Len(); l != 0 {