Skip to content

Commit 2da6465

Browse files
committed
REORG/MINOR: move k8s types to separate package
this will avoid circular dependancies when k8s package is reorganised
1 parent 8661cdd commit 2da6465

File tree

22 files changed

+362
-323
lines changed

22 files changed

+362
-323
lines changed

deploy/tests/integration/base-suite.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy"
2626
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/env"
2727
"github.com/haproxytech/kubernetes-ingress/pkg/ingress"
28-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
28+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
2929
"github.com/haproxytech/kubernetes-ingress/pkg/store"
3030
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
3131
"github.com/jessevdk/go-flags"
@@ -78,7 +78,7 @@ type TestController struct {
7878
TempDir string
7979
Controller *c.HAProxyController
8080
Store store.K8s
81-
EventChan chan k8s.SyncDataEvent
81+
EventChan chan k8ssync.SyncDataEvent
8282
OSArgs utils.OSArgs
8383
}
8484

@@ -141,7 +141,7 @@ func (suite *BaseSuite) StartController() {
141141
},
142142
}
143143

144-
testController.EventChan = make(chan k8s.SyncDataEvent, watch.DefaultChanSize*6)
144+
testController.EventChan = make(chan k8ssync.SyncDataEvent, watch.DefaultChanSize*6)
145145
testController.Controller = c.NewBuilder().
146146
WithHaproxyCfgFile([]byte(haproxyConfig)).
147147
WithEventChan(testController.EventChan).

deploy/tests/integration/config-snippet/disable_configsnippet_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"path/filepath"
2121
"strings"
2222

