Skip to content

Commit

Permalink
Merge pull request #167 from polycube-network/pr/use_go_modules
Browse files Browse the repository at this point in the history
pcn-k8s: use go modules to manage dependencies
  • Loading branch information
frisso committed Jul 6, 2019
2 parents 48bf039 + f73f27a commit 3ce24cb
Show file tree
Hide file tree
Showing 5,425 changed files with 218 additions and 2,917,587 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,23 @@ cd /tmp/polycube && \
SUDO="" WORKDIR="/tmp/dev" ./scripts/install.sh $MODE && \
# install pcn-kubernetes only components
if [ "$MODE" = "pcn-k8s" ] ; then \
export GOPATH=$HOME/go && \
go get github.com/containernetworking/plugins/pkg/ip && \
go get k8s.io/client-go/... && \
go get golang.org/x/net/context && \
go get golang.org/x/oauth2 && \
cd /tmp && mkdir -p tmp && cd tmp && \
curl -sS -L https://storage.googleapis.com/kubernetes-release/network-plugins/cni-0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff.tar.gz -o cni.tar.gz && \
tar -xvf cni.tar.gz && \
mkdir /cni && \
cp bin/loopback /cni && \
cd /tmp/polycube/src/components/k8s/cni/ && \
./build.sh && \
cd $HOME/go/src/github.com/polycube-network/polycube/src/components/k8s/cni/conf && \
cd /tmp/polycube/src/components/k8s/cni/polycube && \
GOOS=linux go build -o /opt/cni/bin/polycube . && \
cd /tmp/polycube/src/components/k8s/cni/conf && \
GOOS=linux go build -o /cni-conf . && \
cd $HOME/go/src/github.com/polycube-network/polycube/src/components/k8s/pcn_k8s/ && \
cd /tmp/polycube/src/components/k8s/pcn_k8s/ && \
GOOS=linux go build -o /pcn_k8s . ; \
fi && \
apt-get purge --auto-remove -y git bison cmake flex \
libllvm5.0 llvm-5.0-dev libclang-5.0-dev uuid-dev autoconf \
golang-go libtool curl && \
libtool curl && \
apt-get clean && \
rm -fr /root /var/lib/apt/lists/* /tmp/* /var/tmp/*
rm -fr /root /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/go/*
# TODO: which other apt-get packages can be removed?

ADD src/components/k8s/cni/cni-install.sh /cni-install.sh
Expand Down
10 changes: 9 additions & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ mkdir -p $WORKDIR
$SUDO apt update
$SUDO apt install -y wget gnupg2

echo "Install golang v1.12"
# TODO: v1.12 still not available in repos
wget https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz
$SUDO tar -xvf go1.12.6.linux-amd64.tar.gz
$SUDO mv go /usr/local
$SUDO ln -s /usr/local/go/bin/go /usr/bin

$SUDO sh -c "echo 'deb http://download.opensuse.org/repositories/home:/liberouter/xUbuntu_18.04/ /' > /etc/apt/sources.list.d/home:liberouter.list"
wget -nv https://download.opensuse.org/repositories/home:liberouter/xUbuntu_18.04/Release.key -O Release.key
$SUDO apt-key add - < Release.key
Expand All @@ -75,7 +82,8 @@ PACKAGES+=" bison flex libelf-dev" # bcc dependencies
PACKAGES+=" libllvm5.0 llvm-5.0-dev libclang-5.0-dev" # bpf tools compilation tool chain
PACKAGES+=" libnl-route-3-dev libnl-genl-3-dev" # netlink library
PACKAGES+=" uuid-dev"
PACKAGES+=" golang-go" # needed for polycubectl and pcn-k8s
#PACKAGES+=" golang-go" # needed for polycubectl and pcn-k8s
#PACKAGES+=" golang-1.12-go" # needed for polycubectl and pcn-k8s
PACKAGES+=" pkg-config"
PACKAGES+=" libyang-dev"
PACKAGES+=" autoconf libtool m4 automake"
Expand Down
45 changes: 0 additions & 45 deletions src/components/k8s/cni/build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/k8s/cni/polycube/polycube.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,5 +395,5 @@ func cmdDel(args *skel.CmdArgs) error {
}

func main() {
skel.PluginMain(cmdAdd, cmdDel, version.All)
skel.PluginMain(cmdAdd, nil, cmdDel, version.All, "Polycube CNI plugin")
}
38 changes: 38 additions & 0 deletions src/components/k8s/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module github.com/polycube-network/polycube/src/components/k8s

go 1.12

require (
github.com/aws/aws-sdk-go v1.20.15
github.com/containernetworking/cni v0.7.1
github.com/containernetworking/plugins v0.8.1
github.com/coreos/etcd v3.3.13+incompatible
github.com/coreos/go-iptables v0.4.1 // indirect
github.com/evanphx/json-patch v4.2.0+incompatible // indirect
github.com/gogo/protobuf v1.0.0 // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spf13/pflag v1.0.3 // indirect
github.com/vishvananda/netlink v1.0.0
github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f // indirect
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8 // indirect
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
golang.org/x/text v0.3.2 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
google.golang.org/grpc v1.22.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
k8s.io/api v0.0.0-20190620084959-7cf5895f2711
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a // indirect
)

0 comments on commit 3ce24cb

Please sign in to comment.