Skip to content

Commit

Permalink
REORG/MINOR: move k8s types to separate package
Browse files Browse the repository at this point in the history
this will avoid circular dependancies when k8s package is reorganised
  • Loading branch information
oktalz committed May 2, 2024
1 parent 8661cdd commit 2da6465
Show file tree
Hide file tree
Showing 22 changed files with 362 additions and 323 deletions.
6 changes: 3 additions & 3 deletions deploy/tests/integration/base-suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy"
"github.com/haproxytech/kubernetes-ingress/pkg/haproxy/env"
"github.com/haproxytech/kubernetes-ingress/pkg/ingress"
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
"github.com/haproxytech/kubernetes-ingress/pkg/store"
"github.com/haproxytech/kubernetes-ingress/pkg/utils"
"github.com/jessevdk/go-flags"
Expand Down Expand Up @@ -78,7 +78,7 @@ type TestController struct {
TempDir string
Controller *c.HAProxyController
Store store.K8s
EventChan chan k8s.SyncDataEvent
EventChan chan k8ssync.SyncDataEvent
OSArgs utils.OSArgs
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func (suite *BaseSuite) StartController() {
},
}

testController.EventChan = make(chan k8s.SyncDataEvent, watch.DefaultChanSize*6)
testController.EventChan = make(chan k8ssync.SyncDataEvent, watch.DefaultChanSize*6)
testController.Controller = c.NewBuilder().
WithHaproxyCfgFile([]byte(haproxyConfig)).
WithEventChan(testController.EventChan).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"path/filepath"
"strings"

