@@ -15,7 +15,6 @@ import (
15
15
16
16
"github.com/haproxytech/client-native/v3/models"
17
17
18
- "github.com/haproxytech/kubernetes-ingress/pkg/ingress"
19
18
"github.com/haproxytech/kubernetes-ingress/pkg/store"
20
19
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
21
20
)
@@ -109,7 +108,7 @@ func (k k8s) getNamespaceInfomer(eventChan chan SyncDataEvent, factory informers
109
108
return informer
110
109
}
111
110
112
- func (k k8s ) getServiceInformer (eventChan chan SyncDataEvent , ingressChan chan ingress. Sync , factory informers.SharedInformerFactory , publishSvc * utils. NamespaceValue ) cache.SharedIndexInformer {
111
+ func (k k8s ) getServiceInformer (eventChan chan SyncDataEvent , factory informers.SharedInformerFactory ) cache.SharedIndexInformer { //nolint:ireturn
113
112
informer := factory .Core ().V1 ().Services ().Informer ()
114
113
informer .AddEventHandler (cache.ResourceEventHandlerFuncs {
115
114
AddFunc : func (obj interface {}) {
@@ -146,7 +145,7 @@ func (k k8s) getServiceInformer(eventChan chan SyncDataEvent, ingressChan chan i
146
145
}
147
146
logger .Tracef ("%s %s: %s" , SERVICE , item .Status , item .Name )
148
147
eventChan <- SyncDataEvent {SyncType : SERVICE , Namespace : item .Namespace , Data : item }
149
- if publishSvc != nil && publishSvc .Namespace == item .Namespace && publishSvc .Name == item .Name {
148
+ if k . publishSvc != nil && k . publishSvc .Namespace == item .Namespace && k . publishSvc .Name == item .Name {
150
149
// item copy because of ADDED handler in events.go which must modify the STATUS based solely on addresses
151
150
itemCopy := * item
152
151
itemCopy .Addresses = getServiceAddresses (data )
@@ -174,7 +173,7 @@ func (k k8s) getServiceInformer(eventChan chan SyncDataEvent, ingressChan chan i
174
173
}
175
174
logger .Tracef ("%s %s: %s" , SERVICE , item .Status , item .Name )
176
175
eventChan <- SyncDataEvent {SyncType : SERVICE , Namespace : item .Namespace , Data : item }
177
- if publishSvc != nil && publishSvc .Namespace == item .Namespace && publishSvc .Name == item .Name {
176
+ if k . publishSvc != nil && k . publishSvc .Namespace == item .Namespace && k . publishSvc .Name == item .Name {
178
177
item .Addresses = getServiceAddresses (data )
179
178
eventChan <- SyncDataEvent {SyncType : PUBLISH_SERVICE , Namespace : data .Namespace , Data : item }
180
179
}
@@ -198,9 +197,7 @@ func (k k8s) getServiceInformer(eventChan chan SyncDataEvent, ingressChan chan i
198
197
logger .Tracef ("forwarding to ExternalName Services for %v is disabled" , data2 )
199
198
return
200
199
}
201
- if k .publishSvc != nil && k .publishSvc .Namespace == data2 .Namespace && k .publishSvc .Name == data2 .Name {
202
- ingressChan <- ingress.Sync {Service : data2 }
203
- }
200
+
204
201
status := store .MODIFIED
205
202
item1 := & store.Service {
206
203
Namespace : data1 .GetNamespace (),
@@ -243,7 +240,7 @@ func (k k8s) getServiceInformer(eventChan chan SyncDataEvent, ingressChan chan i
243
240
logger .Tracef ("%s %s: %s" , SERVICE , item2 .Status , item2 .Name )
244
241
eventChan <- SyncDataEvent {SyncType : SERVICE , Namespace : item2 .Namespace , Data : item2 }
245
242
246
- if publishSvc != nil && publishSvc .Namespace == item2 .Namespace && publishSvc .Name == item2 .Name {
243
+ if k . publishSvc != nil && k . publishSvc .Namespace == item2 .Namespace && k . publishSvc .Name == item2 .Name {
247
244
item2 .Addresses = getServiceAddresses (data2 )
248
245
eventChan <- SyncDataEvent {SyncType : PUBLISH_SERVICE , Namespace : item2 .Namespace , Data : item2 }
249
246
}
0 commit comments