Skip to content

Commit 0a5dc4b

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 34b4725 commit 0a5dc4b

30 files changed

+659
-672
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"
@@ -144,12 +143,12 @@ func main() {
144143
localSIDWatcher := watchers.NewLocalSIDWatcher(vpp, clientv3, log.WithFields(logrus.Fields{"subcomponent": "localsid-watcher"}))
145144
felixServer := felix.NewFelixServer(vpp, clientv3, log.WithFields(logrus.Fields{"component": "policy"}))
146145
felixWatcher := watchers.NewFelixWatcher(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "felix watcher"}))
146+
cniServer := watchers.NewCNIServer(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "cni"}))
147147
err = watchers.InstallFelixPlugin()
148148
if err != nil {
149149
log.Fatalf("could not install felix plugin: %s", err)
150150
}
151151
connectivityServer := connectivity.NewConnectivityServer(vpp, felixServer, clientv3, log.WithFields(logrus.Fields{"subcomponent": "connectivity"}))
152-
cniServer := cni.NewCNIServer(vpp, felixServer, log.WithFields(logrus.Fields{"component": "cni"}))
153152

154153
/* Pubsub should now be registered */
155154

@@ -184,7 +183,6 @@ func main() {
184183
serviceServer.SetOurBGPSpec(bgpSpec)
185184
localSIDWatcher.SetOurBGPSpec(bgpSpec)
186185
netWatcher.SetOurBGPSpec(bgpSpec)
187-
cniServer.SetOurBGPSpec(bgpSpec)
188186
}
189187

190188
if *config.GetCalicoVppFeatureGates().MultinetEnabled {
@@ -197,7 +195,6 @@ func main() {
197195
if !ok {
198196
panic("ourBGPSpec is not *felixconfig.Config")
199197
}
200-
cniServer.SetFelixConfig(felixCfg)
201198
connectivityServer.SetFelixConfig(felixCfg)
202199
}
203200

0 commit comments

Comments
 (0)