Skip to content

Commit

Permalink
Merge pull request #106 from ewbankkit/issue-90
Browse files Browse the repository at this point in the history
Version cni plugin, ipamD, cni docker image with git tag and hash
  • Loading branch information
mattlandis authored Jul 5, 2018
2 parents cdbd144 + d1302ff commit c903c7b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@

.PHONY: build-linux clean docker docker-build lint unit-test vet

VERSION ?= $(shell git describe --tags --always --dirty)
LDFLAGS ?= -X main.version=$(VERSION)

# Default to build the Linux binary
build-linux:
GOOS=linux CGO_ENABLED=0 go build -o aws-k8s-agent
GOOS=linux CGO_ENABLED=0 go build -o aws-cni ./plugins/routed-eni/
GOOS=linux CGO_ENABLED=0 go build -o aws-k8s-agent -ldflags "$(LDFLAGS)"
GOOS=linux CGO_ENABLED=0 go build -o aws-cni -ldflags "$(LDFLAGS)" ./plugins/routed-eni/

docker-build:
docker run -v $(shell pwd):/usr/src/app/src/github.com/aws/amazon-vpc-cni-k8s \
Expand All @@ -28,8 +31,8 @@ docker-build:

# Build docker image
docker: docker-build
@docker build -f scripts/dockerfiles/Dockerfile.release -t "amazon/amazon-k8s-cni:latest" .
@echo "Built Docker image \"amazon/amazon-k8s-cni:latest\""
@docker build -f scripts/dockerfiles/Dockerfile.release -t "amazon/amazon-k8s-cni:$(VERSION)" .
@echo "Built Docker image \"amazon/amazon-k8s-cni:$(VERSION)\""

# unit-test
unit-test:
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import (

const (
defaultLogFilePath = "/host/var/log/aws-routed-eni/ipamd.log"
version = "1.0.0"
)

var (
version string
)

func main() {
Expand Down
11 changes: 9 additions & 2 deletions plugins/routed-eni/cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"golang.org/x/net/context"
"google.golang.org/grpc"
"net"
"runtime"

"golang.org/x/net/context"
"google.golang.org/grpc"

log "github.com/cihub/seelog"

"github.com/pkg/errors"
Expand All @@ -46,6 +47,10 @@ const (
defaultLogFilePath = "/var/log/aws-routed-eni/plugin.log"
)

var (
version string
)

// NetConf stores the common network config for the CNI plugin
type NetConf struct {
// CNIVersion is the plugin version
Expand Down Expand Up @@ -274,5 +279,7 @@ func main() {
defer log.Flush()
logger.SetupLogger(logger.GetLogFileLocation(defaultLogFilePath))

log.Infof("Starting CNI Plugin %s ...", version)

skel.PluginMain(cmdAdd, cmdDel, cniSpecVersion.All)
}

0 comments on commit c903c7b

Please sign in to comment.