Skip to content

Commit adeb4b5

Browse files
committed
refactor: unify images into calicovpp/vpp and flatten repo layout
- consolidate calicovpp/agent, calicovpp/vpp, calicovpp/multinet-monitor, and calicovpp/init-eks into a single unified calicovpp/vpp image. - restructure source directories under pkg/ for cleaner organization. - move executable entrypoints to top-level cmd/ to allow for building all golang agents from the top-level Makefile. - runtime behavior is unchanged - two separate daemons (agent and vpp) run in separate containers from the same image using command overrides. Changes: - unified image: calicovpp/vpp (contains all binaries) - single env var: CALICO_VPP_IMAGE (replaces CALICO_AGENT_IMAGE, CALICO_VPP_IMAGE, MULTINET_MONITOR_IMAGE) - unified dockerfiles: Dockerfile and Dockerfile.debug now contain all binaries - calico-vpp-agent, felix-api-proxy, gobgp, multinet-monitor, vpp-manager, and init-eks scripts in images/ubuntu/bin/ - top-level Makefile delegates image build through vpp-manager - vpp-manager Makefile builds all Go binaries into unified image - image/push targets removed from agent and multinet-monitor Makefile - manifests updated to calicovpp/vpp with explicit command overrides for agent and multinet-monitor containers - path references in test/ and docs/ updated for pkg/ move - image contexts moved to top-level images/ - helper scripts moved to top-level scripts/ - VPP clone/build directory relocated to top-level vpp_build Changes for VPP kube-test: - added new kube-test manifest (yaml/generated/calico-vpp-kubetest.yaml) - added vpp, kube-test-template and kube-test-push-images Makefile targets Images that remain separate: calicovpp/vclsidecar, calicovpp/ctl Directory Restructure: ├── cmd │   ├── api-proxy │   ├── calico-vpp-agent │   ├── calicovppctl │   ├── multinet-monitor │   ├── replay-trace │   └── vpp-manager ├── common.mk ├── docs ├── images ├── Makefile ├── pkg │   ├── calico-vpp-agent │   ├── config │   ├── multinet-monitor │   ├── vpplink │   └── vpp-manager ├── scripts ├── test ├── vpp_build └── yaml Benefits: - Single image tag to manage across all dataplane components - Reduced bandwidth and storage requirements - No risk of image version drift between components - Simplified CI/CD pipeline - Easier version management and releases Signed-off-by: Aritra Basu <aritrbas+gh@cisco.com>
1 parent f4674d5 commit adeb4b5

316 files changed

Lines changed: 1249 additions & 762 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Binaries
2-
calico-vpp-agent/bin
3-
vpp-manager/images/*/vpp-manager
4-
vpp-manager/images/*/bin
5-
vpp-manager/images/*/artifacts
6-
vpp-manager/images/*/vppdev.sh
7-
vpp-manager/vpp_build/
2+
pkg/calico-vpp-agent/bin
3+
cmd/calicovppctl/bin
4+
images/*/vpp-manager
5+
images/*/bin
6+
images/*/artifacts
7+
images/*/vppdev.sh
8+
vpp_build/
89
*.deb
910
*.so*
10-
multinet-monitor/watcher
11+
pkg/multinet-monitor/watcher
1112
*.tgz
1213
*.tar
1314

@@ -28,10 +29,10 @@ test/vagrant/.vagrant
2829
*.bkp
2930

3031
# build artefacts
31-
calico-vpp-agent/version
32-
vpp-manager/images/ubuntu/version
32+
pkg/calico-vpp-agent/version
33+
images/ubuntu/version
3334
test/scripts/.buildlogs
34-
multinet-monitor/version
35+
pkg/multinet-monitor/version
3536
.coverage/
3637
bin/
3738
vendor/

Makefile

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,46 @@ check-%:
55

66
.PHONY: build
77
build:
8-
$(MAKE) -C calico-vpp-agent $@
9-
$(MAKE) -C vpp-manager $@
10-
$(MAKE) -C multinet-monitor $@
8+
$(MAKE) -C pkg/vpp-manager $@
119
$(MAKE) -C cmd/calicovppctl $@
1210