23-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
23+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
2424
"github.com/haproxytech/kubernetes-ingress/pkg/store"
2525
networkingv1 "k8s.io/api/networking/v1"
2626
)
@@ -134,8 +134,8 @@ func (suite *DisableConfigSnippetSuite) TestDisableGlobalConfigSnippet() {
134134
suite.setupControllerSnippetArg(tt.controllerSnippetArg)
135135
suite.StartController()
136136
suite.setupTest()
137-
event := k8s.SyncDataEvent{
138-
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithGlobalSnippet(),
137+
event := k8ssync.SyncDataEvent{
138+
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithGlobalSnippet(),
139139
}
140140
suite.disableConfigSnippetFixture(event)
141141
suite.expectSnippet(tt.expectedSnippets)
@@ -206,8 +206,8 @@ func (suite *DisableConfigSnippetSuite) TestDisableFrontendConfigSnippet() {
206206
suite.setupControllerSnippetArg(tt.controllerSnippetArg)
207207
suite.StartController()
208208
suite.setupTest()
209-
event := k8s.SyncDataEvent{
210-
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithFrontendSnippet(),
209+
event := k8ssync.SyncDataEvent{
210+
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithFrontendSnippet(),
211211
}
212212
suite.disableConfigSnippetFixture(event)
213213
suite.expectSnippet(tt.expectedSnippets)
@@ -219,39 +219,39 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
219219
tests := []struct {
220220
name string
221221
controllerSnippetArg string
222-
events []k8s.SyncDataEvent
222+
events []k8ssync.SyncDataEvent
223223
expectedSnippets []exceptedSnippet
224224
}{
225225
{
226226
name: "Backend config snippet enabled - Configmap",
227227
controllerSnippetArg: "",
228-
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
228+
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
229229
expectedSnippets: []exceptedSnippet{{count: 1, comment: getConfigMapComment()}},
230230
},
231231
{
232232
name: "Backend config snippet disabled - 'backend' - Configmap",
233233
controllerSnippetArg: "--disable-config-snippets=backend",
234-
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
234+
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
235235
expectedSnippets: []exceptedSnippet{{count: 0, comment: getConfigMapComment()}},
236236
},
237237
{
238238
name: "Backend config snippet disabled - 'all' - Configmap",
239239
controllerSnippetArg: "--disable-config-snippets=all",
240-
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
240+
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
241241
expectedSnippets: []exceptedSnippet{{count: 0, comment: getConfigMapComment()}},
242242
},
243243
{
244244
name: "Backend config snippet disabled - 'global', should not disable - Configmap",
245245
controllerSnippetArg: "--disable-config-snippets=global",
246-
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
246+
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
247247
expectedSnippets: []exceptedSnippet{{count: 1, comment: getConfigMapComment()}},
248248
},
249249
{
250250
name: "Backend config snippet enabled - Service, Ingress",
251251
controllerSnippetArg: "",
252-
events: []k8s.SyncDataEvent{
253-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
254-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
252+
events: []k8ssync.SyncDataEvent{
253+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
254+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
255255
},
256256
expectedSnippets: []exceptedSnippet{
257257
{count: 1, comment: getSvcSnippetComment(appNs, serviceName)},
@@ -261,9 +261,9 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
261261
{
262262
name: "Backend config snippet disabled - 'backend' - Service, Ingress",
263263
controllerSnippetArg: "--disable-config-snippets=backend",
264-
events: []k8s.SyncDataEvent{
265-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
266-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
264+
events: []k8ssync.SyncDataEvent{
265+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
266+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
267267
},
268268
expectedSnippets: []exceptedSnippet{
269269
{count: 0, comment: getSvcSnippetComment(appNs, serviceName)},
@@ -273,9 +273,9 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
273273
{
274274
name: "Backend config snippet disabled - 'frontend' should not disable - Service, Ingress",
275275
controllerSnippetArg: "--disable-config-snippets=frontend",
276-
events: []k8s.SyncDataEvent{
277-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
278-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
276+
events: []k8ssync.SyncDataEvent{
277+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
278+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
279279
},
280280
expectedSnippets: []exceptedSnippet{
281281
{count: 1, comment: getSvcSnippetComment(appNs, serviceName)},

deploy/tests/integration/config-snippet/suite_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"testing"
1919

2020
"github.com/haproxytech/kubernetes-ingress/deploy/tests/integration"
21-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
21+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
2222
"github.com/haproxytech/kubernetes-ingress/pkg/store"
2323
"github.com/stretchr/testify/suite"
2424
)
@@ -53,22 +53,22 @@ func (suite *DisableConfigSnippetSuite) setupTest() {
5353
testController := suite.TestControllers[suite.T().Name()]
5454

5555
ns := store.Namespace{Name: appNs, Status: store.ADDED}
56-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.NAMESPACE, Namespace: ns.Name, Data: &ns}
57-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
56+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
57+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
5858
controllerHasWorked := make(chan struct{})
59-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
59+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
6060
<-controllerHasWorked
6161
}
6262

63-
func (suite *DisableConfigSnippetSuite) disableConfigSnippetFixture(events ...k8s.SyncDataEvent) {
63+
func (suite *DisableConfigSnippetSuite) disableConfigSnippetFixture(events ...k8ssync.SyncDataEvent) {
6464
testController := suite.TestControllers[suite.T().Name()]
6565

6666
// Now sending store events for test setup
6767
for _, e := range events {
6868
testController.EventChan <- e
6969
}
70-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
70+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
7171
controllerHasWorked := make(chan struct{})
72-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
72+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
7373
<-controllerHasWorked
7474
}

deploy/tests/integration/customresources/suite_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ import (
2020
"github.com/haproxytech/client-native/v5/models"
2121
v1 "github.com/haproxytech/kubernetes-ingress/crs/api/ingress/v1"
2222
"github.com/haproxytech/kubernetes-ingress/deploy/tests/integration"
23-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
23+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
2424
"github.com/stretchr/testify/suite"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
)
2727

2828
type CustomResourceSuite struct {
2929
integration.BaseSuite
30-
globalCREvt k8s.SyncDataEvent
30+
globalCREvt k8ssync.SyncDataEvent
3131
}
3232

3333
func TestCustomResource(t *testing.T) {
3434
suite.Run(t, new(CustomResourceSuite))
3535
}
3636

3737
func (suite *CustomResourceSuite) GlobalCRFixture() {
38-
suite.globalCREvt = k8s.SyncDataEvent{
39-
SyncType: k8s.CR_GLOBAL,
38+
suite.globalCREvt = k8ssync.SyncDataEvent{
39+
SyncType: k8ssync.CR_GLOBAL,
4040
Data: &v1.Global{
4141
ObjectMeta: metav1.ObjectMeta{
4242
Name: "fake",

deploy/tests/integration/pod-maxconn/pod-maxconn_test.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
package podmaxconn
1616

1717
import (
18-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
18+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
1919
"github.com/haproxytech/kubernetes-ingress/pkg/store"
2020
networkingv1 "k8s.io/api/networking/v1"
2121
)
@@ -31,18 +31,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMap() {
3131
cm.Annotations["pod-maxconn"] = "128"
3232
svc := newAppSvc()
3333
ing := newAppIngress()
34-
events := []k8s.SyncDataEvent{
35-
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
36-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
34+
events := []k8ssync.SyncDataEvent{
35+
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
36+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
3737
Status: store.ADDED,
3838
Name: "ic1",
3939
}},
40-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
40+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
4141
Status: store.ADDED,
4242
Name: "ic2",
4343
}},
44-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
45-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
44+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
45+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
4646
}
4747
suite.fixture(events...)
4848
// Expected occurrences of "default-server check maxconn 64"
@@ -65,18 +65,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {
6565
cm.Annotations["pod-maxconn"] = "128"
6666
svc := newAppSvc()
6767
ing := newAppIngress()
68-
events := []k8s.SyncDataEvent{
69-
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
70-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
68+
events := []k8ssync.SyncDataEvent{
69+
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
70+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
7171
Status: store.ADDED,
7272
Name: "ic1",
7373
}},
74-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
74+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
7575
Status: store.ADDED,
7676
Name: "ic2",
7777
}},
78-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
79-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
78+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
79+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
8080
}
8181
suite.fixture(events...)
8282
// Expected occurrences of "default-server check maxconn 64"
@@ -87,12 +87,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {
8787

8888
// -------------------------------------
8989
// Resend ADDED => should change nothing
90-
events = []k8s.SyncDataEvent{
91-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
90+
events = []k8ssync.SyncDataEvent{
91+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
9292
Status: store.ADDED,
9393
Name: "ic1",
9494
}},
95-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
95+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
9696
Status: store.ADDED,
9797
Name: "ic2",
9898
}},
@@ -106,12 +106,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {
106106

107107
// -------------------------------------
108108
// SEND MODIFIED => should change nothing
109-
events = []k8s.SyncDataEvent{
110-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
109+
events = []k8ssync.SyncDataEvent{
110+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
111111
Status: store.MODIFIED,
112112
Name: "ic1",
113113
}},
114-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
114+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
115115
Status: store.MODIFIED,
116116
Name: "ic2",
117117
}},
@@ -125,12 +125,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {
125125

126126
// --------------------------------------------------
127127
// Send MODIFIED on a non-existing POD -> should increment
128-
events = []k8s.SyncDataEvent{
129-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic3", Data: store.PodEvent{
128+
events = []k8ssync.SyncDataEvent{
129+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic3", Data: store.PodEvent{
130130
Status: store.MODIFIED,
131131
Name: "ic3",
132132
}},
133-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic4", Data: store.PodEvent{
133+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic4", Data: store.PodEvent{
134134
Status: store.MODIFIED,
135135
Name: "ic4",
136136
}},
@@ -161,18 +161,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnService() {
161161
svc := newAppSvc()
162162
svc.Annotations["pod-maxconn"] = "124"
163163

164-
events := []k8s.SyncDataEvent{
165-
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
166-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
164+
events := []k8ssync.SyncDataEvent{
165+
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
166+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
167167
Status: store.ADDED,
168168
Name: "ic1",
169169
}},
170-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
170+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
171171
Status: store.ADDED,
172172
Name: "ic2",
173173
}},
174-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
175-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
174+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
175+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
176176
}
177177
suite.fixture(events...)
178178
// -- Expected occurrences of "default-server check maxconn 64" #1 (from configmap)
@@ -200,18 +200,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnIngress() {
200200
ing.Annotations["pod-maxconn"] = "126"
201201
svc := newAppSvc()
202202

203-
events := []k8s.SyncDataEvent{
204-
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
205-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
203+
events := []k8ssync.SyncDataEvent{
204+
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
205+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
206206
Status: store.ADDED,
207207
Name: "ic1",
208208
}},
209-
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
209+
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
210210
Status: store.ADDED,
211211
Name: "ic2",
212212
}},
213-
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
214-
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
213+
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
214+
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
215215
}
216216
suite.fixture(events...)
217217
// -- Expected occurrences of "default-server check maxconn 64" #1 (from configmap)

deploy/tests/integration/pod-maxconn/suite_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"testing"
1919

2020
"github.com/haproxytech/kubernetes-ingress/deploy/tests/integration"
21-
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
21+
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
2222
"github.com/haproxytech/kubernetes-ingress/pkg/store"
2323
"github.com/stretchr/testify/suite"
2424
)
@@ -63,26 +63,26 @@ func (suite *PodMaxConnSuite) setupTest() *store.ConfigMap {
6363

6464
ns := store.Namespace{Name: appNs, Status: store.ADDED}
6565
cm := newConfigMap()
66-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.NAMESPACE, Namespace: ns.Name, Data: &ns}
67-
testController.EventChan <- k8s.SyncDataEvent{
68-
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMap(),
66+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
67+
testController.EventChan <- k8ssync.SyncDataEvent{
68+
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMap(),
6969
}
70-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
70+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
7171
controllerHasWorked := make(chan struct{})
72-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
72+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
7373
<-controllerHasWorked
7474
return cm
7575
}
7676

77-
func (suite *PodMaxConnSuite) fixture(events ...k8s.SyncDataEvent) {
77+
func (suite *PodMaxConnSuite) fixture(events ...k8ssync.SyncDataEvent) {
7878
testController := suite.TestControllers[suite.T().Name()]
7979

8080
// Now sending store events for test setup
8181
for _, e := range events {
8282
testController.EventChan <- e
8383
}
84-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
84+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
8585
controllerHasWorked := make(chan struct{})
86-
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
86+
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
8787
<-controllerHasWorked
8888
}

0 commit comments

Comments
 (0)