Skip to content

Commit bdf5506

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 integration: CalicoVPP now owns the kube-test manifest as a set of kustomize sources so VPP kube-test (and any other consumer) does not need to know which image to use, where the VPP build lives in this repo or any other CalicoVPP-internal layout detail. - yaml/components/kube-test/ - kustomize coimponent shared by the kind and baremetal flavors. Defines the kube-test daemonset patch, the kube-test configmap defaults and the tigera-operator snippet. - yaml/components/kube-test/kind/ - KinD-flavor adjustments (uplink eth0 via af_packet, no hugepages). - yaml/components/kube-test/baremetal/ - baremetal-flavor adjustments (DPDK uplink driven by ${CALICOVPP_INTERFACE}, hugepages, larger CPU/buffer allocation, docker.io registry, IfNotPresent pull policy). - yaml/overlays/kube-test-{kind,baremetal}/ - overlays wiring the base daemonset and the kube-test components together. - yaml/generated/calico-vpp-kubetest.yaml - regenerated from the kind overlay; consumers see only the runtime placeholders ${CALICOVPP_VERSION}, ${HOME}, ${ADDITIONAL_VPP_CONFIG}, ${CALICOVPP_ENABLE_MEMIF}, ${CALICO_NETWORK_CONFIG} and ${CALICOVPP_INTERFACE} (baremetal only). - yaml/Makefile - regenerates the checked-in kubetest yaml for kind and sanity-checks the baremetal overlay. Top-level Makefile targets (the public API consumed by VPP kube-test): - make vpp - delegates to pkg/vpp-manager with VPP_DIR/BASE pass-through; consumers no longer need to know where VPP build sources live. - make kube-test-template FLAVOR={kind,baremetal} - runs `kubectl kustomize` on the requested overlay and appends the tigera Installation/APIServer snippet (the snippet contains the ${CALICO_NETWORK_CONFIG} placeholder, so it is not a kustomize resource and is concatenated verbatim post-build). - make kube-test-push-images - pulls/tags/pushes each image in $KUBE_TEST_IMAGES (default: calicovpp/vpp) into the local kind registry. Older split-image release branches backport this target with ${KUBE_TEST_IMAGES} as calicovpp/vpp calicovpp/agent calicovpp/multinet-monitor. 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 bca938e commit bdf5506

325 files changed

Lines changed: 1663 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: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,70 @@ 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 self-contained kube-test manifest for the
31+
# the requested cluster flavor. All CalicoVPP-internal layout details
32+
# (image names, in-repo paths to the VPP build output, etc.) are
33+
# resolved here from the kustomize sources under
34+
# yaml/overlays/kube-test-* and baked into the emitted manifest.
35+
#
36+
# Only consumer-owned runtime placeholders survive in the output:
37+
# ${CALICOVPP_VERSION}, ${HOME}, ${ADDITIONAL_VPP_CONFIG},
38+
# ${CALICOVPP_ENABLE_MEMIF}, ${CALICO_NETWORK_CONFIG} and
39+
# ${CALICOVPP_INTERFACE} (baremetal only)
40+
#
41+
# The consumer (e.g. VPP `extras/kube-test`) does NOT need to know
42+
# which image to use or where the VPP build lives in this repo.
43+
#
44+
# Usage:
45+
# make kube-test-template FLAVOR=kind # default
46+
# make kube-test-template FLAVOR=baremetal
47+
FLAVOR ?= kind
48+
.PHONY: kube-test-template
49+
kube-test-template:
50+
@if [ "$(FLAVOR)" != "kind" ] && [ "$(FLAVOR)" != "baremetal" ]; then \
51+
echo "kube-test-template: unsupported FLAVOR=$(FLAVOR) (expected kind or baremetal)" >&2; \
52+
exit 2; \
53+
fi
54+
@kubectl kustomize yaml/overlays/kube-test-$(FLAVOR) 2>/dev/null
55+
@echo "---"
56+
@cat yaml/components/kube-test/tigera-installation.snippet.yaml
57+
58+
# kube-test-push-images: pull the unified calicovpp/vpp image from docker.io
59+
# and push to localhost:5000 for kube-test consumption. Called by the VPP
60+
# kube-test `release-cluster` flow. From v3.33 onwards all binaries ship in
61+
# the single calicovpp/vpp image; split-image release branches (v3.29-v3.32)
62+
# override KUBE_TEST_IMAGES to include calicovpp/agent and multinet-monitor.
63+
KUBE_TEST_IMAGES ?= calicovpp/vpp
64+
.PHONY: kube-test-push-images
65+
kube-test-push-images:
66+
@for img in $(KUBE_TEST_IMAGES); do \
67+
docker pull docker.io/$$img:$(CALICOVPP_VERSION); \
68+
docker image tag docker.io/$$img:$(CALICOVPP_VERSION) localhost:5000/$$img:$(CALICOVPP_VERSION); \
69+
docker push localhost:5000/$$img:$(CALICOVPP_VERSION); \
70+
done
71+
2872
.PHONY: kind-cluster-name
2973
kind-cluster-name:
3074
@echo $(CLUSTER_NAME)
@@ -46,32 +90,26 @@ kind: kind-new-cluster image-kind kind-install-cni
4690

4791
.PHONY: push
4892
push:
49-
$(MAKE) -C calico-vpp-agent $@
50-
$(MAKE) -C vpp-manager $@
51-
$(MAKE) -C multinet-monitor $@
93+
$(MAKE) -C pkg/vpp-manager $@
5294
$(MAKE) -C cmd/calicovppctl $@
5395