1311
.PHONY: image images
1412
images: image
1513
image:
16-
$(MAKE) -C calico-vpp-agent $@
17-
$(MAKE) -C vpp-manager $@
18-
$(MAKE) -C multinet-monitor $@
14+
$(MAKE) -C pkg/vpp-manager $@
1915
$(MAKE) -C cmd/calicovppctl $@
2016

2117
.PHONY: image-kind
2218
image-kind: image
23-
@for image in vpp:$(TAG) vpp:dbg-$(TAG) vclsidecar:$(TAG) vclsidecar:dbg-$(TAG) agent:$(TAG) multinet-monitor:$(TAG); do \
19+
@for image in vpp:$(TAG) vpp:dbg-$(TAG) vclsidecar:$(TAG) vclsidecar:dbg-$(TAG); do \
2420
docker image tag calicovpp/$$image localhost:5000/calicovpp/$$image ; \
2521
docker push localhost:5000/calicovpp/$$image ; \
2622
done
2723

24+
# vpp: build VPP from source. VPP_DIR overrides the default build location
25+
# (default: vpp_build/ at the repo root). BASE overrides the VPP commit.
26+
.PHONY: vpp
27+
vpp:
28+
$(MAKE) -C pkg/vpp-manager $@ VPP_DIR=$(VPP_DIR) BASE=$(BASE)
29+
30+
# kube-test-template: emit a KinD manifest template for kube-test.
31+
# Bakes in repo layout-specific values (CALICOVPP_AGENT_IMAGE, VPP_BUILD_REL_PATH)
32+
# so that VPP kube-test does not need to know the repo layout.
33+
# New layout: unified image, VPP build at vpp_build/ (repo root).
34+
.PHONY: kube-test-template
35+
kube-test-template:
36+
@CALICOVPP_AGENT_IMAGE=calicovpp/vpp VPP_BUILD_REL_PATH=vpp_build \
37+
envsubst '$$CALICOVPP_AGENT_IMAGE $$VPP_BUILD_REL_PATH' \
38+
< yaml/generated/calico-vpp-kubetest.yaml
39+
40+
# kube-test-push-images: pull this release's CalicoVPP images from docker.io and push
41+
# to localhost:5000 for kube-test consumption. Called by kube-test release-cluster flow.
42+
.PHONY: kube-test-push-images
43+
kube-test-push-images:
44+
docker pull docker.io/calicovpp/vpp:$(CALICOVPP_VERSION)
45+
docker image tag docker.io/calicovpp/vpp:$(CALICOVPP_VERSION) localhost:5000/calicovpp/vpp:$(CALICOVPP_VERSION)
46+
docker push localhost:5000/calicovpp/vpp:$(CALICOVPP_VERSION)
47+
2848
.PHONY: kind-cluster-name
2949
kind-cluster-name:
3050
@echo $(CLUSTER_NAME)
@@ -46,32 +66,26 @@ kind: kind-new-cluster image-kind kind-install-cni
4666

4767
.PHONY: push
4868
push:
49-
$(MAKE) -C calico-vpp-agent $@
50-
$(MAKE) -C vpp-manager $@
51-
$(MAKE) -C multinet-monitor $@
69+
$(MAKE) -C pkg/vpp-manager $@
5270
$(MAKE) -C cmd/calicovppctl $@
5371

5472
.PHONY: dev
5573
dev:
56-
$(MAKE) -C calico-vpp-agent ALSO_LATEST=y $@
57-
$(MAKE) -C vpp-manager ALSO_LATEST=y $@
58-
$(MAKE) -C multinet-monitor ALSO_LATEST=y $@
74+
$(MAKE) -C pkg/vpp-manager ALSO_LATEST=y $@
5975

6076
.PHONY: clean-vpp
6177
clean-vpp:
62-
$(MAKE) -C vpp-manager clean-vpp
78+
$(MAKE) -C pkg/vpp-manager clean-vpp
6379

