Skip to content

Commit 9ff5761

Browse files
committed
Split CNI into watcher/handler under felix
This patch splits the CNI watcher and handlers in two pieces. The handling will be done in the main 'felix' goroutine, while the watching / grpc server will live under watchers/ and not store or access agent state. The intent is to move away from a model with multiple servers replicating state and communicating over a pubsub. This being prone to race conditions, deadlocks, and not providing many benefits as scale & asynchronicity will not be a constraint on nodes with relatively small number of pods (~100) as is k8s default. Signed-off-by: Nathan Skrzypczak <[email protected]>
1 parent c93538b commit 9ff5761

33 files changed

+774
-721
lines changed

calico-vpp-agent/cmd/calico_vpp_dataplane.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"k8s.io/client-go/kubernetes"
3535
"k8s.io/client-go/rest"
3636

37-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/cni"
3837
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/common"
3938
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/connectivity"
4039
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/felix"
@@ -156,12 +155,12 @@ func main() {
156155
localSIDWatcher := watchers.NewLocalSIDWatcher(vpp, clientv3, log.WithFields(logrus.Fields{"subcomponent": "localsid-watcher"}))
157156
felixServer := felix.NewFelixServer(vpp, clientv3, log.WithFields(logrus.Fields{"component": "policy"}))
158157
felixWatcher := watchers.NewFelixWatcher(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "felix watcher"}))
158+
cniServer := watchers.NewCNIServer(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "cni"}))
159159
err = watchers.InstallFelixPlugin()
160160
if err != nil {
161161
log.Fatalf("could not install felix plugin: %s", err)
162162
}
163163
connectivityServer := connectivity.NewConnectivityServer(vpp, felixServer, clientv3, log.WithFields(logrus.Fields{"subcomponent": "connectivity"}))
164-
cniServer := cni.NewCNIServer(vpp, felixServer, log.WithFields(logrus.Fields{"component": "cni"}))
165164

166165
/* Pubsub should now be registered */
167166

@@ -224,7 +223,6 @@ func main() {
224223
serviceServer.SetOurBGPSpec(ourBGPSpec)
225224
localSIDWatcher.SetOurBGPSpec(ourBGPSpec)
226225
netWatcher.SetOurBGPSpec(ourBGPSpec)
227-
cniServer.SetOurBGPSpec(ourBGPSpec)
228226

229227
if *config.GetCalicoVppFeatureGates().MultinetEnabled {
230228
Go(netWatcher.WatchNetworks)
@@ -238,7 +236,6 @@ func main() {
238236
}
239237
}
240238

241-
cniServer.SetFelixConfig(felixConfig)
242239
connectivityServer.SetFelixConfig(felixConfig)
243240

244241
Go(routeWatcher.WatchRoutes)

0 commit comments

Comments
 (0)