Skip to content

Commit 6aed44d

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 adbe7fe commit 6aed44d

31 files changed

+650
-662
lines changed

calico-vpp-agent/cmd/calico_vpp_dataplane.go

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

38-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/cni"
3938
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/common"
4039
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/connectivity"
4140
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/felix"
@@ -149,12 +148,12 @@ func main() {
149148
localSIDWatcher := watchers.NewLocalSIDWatcher(vpp, clientv3, log.WithFields(logrus.Fields{"subcomponent": "localsid-watcher"}))
150149
felixServer := felix.NewFelixServer(vpp, clientv3, log.WithFields(logrus.Fields{"component": "policy"}))
151150
felixWatcher := watchers.NewFelixWatcher(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "felix watcher"}))
151+
cniServer := watchers.NewCNIServer(felixServer.GetFelixServerEventChan(), log.WithFields(logrus.Fields{"component": "cni"}))
152152
err = watchers.InstallFelixPlugin()
153153
if err != nil {
154154
log.Fatalf("could not install felix plugin: %s", err)
155155
}
156156
connectivityServer := connectivity.NewConnectivityServer(vpp, felixServer, clientv3, log.WithFields(logrus.Fields{"subcomponent": "connectivity"}))
157-
cniServer := cni.NewCNIServer(vpp, felixServer, log.WithFields(logrus.Fields{"component": "cni"}))
158157

159158
/* Pubsub should now be registered */
160159

@@ -189,7 +188,6 @@ func main() {
189188
serviceServer.SetOurBGPSpec(bgpSpec)
190189
localSIDWatcher.SetOurBGPSpec(bgpSpec)
191190
netWatcher.SetOurBGPSpec(bgpSpec)
192-
cniServer.SetOurBGPSpec(bgpSpec)
193191
}
194192

195193
if *config.GetCalicoVppFeatureGates().MultinetEnabled {
@@ -202,7 +200,6 @@ func main() {
202200
if !ok {
203201
panic("ourBGPSpec is not *felixconfig.Config")
204202
}
205-
cniServer.SetFelixConfig(felixCfg)
206203
connectivityServer.SetFelixConfig(felixCfg)
207204
}
208205

0 commit comments

Comments
 (0)