5496
.PHONY: dev
5597
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 $@
98+
$(MAKE) -C pkg/vpp-manager ALSO_LATEST=y $@
5999

60100
.PHONY: clean-vpp
61101
clean-vpp:
62-
$(MAKE) -C vpp-manager clean-vpp
102+
$(MAKE) -C pkg/vpp-manager clean-vpp
63103

64104
.PHONY: proto
65105
proto:
66-
$(MAKE) -C calico-vpp-agent $@
106+
$(MAKE) -C pkg/calico-vpp-agent $@
67107

68108
.PHONY: dev.k3s
69109
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
110+
docker save -o /tmp/vpp.tar calicovpp/vpp:latest
111+
sudo k3s ctr images import /tmp/vpp.tar
112+
rm -f /tmp/vpp.tar
75113

76114
.PHONY: dev-kind
77115
dev-kind: dev
@@ -111,9 +149,7 @@ start-test-cluster:
111149

112150
.PHONY: load-images
113151
load-images:
114-
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/agent:latest
115152
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/vpp:latest
116-
$(MAKE) -C test/vagrant load-image -j99 IMG=calicovpp/multinet-monitor:latest
117153

118154
CALICO_INSTALLATION ?= installation-default
119155
.PHONY: test-install-calico
@@ -216,9 +252,9 @@ restart-calicovpp:
216252
kubectl -n calico-vpp-dataplane rollout status ds/calico-vpp-node
217253

218254
.PHONY: goapi
219-
export VPP_DIR ?= $(shell pwd)/vpp-manager/vpp_build
255+
export VPP_DIR ?= $(shell pwd)/vpp_build
220256
goapi:
221-
@go generate -v ./vpplink/generated/
257+
@go generate -v ./pkg/vpplink/generated/
222258

223259
.PHONY: cherry-vpp
224260
cherry-vpp:
@@ -231,13 +267,13 @@ cherry-vpp:
231267
echo "branch : $(shell cd ${VPP_DIR} && git branch --show-current)"; \
232268
echo "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]; \
233269
fi
234-
@BASE=$(BASE) bash ./vpplink/generated/vpp_clone_current.sh ${VPP_DIR}
270+
@BASE=$(BASE) bash ./pkg/vpplink/generated/vpp_clone_current.sh ${VPP_DIR}
235271
@make goapi
236272

237273
.PHONY: cherry-wipe
238274
cherry-wipe:
239-
rm -rf ./vpplink/binapi/.cherries-cache
240-
rm -rf ./vpplink/generated/.cherries-cache
275+
rm -rf ./pkg/vpplink/binapi/.cherries-cache
276+
rm -rf ./pkg/vpplink/generated/.cherries-cache
241277

242278
.PHONY: yaml
243279
yaml:
@@ -316,14 +352,14 @@ delete-multinet:
316352

317353
.PHONY: lint
318354
lint:
319-
test -d ${VPP_DATAPLANE_DIR}/vpp-manager/vpp_build && touch ${VPP_DATAPLANE_DIR}/vpp-manager/vpp_build/go.mod || true
355+
test -d ${VPP_DATAPLANE_DIR}/vpp_build && touch ${VPP_DATAPLANE_DIR}/vpp_build/go.mod || true
320356
go mod tidy --diff || (echo -e "Please run\ngo mod tidy" && exit 1)
321357
gofmt -s -l . | grep -vE '(binapi|vpp_build|vendor)' \
322358
| diff -u /dev/null - \
323359
|| (echo -e "Please run\ngofmt -w ." && exit 1)
324360
golangci-lint run --color=never
325361
markdownlint --dot \
326-
--ignore vpp-manager/vpp_build \
362+
--ignore vpp_build \
327363
--ignore vendor .
328364

329365
.PHONY: cov-html
@@ -374,8 +410,8 @@ builder-image: ## Make dependencies image. (Not required normally; is implied in
374410
test: builder-image
375411
@rm -rf $(shell pwd)/.coverage/unit
376412
@mkdir -p $(shell pwd)/.coverage/unit
377-
$(MAKE) -C vpp-manager image
378-
$(MAKE) -C vpp-manager mock-pod-image
413+
$(MAKE) -C pkg/vpp-manager image
414+
$(MAKE) -C pkg/vpp-manager mock-pod-image
379415
# we prevent parallel test execution as test infra does not currently support parallel VPPs
380416
sudo -E env "PATH=$$PATH" VPP_BINARY=/usr/bin/vpp \
381417
VPP_IMAGE=calicovpp/vpp:$(TAG) \
@@ -393,8 +429,8 @@ test: builder-image
393429
ci-test: builder-image
394430
@rm -rf $(shell pwd)/.coverage/unit
395431
@mkdir -p $(shell pwd)/.coverage/unit
396-
$(MAKE) -C vpp-manager image
397-
$(MAKE) -C vpp-manager mock-pod-image
432+
$(MAKE) -C pkg/vpp-manager image
433+
$(MAKE) -C pkg/vpp-manager mock-pod-image
398434
# we prevent parallel test execution as test infra does not currently support parallel VPPs
399435
docker run -t --rm \
400436
--privileged \
@@ -428,4 +464,3 @@ ci-%: builder-image
428464
.PHONY: depend-image-hash
429465
depend-image-hash:
430466
@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)