6480
.PHONY: proto
6581
proto:
66-
$(MAKE) -C calico-vpp-agent $@
82+
$(MAKE) -C pkg/calico-vpp-agent $@
6783

6884
.PHONY: dev.k3s
6985
dev.k3s: dev
70-
@for x in agent vpp ; do \
71-
docker save -o /tmp/$$x.tar calicovpp/$$x:latest ; \
72-
sudo k3s ctr images import /tmp/$$x.tar ; \
73-
rm -f /tmp/$$x.tar ; \
74-
done
86+
docker save -o /tmp/vpp.tar calicovpp/vpp:latest
87+
sudo k3s ctr images import /tmp/vpp.tar
88+
rm -f /tmp/vpp.tar
7589

7690
.PHONY: dev-kind
7791
dev-kind: dev
@@ -111,9 +125,7 @@ start-test-cluster:
111125

112126
.PHONY: load-images
113127
load-images:
114-
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/agent:latest
115128
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/vpp:latest
116-
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/multinet-monitor:latest
117129

118130
CALICO_INSTALLATION ?= installation-default
119131
.PHONY: test-install-calico
@@ -216,9 +228,9 @@ restart-calicovpp:
216228
kubectl -n calico-vpp-dataplane rollout status ds/calico-vpp-node
217229

218230
.PHONY: goapi
219-
export VPP_DIR ?= $(shell pwd)/vpp-manager/vpp_build
231+
export VPP_DIR ?= $(shell pwd)/vpp_build
220232
goapi:
221-
@go generate -v ./vpplink/generated/
233+
@go generate -v ./pkg/vpplink/generated/
222234

223235
.PHONY: cherry-vpp
224236
cherry-vpp:
@@ -231,13 +243,13 @@ cherry-vpp:
231243
echo "branch : $(shell cd ${VPP_DIR} && git branch --show-current)"; \
232244
echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]; \
233245
fi
234-
@BASE=$(BASE) bash ./vpplink/generated/vpp_clone_current.sh ${VPP_DIR}
246+
@BASE=$(BASE) bash ./pkg/vpplink/generated/vpp_clone_current.sh ${VPP_DIR}
235247
@make goapi
236248

237249
.PHONY: cherry-wipe
238250
cherry-wipe:
239-
rm -rf ./vpplink/binapi/.cherries-cache
240-
rm -rf ./vpplink/generated/.cherries-cache
251+
rm -rf ./pkg/vpplink/binapi/.cherries-cache
252+
rm -rf ./pkg/vpplink/generated/.cherries-cache
241253

242254
.PHONY: yaml
243255
yaml:
@@ -316,14 +328,14 @@ delete-multinet:
316328

317329
.PHONY: lint
318330
lint:
319-
test -d ${VPP_DATAPLANE_DIR}/vpp-manager/vpp_build && touch ${VPP_DATAPLANE_DIR}/vpp-manager/vpp_build/go.mod || true
331+
test -d ${VPP_DATAPLANE_DIR}/vpp_build && touch ${VPP_DATAPLANE_DIR}/vpp_build/go.mod || true
320332
go mod tidy --diff || (echo -e "Please run\ngo mod tidy" && exit 1)
321333
gofmt -s -l . | grep -vE '(binapi|vpp_build|vendor)' \
322334
| diff -u /dev/null - \
323335
|| (echo -e "Please run\ngofmt -w ." && exit 1)
324336
golangci-lint run --color=never
325337
markdownlint --dot \
326-
--ignore vpp-manager/vpp_build \
338+
--ignore vpp_build \
327339
--ignore vendor .
328340