"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
"github.com/haproxytech/kubernetes-ingress/pkg/store"
networkingv1 "k8s.io/api/networking/v1"
)
Expand Down Expand Up @@ -134,8 +134,8 @@ func (suite *DisableConfigSnippetSuite) TestDisableGlobalConfigSnippet() {
suite.setupControllerSnippetArg(tt.controllerSnippetArg)
suite.StartController()
suite.setupTest()
event := k8s.SyncDataEvent{
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithGlobalSnippet(),
event := k8ssync.SyncDataEvent{
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithGlobalSnippet(),
}
suite.disableConfigSnippetFixture(event)
suite.expectSnippet(tt.expectedSnippets)
Expand Down Expand Up @@ -206,8 +206,8 @@ func (suite *DisableConfigSnippetSuite) TestDisableFrontendConfigSnippet() {
suite.setupControllerSnippetArg(tt.controllerSnippetArg)
suite.StartController()
suite.setupTest()
event := k8s.SyncDataEvent{
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithFrontendSnippet(),
event := k8ssync.SyncDataEvent{
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithFrontendSnippet(),
}
suite.disableConfigSnippetFixture(event)
suite.expectSnippet(tt.expectedSnippets)
Expand All @@ -219,39 +219,39 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
tests := []struct {
name string
controllerSnippetArg string
events []k8s.SyncDataEvent
events []k8ssync.SyncDataEvent
expectedSnippets []exceptedSnippet
}{
{
name: "Backend config snippet enabled - Configmap",
controllerSnippetArg: "",
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
expectedSnippets: []exceptedSnippet{{count: 1, comment: getConfigMapComment()}},
},
{
name: "Backend config snippet disabled - 'backend' - Configmap",
controllerSnippetArg: "--disable-config-snippets=backend",
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
expectedSnippets: []exceptedSnippet{{count: 0, comment: getConfigMapComment()}},
},
{
name: "Backend config snippet disabled - 'all' - Configmap",
controllerSnippetArg: "--disable-config-snippets=all",
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
expectedSnippets: []exceptedSnippet{{count: 0, comment: getConfigMapComment()}},
},
{
name: "Backend config snippet disabled - 'global', should not disable - Configmap",
controllerSnippetArg: "--disable-config-snippets=global",
events: []k8s.SyncDataEvent{{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
events: []k8ssync.SyncDataEvent{{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMapWithBackendSnippet()}},
expectedSnippets: []exceptedSnippet{{count: 1, comment: getConfigMapComment()}},
},
{
name: "Backend config snippet enabled - Service, Ingress",
controllerSnippetArg: "",
events: []k8s.SyncDataEvent{
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
events: []k8ssync.SyncDataEvent{
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
},
expectedSnippets: []exceptedSnippet{
{count: 1, comment: getSvcSnippetComment(appNs, serviceName)},
Expand All @@ -261,9 +261,9 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
{
name: "Backend config snippet disabled - 'backend' - Service, Ingress",
controllerSnippetArg: "--disable-config-snippets=backend",
events: []k8s.SyncDataEvent{
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
events: []k8ssync.SyncDataEvent{
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
},
expectedSnippets: []exceptedSnippet{
{count: 0, comment: getSvcSnippetComment(appNs, serviceName)},
Expand All @@ -273,9 +273,9 @@ func (suite *DisableConfigSnippetSuite) TestDisableBackendConfigSnippet() {
{
name: "Backend config snippet disabled - 'frontend' should not disable - Service, Ingress",
controllerSnippetArg: "--disable-config-snippets=frontend",
events: []k8s.SyncDataEvent{
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
events: []k8ssync.SyncDataEvent{
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: newAppSvc()},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: newAppIngress()},
},
expectedSnippets: []exceptedSnippet{
{count: 1, comment: getSvcSnippetComment(appNs, serviceName)},
Expand Down
14 changes: 7 additions & 7 deletions deploy/tests/integration/config-snippet/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

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

ns := store.Namespace{Name: appNs, Status: store.ADDED}
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.NAMESPACE, Namespace: ns.Name, Data: &ns}
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
controllerHasWorked := make(chan struct{})
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
<-controllerHasWorked
}

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

// Now sending store events for test setup
for _, e := range events {
testController.EventChan <- e
}
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
controllerHasWorked := make(chan struct{})
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
<-controllerHasWorked
}
8 changes: 4 additions & 4 deletions deploy/tests/integration/customresources/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ import (
"github.com/haproxytech/client-native/v5/models"
v1 "github.com/haproxytech/kubernetes-ingress/crs/api/ingress/v1"
"github.com/haproxytech/kubernetes-ingress/deploy/tests/integration"
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
"github.com/stretchr/testify/suite"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type CustomResourceSuite struct {
integration.BaseSuite
globalCREvt k8s.SyncDataEvent
globalCREvt k8ssync.SyncDataEvent
}

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

func (suite *CustomResourceSuite) GlobalCRFixture() {
suite.globalCREvt = k8s.SyncDataEvent{
SyncType: k8s.CR_GLOBAL,
suite.globalCREvt = k8ssync.SyncDataEvent{
SyncType: k8ssync.CR_GLOBAL,
Data: &v1.Global{
ObjectMeta: metav1.ObjectMeta{
Name: "fake",
Expand Down
68 changes: 34 additions & 34 deletions deploy/tests/integration/pod-maxconn/pod-maxconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package podmaxconn

import (
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
"github.com/haproxytech/kubernetes-ingress/pkg/store"
networkingv1 "k8s.io/api/networking/v1"
)
Expand All @@ -31,18 +31,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMap() {
cm.Annotations["pod-maxconn"] = "128"
svc := newAppSvc()
ing := newAppIngress()
events := []k8s.SyncDataEvent{
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events := []k8ssync.SyncDataEvent{
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic2",
}},
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
}
suite.fixture(events...)
// Expected occurrences of "default-server check maxconn 64"
Expand All @@ -65,18 +65,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {
cm.Annotations["pod-maxconn"] = "128"
svc := newAppSvc()
ing := newAppIngress()
events := []k8s.SyncDataEvent{
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events := []k8ssync.SyncDataEvent{
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic2",
}},
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
}
suite.fixture(events...)
// Expected occurrences of "default-server check maxconn 64"
Expand All @@ -87,12 +87,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {

// -------------------------------------
// Resend ADDED => should change nothing
events = []k8s.SyncDataEvent{
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events = []k8ssync.SyncDataEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic2",
}},
Expand All @@ -106,12 +106,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {

// -------------------------------------
// SEND MODIFIED => should change nothing
events = []k8s.SyncDataEvent{
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events = []k8ssync.SyncDataEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.MODIFIED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.MODIFIED,
Name: "ic2",
}},
Expand All @@ -125,12 +125,12 @@ func (suite *PodMaxConnSuite) TestPodMaxConnConfigMapMisc() {

// --------------------------------------------------
// Send MODIFIED on a non-existing POD -> should increment
events = []k8s.SyncDataEvent{
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic3", Data: store.PodEvent{
events = []k8ssync.SyncDataEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic3", Data: store.PodEvent{
Status: store.MODIFIED,
Name: "ic3",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic4", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic4", Data: store.PodEvent{
Status: store.MODIFIED,
Name: "ic4",
}},
Expand Down Expand Up @@ -161,18 +161,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnService() {
svc := newAppSvc()
svc.Annotations["pod-maxconn"] = "124"

events := []k8s.SyncDataEvent{
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events := []k8ssync.SyncDataEvent{
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic2",
}},
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
}
suite.fixture(events...)
// -- Expected occurrences of "default-server check maxconn 64" #1 (from configmap)
Expand Down Expand Up @@ -200,18 +200,18 @@ func (suite *PodMaxConnSuite) TestPodMaxConnIngress() {
ing.Annotations["pod-maxconn"] = "126"
svc := newAppSvc()

events := []k8s.SyncDataEvent{
{SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
events := []k8ssync.SyncDataEvent{
{SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: cm},
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic1", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic1",
}},
{SyncType: k8s.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
{SyncType: k8ssync.POD, Namespace: configMapName, Name: "ic2", Data: store.PodEvent{
Status: store.ADDED,
Name: "ic2",
}},
{SyncType: k8s.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8s.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
{SyncType: k8ssync.SERVICE, Namespace: appNs, Name: serviceName, Data: svc},
{SyncType: k8ssync.INGRESS, Namespace: appNs, Name: ingressName, Data: ing},
}
suite.fixture(events...)
// -- Expected occurrences of "default-server check maxconn 64" #1 (from configmap)
Expand Down
18 changes: 9 additions & 9 deletions deploy/tests/integration/pod-maxconn/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"testing"

"github.com/haproxytech/kubernetes-ingress/deploy/tests/integration"
"github.com/haproxytech/kubernetes-ingress/pkg/k8s"
k8ssync "github.com/haproxytech/kubernetes-ingress/pkg/k8s/sync"
"github.com/haproxytech/kubernetes-ingress/pkg/store"
"github.com/stretchr/testify/suite"
)
Expand Down Expand Up @@ -63,26 +63,26 @@ func (suite *PodMaxConnSuite) setupTest() *store.ConfigMap {

ns := store.Namespace{Name: appNs, Status: store.ADDED}
cm := newConfigMap()
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.NAMESPACE, Namespace: ns.Name, Data: &ns}
testController.EventChan <- k8s.SyncDataEvent{
SyncType: k8s.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMap(),
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.NAMESPACE, Namespace: ns.Name, Data: &ns}
testController.EventChan <- k8ssync.SyncDataEvent{
SyncType: k8ssync.CONFIGMAP, Namespace: configMapNamespace, Name: configMapName, Data: newConfigMap(),
}
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
controllerHasWorked := make(chan struct{})
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
<-controllerHasWorked
return cm
}

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

// Now sending store events for test setup
for _, e := range events {
testController.EventChan <- e
}
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND}
controllerHasWorked := make(chan struct{})
testController.EventChan <- k8s.SyncDataEvent{SyncType: k8s.COMMAND, EventProcessed: controllerHasWorked}
testController.EventChan <- k8ssync.SyncDataEvent{SyncType: k8ssync.COMMAND, EventProcessed: controllerHasWorked}
<-controllerHasWorked
}
Loading

0 comments on commit 2da6465

Please sign in to comment.