Skip to content

Commit

Permalink
Add hostPort support
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Leao committed Sep 25, 2018
1 parent c30ede2 commit ee54500
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
VERSION ?= $(shell git describe --tags --always --dirty)
LDFLAGS ?= -X main.version=$(VERSION)

# Download portmap plugin
download-portmap:
mkdir -p tmp/downloads
mkdir -p tmp/plugins
curl -L -o tmp/downloads/cni-plugins-amd64.tgz https://github.com/containernetworking/plugins/releases/download/v0.6.0/cni-plugins-amd64-v0.6.0.tgz
tar -vxf tmp/downloads/cni-plugins-amd64.tgz -C tmp/plugins
cp tmp/plugins/portmap .
rm -rf tmp

# Default to build the Linux binary
build-linux:
GOOS=linux CGO_ENABLED=0 go build -o aws-k8s-agent -ldflags "$(LDFLAGS)"
Expand All @@ -26,7 +35,7 @@ docker-build:
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-vpc-cni-k8s \
--workdir=/usr/src/app/src/github.com/aws/amazon-vpc-cni-k8s \
--env GOPATH=/usr/src/app \
golang:1.10 make build-linux
golang:1.10 make build-linux && make download-portmap


# Build docker image
Expand Down Expand Up @@ -64,3 +73,4 @@ vet:
clean:
rm -f aws-k8s-agent
rm -f aws-cni
rm -f portmap
15 changes: 15 additions & 0 deletions misc/10-aws.conflist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "aws-cni",
"plugins": [
{
"name": "aws-cni",
"type": "aws-cni",
"vethPrefix": "__VETHPREFIX__"
},
{
"type": "portmap",
"capabilities": {"portMappings": true},
"snat": true
}
]
}
5 changes: 0 additions & 5 deletions misc/aws.conf

This file was deleted.

4 changes: 3 additions & 1 deletion scripts/dockerfiles/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ RUN yum update -y && \
WORKDIR /app

COPY aws-cni /app
COPY misc/aws.conf /app
COPY misc/10-aws.conflist /app

COPY portmap /app

COPY aws-k8s-agent /app
COPY scripts/aws-cni-support.sh /app
Expand Down
10 changes: 8 additions & 2 deletions scripts/install-aws.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/usr/bin/env bash
echo "=====Starting installing AWS-CNI ========="
sed -i s/__VETHPREFIX__/${AWS_VPC_K8S_CNI_VETHPREFIX:-"eni"}/g /app/aws.conf
sed -i s/__VETHPREFIX__/${AWS_VPC_K8S_CNI_VETHPREFIX:-"eni"}/g /app/10-aws.conflist
cp /app/aws-cni /host/opt/cni/bin/
cp /app/portmap /host/opt/cni/bin/
cp /app/aws-cni-support.sh /host/opt/cni/bin/
cp /app/aws.conf /host/etc/cni/net.d/
cp /app/10-aws.conflist /host/etc/cni/net.d/

if [[ -f /host/etc/cni/net.d/aws.conf ]]; then
rm /host/etc/cni/net.d/aws.conf
fi

echo "=====Starting amazon-k8s-agent ==========="
/app/aws-k8s-agent

0 comments on commit ee54500

Please sign in to comment.