From 4ddd248fede99ede65fb9221e7629f7c8aae5505 Mon Sep 17 00:00:00 2001 From: Claes Mogren Date: Sun, 14 Jun 2020 23:20:22 -0700 Subject: [PATCH] Add bandwidth plugin --- .dockerignore | 1 + Makefile | 4 ++-- cmd/routed-eni-cni-plugin/cni.go | 6 ++---- scripts/dockerfiles/Dockerfile.init | 1 + scripts/dockerfiles/Dockerfile.release | 2 ++ scripts/entrypoint.sh | 2 +- scripts/init.sh | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index d224bb3edd..b33de4ac0c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,5 @@ cni-metrics-helper grpc-health-probe portmap loopback +bandwidth routed-eni-cni-plugin diff --git a/Makefile b/Makefile index 77a648964f..cdc33a33aa 100644 --- a/Makefile +++ b/Makefile @@ -74,9 +74,9 @@ ALLPKGS = $(shell go list ./...) # BINS is the set of built command executables. BINS = aws-k8s-agent aws-cni grpc-health-probe cni-metrics-helper # Plugin binaries -# Not copied: bandwidth bridge dhcp firewall flannel host-device host-local ipvlan macvlan ptp sbr static tuning vlan +# Not copied: bridge dhcp firewall flannel host-device host-local ipvlan macvlan ptp sbr static tuning vlan # For gnu tar, the full path in the tar file is required -PLUGIN_BINS = ./loopback ./portmap +PLUGIN_BINS = ./loopback ./portmap ./bandwidth # DOCKER_ARGS is extra arguments passed during container image build. DOCKER_ARGS = diff --git a/cmd/routed-eni-cni-plugin/cni.go b/cmd/routed-eni-cni-plugin/cni.go index 7e00926b22..6501df7d16 100644 --- a/cmd/routed-eni-cni-plugin/cni.go +++ b/cmd/routed-eni-cni-plugin/cni.go @@ -225,10 +225,8 @@ func add(args *skel.CmdArgs, cniTypes typeswrapper.CNITYPES, grpcClient grpcwrap } result := ¤t.Result{ - IPs: ips, - Interfaces: []*current.Interface{ - ¤t.Interface{Name: hostVethName}, - }, + IPs: ips, + Interfaces: []*current.Interface{{Name: hostVethName}}, } return cniTypes.PrintResult(result, conf.CNIVersion) diff --git a/scripts/dockerfiles/Dockerfile.init b/scripts/dockerfiles/Dockerfile.init index f922e34bf9..1b9d77716a 100644 --- a/scripts/dockerfiles/Dockerfile.init +++ b/scripts/dockerfiles/Dockerfile.init @@ -24,6 +24,7 @@ WORKDIR /init COPY --from=builder \ /go/src/github.com/aws/amazon-vpc-cni-k8s/loopback \ /go/src/github.com/aws/amazon-vpc-cni-k8s/portmap \ + /go/src/github.com/aws/amazon-vpc-cni-k8s/bandwidth \ /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni-support.sh \ /go/src/github.com/aws/amazon-vpc-cni-k8s/scripts/init.sh /init/ diff --git a/scripts/dockerfiles/Dockerfile.release b/scripts/dockerfiles/Dockerfile.release index 94b3387a94..7a6ec5c993 100644 --- a/scripts/dockerfiles/Dockerfile.release +++ b/scripts/dockerfiles/Dockerfile.release @@ -28,7 +28,9 @@ WORKDIR /app COPY --from=builder /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni \ /go/src/github.com/aws/amazon-vpc-cni-k8s/misc/10-aws.conflist \ + /go/src/github.com/aws/amazon-vpc-cni-k8s/loopback \ /go/src/github.com/aws/amazon-vpc-cni-k8s/portmap \ + /go/src/github.com/aws/amazon-vpc-cni-k8s/bandwidth \ /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-cni-support.sh \ /go/src/github.com/aws/amazon-vpc-cni-k8s/aws-k8s-agent \ /go/src/github.com/aws/amazon-vpc-cni-k8s/grpc-health-probe \ diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 2789bcb5e5..ae880167a1 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -62,7 +62,7 @@ wait_for_ipam() { if [[ "$AWS_VPC_K8S_CNI_CONFIGURE_RPFILTER" != "false" ]]; then # Copy files echo "Copying CNI plugin binaries ... " - PLUGIN_BINS="portmap aws-cni-support.sh" + PLUGIN_BINS="loopback portmap bandwidth aws-cni-support.sh" for b in $PLUGIN_BINS; do # If the file exist, delete it first if [[ -f "$HOST_CNI_BIN_PATH/$b" ]]; then diff --git a/scripts/init.sh b/scripts/init.sh index 8ce1d079f1..4f28ce3033 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -2,7 +2,7 @@ set -euxo pipefail -PLUGIN_BINS="loopback portmap aws-cni-support.sh" +PLUGIN_BINS="loopback portmap bandwidth aws-cni-support.sh" for b in $PLUGIN_BINS; do if [ ! -f "$b" ]; then