329341
.PHONY: cov-html
@@ -374,8 +386,8 @@ builder-image: ## Make dependencies image. (Not required normally; is implied in
374386
test: builder-image
375387
@rm -rf $(shell pwd)/.coverage/unit
376388
@mkdir -p $(shell pwd)/.coverage/unit
377-
$(MAKE) -C vpp-manager image
378-
$(MAKE) -C vpp-manager mock-pod-image
389+
$(MAKE) -C pkg/vpp-manager image
390+
$(MAKE) -C pkg/vpp-manager mock-pod-image
379391
# we prevent parallel test execution as test infra does not currently support parallel VPPs
380392
sudo -E env "PATH=$$PATH" VPP_BINARY=/usr/bin/vpp \
381393
VPP_IMAGE=calicovpp/vpp:$(TAG) \
@@ -393,8 +405,8 @@ test: builder-image
393405
ci-test: builder-image
394406
@rm -rf $(shell pwd)/.coverage/unit
395407
@mkdir -p $(shell pwd)/.coverage/unit
396-
$(MAKE) -C vpp-manager image
397-
$(MAKE) -C vpp-manager mock-pod-image
408+
$(MAKE) -C pkg/vpp-manager image
409+
$(MAKE) -C pkg/vpp-manager mock-pod-image
398410
# we prevent parallel test execution as test infra does not currently support parallel VPPs
399411
docker run -t --rm \
400412
--privileged \
@@ -428,4 +440,3 @@ ci-%: builder-image
428440
.PHONY: depend-image-hash
429441
depend-image-hash:
430442
@echo $(CI_BUILDER_IMAGE)
431-

calico-vpp-agent/Dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

calico-vpp-agent/Makefile

Lines changed: 0 additions & 49 deletions
This file was deleted.

calico-vpp-agent/cmd/api-proxy/felix-api-proxy.go renamed to cmd/api-proxy/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/sirupsen/logrus"
2626
"gopkg.in/tomb.v2"
2727

28-
"github.com/projectcalico/vpp-dataplane/v3/config"
28+
"github.com/projectcalico/vpp-dataplane/v3/pkg/config"
2929
)
3030

3131
const (

calico-vpp-agent/cmd/calico_vpp_dataplane.go renamed to cmd/calico-vpp-agent/main.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ import (
3636
"k8s.io/client-go/kubernetes"
3737
"k8s.io/client-go/rest"
3838

39-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/cni"
40-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/common"
41-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/connectivity"
42-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/felix"
43-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/health"
44-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/routing"
45-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/services"
46-
"github.com/projectcalico/vpp-dataplane/v3/calico-vpp-agent/watchers"
47-
"github.com/projectcalico/vpp-dataplane/v3/config"
39+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/cni"
40+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/common"
41+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/connectivity"
42+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/felix"
43+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/health"
44+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/routing"
45+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/services"
46+
"github.com/projectcalico/vpp-dataplane/v3/pkg/calico-vpp-agent/watchers"
47+
"github.com/projectcalico/vpp-dataplane/v3/pkg/config"
4848
)
4949

5050
/*

cmd/calicovppctl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include ../../common.mk
22

3-
BIN_DIR = $(VPP_DATAPLANE_DIR)/bin
3+
BIN_DIR = ./bin
44
SNAPSHOTTER_ENABLED := $(shell docker info -f '{{json .DriverStatus }}' | grep snapshotter)
55

66
.PHONY: bin

cmd/multinet-monitor/main.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (C) 2019 Cisco Systems Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
// implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
package main
17+
18+
import (
19+
multinetmonitor "github.com/projectcalico/vpp-dataplane/v3/pkg/multinet-monitor"
20+
)
21+
22+
func main() {
23+
multinetmonitor.Run()
24+
}
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ import (
3535
"go.fd.io/govpp/codec"
3636
"go.fd.io/govpp/core"
3737

38-
_ "github.com/projectcalico/vpp-dataplane/v3/vpplink"
39-
"github.com/projectcalico/vpp-dataplane/v3/vpplink/generated/bindings/af_packet"
40-
"github.com/projectcalico/vpp-dataplane/v3/vpplink/generated/bindings/tapv2"
38+
_ "github.com/projectcalico/vpp-dataplane/v3/pkg/vpplink"
39+
"github.com/projectcalico/vpp-dataplane/v3/pkg/vpplink/generated/bindings/af_packet"
40+
"github.com/projectcalico/vpp-dataplane/v3/pkg/vpplink/generated/bindings/tapv2"
4141
)
4242

4343
var (

0 commit comments

Comments
 (0)