Skip to content

Commit 8134c53

Browse files
committed
refact: move agent binaries to bin/
This patch moves agent binaries to bin/ instead of the same folder as their sources. Signed-off-by: Nathan Skrzypczak <[email protected]>
1 parent 686320e commit 8134c53

File tree

5 files changed

+16
-28
lines changed

5 files changed

+16
-28
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Binaries
2-
calico-vpp-agent/cmd/calico-vpp-agent
3-
calico-vpp-agent/cmd/felix-api-proxy
4-
calico-vpp-agent/cmd/debug
5-
calico-vpp-agent/dep/gobgp
2+
calico-vpp-agent/bin
63
vpp-manager/images/*/vpp-manager
74
vpp-manager/images/*/vppdev.sh
85
vpp-manager/vpp_build/

calico-vpp-agent/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ FROM ubuntu:22.04
22

33
LABEL maintainer="[email protected]"
44

5-
ADD dep/gobgp /bin/gobgp
6-
ADD cmd/debug /bin/debug
5+
ADD bin/gobgp /bin/gobgp
6+
ADD bin/debug /bin/debug
77
ADD version /etc/calicovppversion
8-
ADD cmd/felix-api-proxy /bin/felix-api-proxy
9-
ADD cmd/calico-vpp-agent /bin/calico-vpp-agent
8+
ADD bin/felix-api-proxy /bin/felix-api-proxy
9+
ADD bin/calico-vpp-agent /bin/calico-vpp-agent
1010

1111
ENTRYPOINT ["/bin/calico-vpp-agent"]

calico-vpp-agent/Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@ all: build gobgp image
1111

1212
export GOOS=linux
1313

14+
bin:
15+
mkdir -p bin
16+
1417
# We make felix-api-proxy a static executable as it will run in the calico container
1518
# for which we have less control on the env and glibc version
1619
.PHONY: felix-api-proxy
1720
felix-api-proxy: CGO_ENABLED=0
18-
felix-api-proxy:
19-
${DOCKER_RUN} go build -o ./cmd/felix-api-proxy ./cmd/api-proxy
21+
felix-api-proxy: bin
22+
${DOCKER_RUN} go build -o ./bin/felix-api-proxy ./cmd/api-proxy
2023

21-
build: felix-api-proxy
22-
${DOCKER_RUN} go build -o ./cmd/calico-vpp-agent ./cmd
23-
${DOCKER_RUN} go build -o ./cmd/debug ./cmd/debug-state
24+
build: felix-api-proxy bin
25+
${DOCKER_RUN} go build -o ./bin/calico-vpp-agent ./cmd
26+
${DOCKER_RUN} go build -o ./bin/debug ./cmd/debug-state
2427

2528
gobgp: GOBGP_DIR:=$(shell ${DOCKER_RUN} go list -f '{{.Dir}}' -m github.com/osrg/gobgp/v3)
26-
gobgp:
27-
${DOCKER_RUN} go build -o ./dep/gobgp $(GOBGP_DIR)/cmd/gobgp/
29+
gobgp: bin
30+
${DOCKER_RUN} go build -o ./bin/gobgp $(GOBGP_DIR)/cmd/gobgp/
2831

2932
image: build gobgp
3033
@echo "Image tag : $(TAG)" > $(VERSION_FILE)

calico-vpp-agent/cni/pod_annotations.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,6 @@ func (s *Server) ParseEnableDisableAnnotation(value string) (bool, error) {
109109
}
110110
}
111111

112-
func (s *Server) ParseTrueFalseAnnotation(value string) (bool, error) {
113-
switch value {
114-
case "true":
115-
return true, nil
116-
case "false":
117-
return false, nil
118-
default:
119-
return false, errors.Errorf("Unknown value %s", value)
120-
}
121-
}
122-
123112
func (s *Server) ParseSpoofAddressAnnotation(value string) ([]cnet.IPNet, error) {
124113
var requestedSourcePrefixes []string
125114
var allowedSources []cnet.IPNet

config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package config
1818
import (
1919
"encoding/json"
2020
"fmt"
21-
"io/ioutil"
2221
"net"
2322
"os"
2423
"regexp"
@@ -566,7 +565,7 @@ func (c *LinuxInterfaceState) SortRoutes() {
566565
}
567566

568567
func getCpusetCpu() (string, error) {
569-
content, err := ioutil.ReadFile("/sys/fs/cgroup/cpuset.cpus")
568+
content, err := os.ReadFile("/sys/fs/cgroup/cpuset.cpus")
570569
if err != nil {
571570
if os.IsNotExist(err) {
572571
return "", nil

0 commit comments

Comments
 (0)