Skip to content

Commit f7e2a68

Browse files
committed
BUILD/MINOR: move c.SyncData() out to main as go routine and run c.Start() before k.MonitorChanges()
1 parent 63a4b84 commit f7e2a68

5 files changed

Lines changed: 12 additions & 8 deletions

File tree

deploy/tests/tnr/routeacl/suite_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ func (suite *UseBackendSuite) UseBackendFixture() (eventChan chan k8ssync.SyncDa
126126
WithUpdateStatusManager(&updateStatusManager{}).
127127
WithArgs(osArgs).Build()
128128

129-
go controller.Start()
129+
controller.Start()
130+
go controller.SyncData()
130131

131132
// Now sending store events for test setup
132133
ns := store.Namespace{Name: "ns", Status: store.ADDED}
@@ -239,7 +240,8 @@ func (suite *UseBackendSuite) NonWildcardHostFixture() (eventChan chan k8ssync.S
239240
WithUpdateStatusManager(&updateStatusManager{}).
240241
WithArgs(osArgs).Build()
241242

242-
go controller.Start()
243+
controller.Start()
244+
go controller.SyncData()
243245

244246
// Now sending store events for test setup
245247
ns := store.Namespace{Name: "ns", Status: store.ADDED}
@@ -345,7 +347,8 @@ func (suite *UseBackendSuite) WildcardHostFixture() (eventChan chan k8ssync.Sync
345347
WithUpdateStatusManager(&updateStatusManager{}).
346348
WithArgs(osArgs).Build()
347349

348-
go controller.Start()
350+
controller.Start()
351+
go controller.SyncData()
349352

350353
// Now sending store events for test setup
351354
ns := store.Namespace{Name: "ns", Status: store.ADDED}

deploy/tests/ut/acls/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ func (suite *ACLSuite) UseACLFixture() (eventChan chan k8ssync.SyncDataEvent) {
108108
WithUpdateStatusManager(&FakeUpdateSatusManager{}).
109109
WithArgs(osArgs).Build()
110110

111-
go controller.Start()
111+
controller.Start()
112+
go controller.SyncData()
112113

113114
backend := v3.Backend{
114115
ObjectMeta: metav1.ObjectMeta{

deploy/tests/ut/httprequests/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ func (suite *HTTPRequestsSuite) UseHTTPRequestsFixture() (eventChan chan k8ssync
108108
WithUpdateStatusManager(&FakeUpdateSatusManager{}).
109109
WithArgs(osArgs).Build()
110110

111-
go controller.Start()
111+
controller.Start()
112+
go controller.SyncData()
112113

113114
backend := v3.Backend{
114115
ObjectMeta: metav1.ObjectMeta{

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ func main() {
177177

178178
c.SetGatewayAPIInstalled(isGatewayAPIInstalled)
179179

180+
c.Start()
180181
go k.MonitorChanges(eventChan, stop, osArgs, isGatewayAPIInstalled)
181-
go c.Start()
182+
go c.SyncData()
182183
// Catch QUIT signals
183184
signalC := make(chan os.Signal, 1)
184185
signal.Notify(signalC, os.Interrupt, syscall.SIGTERM, syscall.SIGUSR1)

pkg/controller/controller.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ func (c *HAProxyController) Start() {
103103
c.initHandlers()
104104
logger.Error(c.setupHAProxyRules())
105105
logger.Error(os.Chdir(c.haproxy.Env.CfgDir))
106-
107-
c.SyncData()
108106
}
109107

110108
// Stop handles shutting down HAProxyController

0 commit comments

Comments
 (0)