2018-02-09 10:11:33 +00:00
|
|
|
PROJECT := arangodb_operator
|
|
|
|
SCRIPTDIR := $(shell pwd)
|
|
|
|
ROOTDIR := $(shell cd $(SCRIPTDIR) && pwd)
|
|
|
|
VERSION := $(shell cat $(ROOTDIR)/VERSION)
|
|
|
|
VERSION_MAJOR_MINOR_PATCH := $(shell echo $(VERSION) | cut -f 1 -d '+')
|
|
|
|
VERSION_MAJOR_MINOR := $(shell echo $(VERSION_MAJOR_MINOR_PATCH) | cut -f 1,2 -d '.')
|
|
|
|
VERSION_MAJOR := $(shell echo $(VERSION_MAJOR_MINOR) | cut -f 1 -d '.')
|
|
|
|
COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
DOCKERCLI := $(shell which docker)
|
|
|
|
|
|
|
|
GOBUILDDIR := $(SCRIPTDIR)/.gobuild
|
|
|
|
SRCDIR := $(SCRIPTDIR)
|
2018-05-14 07:13:05 +00:00
|
|
|
CACHEVOL := $(PROJECT)-gocache
|
2018-02-09 10:11:33 +00:00
|
|
|
BINDIR := $(ROOTDIR)/bin
|
2018-02-13 15:06:36 +00:00
|
|
|
VENDORDIR := $(ROOTDIR)/deps
|
2018-07-02 12:58:06 +00:00
|
|
|
DASHBOARDDIR := $(ROOTDIR)/dashboard
|
2018-02-09 10:11:33 +00:00
|
|
|
|
|
|
|
ORGPATH := github.com/arangodb
|
|
|
|
ORGDIR := $(GOBUILDDIR)/src/$(ORGPATH)
|
2018-03-13 15:25:33 +00:00
|
|
|
REPONAME := kube-arangodb
|
2018-02-09 10:11:33 +00:00
|
|
|
REPODIR := $(ORGDIR)/$(REPONAME)
|
|
|
|
REPOPATH := $(ORGPATH)/$(REPONAME)
|
|
|
|
|
|
|
|
GOPATH := $(GOBUILDDIR)
|
2018-02-19 15:11:32 +00:00
|
|
|
GOVERSION := 1.10.0-alpine
|
2018-02-09 10:11:33 +00:00
|
|
|
|
|
|
|
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
|
2018-07-02 12:58:06 +00:00
|
|
|
GOASSETSBUILDER := $(GOBUILDDIR)/bin/go-assets-builder$(shell go env GOEXE)
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-02-20 08:49:01 +00:00
|
|
|
DOCKERFILE := Dockerfile
|
|
|
|
DOCKERTESTFILE := Dockerfile.test
|
2018-06-15 06:16:52 +00:00
|
|
|
DOCKERDURATIONTESTFILE := tests/duration/Dockerfile
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
ifndef LOCALONLY
|
2018-03-12 12:28:19 +00:00
|
|
|
PUSHIMAGES := 1
|
2018-03-12 11:18:50 +00:00
|
|
|
IMAGESHA256 := true
|
|
|
|
else
|
|
|
|
IMAGESHA256 := false
|
|
|
|
endif
|
|
|
|
|
2018-02-20 17:53:33 +00:00
|
|
|
ifdef IMAGETAG
|
2018-03-12 11:18:50 +00:00
|
|
|
IMAGESUFFIX := :$(IMAGETAG)
|
|
|
|
else
|
|
|
|
IMAGESUFFIX := :dev
|
|
|
|
endif
|
|
|
|
|
2018-03-20 07:04:22 +00:00
|
|
|
ifeq ($(MANIFESTSUFFIX),-)
|
|
|
|
# Release setting
|
|
|
|
MANIFESTSUFFIX :=
|
|
|
|
else
|
2018-03-19 10:09:20 +00:00
|
|
|
ifndef MANIFESTSUFFIX
|
|
|
|
MANIFESTSUFFIX := -dev
|
2018-03-12 11:18:50 +00:00
|
|
|
endif
|
2018-03-20 07:04:22 +00:00
|
|
|
endif
|
2018-03-19 10:09:20 +00:00
|
|
|
MANIFESTPATHDEPLOYMENT := manifests/arango-deployment$(MANIFESTSUFFIX).yaml
|
2018-05-18 09:54:53 +00:00
|
|
|
MANIFESTPATHDEPLOYMENTREPLICATION := manifests/arango-deployment-replication$(MANIFESTSUFFIX).yaml
|
2018-03-19 10:09:20 +00:00
|
|
|
MANIFESTPATHSTORAGE := manifests/arango-storage$(MANIFESTSUFFIX).yaml
|
2018-03-29 08:44:57 +00:00
|
|
|
MANIFESTPATHTEST := manifests/arango-test$(MANIFESTSUFFIX).yaml
|
2018-03-12 11:18:50 +00:00
|
|
|
ifndef DEPLOYMENTNAMESPACE
|
|
|
|
DEPLOYMENTNAMESPACE := default
|
2018-02-20 17:53:33 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef OPERATORIMAGE
|
2018-03-19 13:51:31 +00:00
|
|
|
OPERATORIMAGE := $(DOCKERNAMESPACE)/kube-arangodb$(IMAGESUFFIX)
|
2018-02-20 17:53:33 +00:00
|
|
|
endif
|
|
|
|
ifndef TESTIMAGE
|
2018-03-19 13:51:31 +00:00
|
|
|
TESTIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-test$(IMAGESUFFIX)
|
2018-02-20 17:53:33 +00:00
|
|
|
endif
|
2018-06-15 06:16:52 +00:00
|
|
|
ifndef DURATIONTESTIMAGE
|
|
|
|
DURATIONTESTIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-durationtest$(IMAGESUFFIX)
|
|
|
|
endif
|
2018-02-27 08:30:00 +00:00
|
|
|
ifndef ENTERPRISEIMAGE
|
|
|
|
ENTERPRISEIMAGE := $(DEFAULTENTERPRISEIMAGE)
|
|
|
|
endif
|
2018-02-20 17:53:33 +00:00
|
|
|
|
2018-03-30 13:40:11 +00:00
|
|
|
ifndef ALLOWCHAOS
|
|
|
|
ALLOWCHAOS := true
|
|
|
|
endif
|
|
|
|
|
2018-02-09 10:11:33 +00:00
|
|
|
BINNAME := $(PROJECT)
|
|
|
|
BIN := $(BINDIR)/$(BINNAME)
|
2018-02-20 08:49:01 +00:00
|
|
|
TESTBINNAME := $(PROJECT)_test
|
|
|
|
TESTBIN := $(BINDIR)/$(TESTBINNAME)
|
2018-06-15 06:16:52 +00:00
|
|
|
DURATIONTESTBINNAME := $(PROJECT)_duration_test
|
|
|
|
DURATIONTESTBIN := $(BINDIR)/$(DURATIONTESTBINNAME)
|
2018-02-09 10:11:33 +00:00
|
|
|
RELEASE := $(GOBUILDDIR)/bin/release
|
|
|
|
GHRELEASE := $(GOBUILDDIR)/bin/github-release
|
|
|
|
|
2018-03-01 10:15:18 +00:00
|
|
|
TESTLENGTHOPTIONS := -test.short
|
|
|
|
TESTTIMEOUT := 20m
|
|
|
|
ifeq ($(LONG), 1)
|
|
|
|
TESTLENGTHOPTIONS :=
|
2018-04-06 08:40:16 +00:00
|
|
|
TESTTIMEOUT := 120m
|
2018-03-01 10:15:18 +00:00
|
|
|
endif
|
2018-03-01 15:10:20 +00:00
|
|
|
ifdef VERBOSE
|
|
|
|
TESTVERBOSEOPTIONS := -v
|
|
|
|
endif
|
2018-02-20 09:58:28 +00:00
|
|
|
|
2018-02-09 10:11:33 +00:00
|
|
|
SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
|
2018-07-02 12:58:06 +00:00
|
|
|
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js' -not -path './test/*')
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: all
|
2018-03-12 12:12:01 +00:00
|
|
|
all: verify-generated build
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-02-09 14:46:14 +00:00
|
|
|
#
|
|
|
|
# Tip: Run `eval $(minikube docker-env)` before calling make if you're developing on minikube.
|
|
|
|
#
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: build
|
|
|
|
build: check-vars docker manifests
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: clean
|
2018-02-09 10:11:33 +00:00
|
|
|
clean:
|
2018-07-02 16:24:42 +00:00
|
|
|
rm -Rf $(BIN) $(BINDIR) $(GOBUILDDIR) $(DASHBOARDDIR)/node_modules
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: check-vars
|
|
|
|
check-vars:
|
|
|
|
ifndef DOCKERNAMESPACE
|
|
|
|
@echo "DOCKERNAMESPACE must be set"
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
@echo "Using docker namespace: $(DOCKERNAMESPACE)"
|
|
|
|
|
|
|
|
.PHONY: deps
|
2018-02-09 10:11:33 +00:00
|
|
|
deps:
|
|
|
|
@${MAKE} -B -s $(GOBUILDDIR)
|
|
|
|
|
2018-02-09 14:27:40 +00:00
|
|
|
$(GOBUILDDIR):
|
2018-07-02 12:58:06 +00:00
|
|
|
# Build pulsar & go-assets-builder from vendor
|
2018-02-09 14:27:40 +00:00
|
|
|
@mkdir -p $(GOBUILDDIR)
|
2018-02-13 15:06:36 +00:00
|
|
|
@ln -sf $(VENDORDIR) $(GOBUILDDIR)/src
|
2018-02-09 14:27:40 +00:00
|
|
|
@GOPATH=$(GOBUILDDIR) go install github.com/pulcy/pulsar
|
2018-07-02 12:58:06 +00:00
|
|
|
@GOPATH=$(GOBUILDDIR) go install github.com/jessevdk/go-assets-builder
|
2018-02-13 15:06:36 +00:00
|
|
|
@rm -Rf $(GOBUILDDIR)/src
|
2018-02-09 14:27:40 +00:00
|
|
|
# Prepare .gobuild directory
|
2018-02-09 10:11:33 +00:00
|
|
|
@mkdir -p $(ORGDIR)
|
2018-02-13 15:06:36 +00:00
|
|
|
@rm -f $(REPODIR) && ln -sf ../../../.. $(REPODIR)
|
|
|
|
GOPATH=$(GOBUILDDIR) $(PULSAR) go flatten -V $(VENDORDIR)
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-05-14 07:13:05 +00:00
|
|
|
$(CACHEVOL):
|
|
|
|
@docker volume create $(CACHEVOL)
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: update-vendor
|
2018-02-09 14:27:40 +00:00
|
|
|
update-vendor:
|
|
|
|
@mkdir -p $(GOBUILDDIR)
|
|
|
|
@GOPATH=$(GOBUILDDIR) go get github.com/pulcy/pulsar
|
2018-02-09 10:11:33 +00:00
|
|
|
@rm -Rf $(VENDORDIR)
|
|
|
|
@mkdir -p $(VENDORDIR)
|
|
|
|
@git clone https://github.com/kubernetes/code-generator.git $(VENDORDIR)/k8s.io/code-generator
|
|
|
|
@rm -Rf $(VENDORDIR)/k8s.io/code-generator/.git
|
2018-02-15 10:54:48 +00:00
|
|
|
@$(PULSAR) go vendor -V $(VENDORDIR) \
|
|
|
|
k8s.io/client-go/... \
|
|
|
|
k8s.io/gengo/args \
|
|
|
|
k8s.io/apiextensions-apiserver \
|
2018-03-12 15:18:23 +00:00
|
|
|
github.com/aktau/github-release \
|
2018-03-09 16:02:58 +00:00
|
|
|
github.com/arangodb-helper/go-certificates \
|
2018-02-23 06:43:56 +00:00
|
|
|
github.com/arangodb/go-driver \
|
2018-02-15 10:54:48 +00:00
|
|
|
github.com/cenkalti/backoff \
|
2018-03-12 15:18:23 +00:00
|
|
|
github.com/coreos/go-semver/semver \
|
2018-02-15 10:54:48 +00:00
|
|
|
github.com/dchest/uniuri \
|
2018-02-16 10:46:46 +00:00
|
|
|
github.com/dgrijalva/jwt-go \
|
2018-03-05 10:06:53 +00:00
|
|
|
github.com/julienschmidt/httprouter \
|
2018-02-15 10:54:48 +00:00
|
|
|
github.com/pkg/errors \
|
|
|
|
github.com/prometheus/client_golang/prometheus \
|
|
|
|
github.com/pulcy/pulsar \
|
|
|
|
github.com/rs/zerolog \
|
2018-02-27 12:26:47 +00:00
|
|
|
github.com/spf13/cobra \
|
|
|
|
github.com/stretchr/testify
|
2018-02-09 10:11:33 +00:00
|
|
|
@$(PULSAR) go flatten -V $(VENDORDIR) $(VENDORDIR)
|
|
|
|
@${MAKE} -B -s clean
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: update-generated
|
2018-02-09 10:11:33 +00:00
|
|
|
update-generated: $(GOBUILDDIR)
|
|
|
|
@docker build $(SRCDIR)/tools/codegen --build-arg GOVERSION=$(GOVERSION) -t k8s-codegen
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
-v $(SRCDIR):/usr/code \
|
|
|
|
-e GOPATH=/usr/code/.gobuild \
|
|
|
|
-e GOBIN=/usr/code/.gobuild/bin \
|
|
|
|
-w /usr/code/ \
|
|
|
|
k8s-codegen \
|
2018-02-13 15:06:36 +00:00
|
|
|
"./deps/k8s.io/code-generator/generate-groups.sh" \
|
2018-02-09 10:11:33 +00:00
|
|
|
"all" \
|
2018-03-13 15:25:33 +00:00
|
|
|
"github.com/arangodb/kube-arangodb/pkg/generated" \
|
|
|
|
"github.com/arangodb/kube-arangodb/pkg/apis" \
|
2018-05-18 09:54:53 +00:00
|
|
|
"deployment:v1alpha replication:v1alpha storage:v1alpha" \
|
2018-02-09 10:11:33 +00:00
|
|
|
--go-header-file "./tools/codegen/boilerplate.go.txt" \
|
|
|
|
$(VERIFYARGS)
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: verify-generated
|
2018-02-09 10:11:33 +00:00
|
|
|
verify-generated:
|
|
|
|
@${MAKE} -B -s VERIFYARGS=--verify-only update-generated
|
|
|
|
|
2018-07-02 16:24:42 +00:00
|
|
|
$(DASHBOARDDIR)/node_modules:
|
|
|
|
cd $(DASHBOARDDIR) && npm install
|
|
|
|
|
|
|
|
dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/node_modules
|
2018-07-02 12:58:06 +00:00
|
|
|
cd $(DASHBOARDDIR) && npm run-script build
|
|
|
|
$(GOASSETSBUILDER) -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
|
|
|
|
|
|
|
|
$(BIN): $(GOBUILDDIR) $(CACHEVOL) $(SOURCES) dashboard/assets.go
|
2018-02-09 10:11:33 +00:00
|
|
|
@mkdir -p $(BINDIR)
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
-v $(SRCDIR):/usr/code \
|
2018-05-14 07:13:05 +00:00
|
|
|
-v $(CACHEVOL):/usr/gocache \
|
|
|
|
-e GOCACHE=/usr/gocache \
|
2018-02-09 10:11:33 +00:00
|
|
|
-e GOPATH=/usr/code/.gobuild \
|
2018-02-09 14:27:40 +00:00
|
|
|
-e GOOS=linux \
|
|
|
|
-e GOARCH=amd64 \
|
|
|
|
-e CGO_ENABLED=0 \
|
2018-02-09 10:11:33 +00:00
|
|
|
-w /usr/code/ \
|
|
|
|
golang:$(GOVERSION) \
|
2018-02-09 16:21:06 +00:00
|
|
|
go build -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o /usr/code/bin/$(BINNAME) $(REPOPATH)
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-07-02 12:58:06 +00:00
|
|
|
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker
|
|
|
|
docker: check-vars $(BIN)
|
2018-02-20 17:53:33 +00:00
|
|
|
docker build -f $(DOCKERFILE) -t $(OPERATORIMAGE) .
|
2018-02-22 15:54:36 +00:00
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(OPERATORIMAGE)
|
|
|
|
endif
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
# Manifests
|
|
|
|
|
|
|
|
.PHONY: manifests
|
2018-03-12 12:16:09 +00:00
|
|
|
manifests: $(GOBUILDDIR)
|
|
|
|
GOPATH=$(GOBUILDDIR) go run $(ROOTDIR)/tools/manifests/manifest_builder.go \
|
2018-03-19 10:09:20 +00:00
|
|
|
--output-suffix=$(MANIFESTSUFFIX) \
|
2018-03-12 11:18:50 +00:00
|
|
|
--image=$(OPERATORIMAGE) \
|
|
|
|
--image-sha256=$(IMAGESHA256) \
|
2018-03-30 13:40:11 +00:00
|
|
|
--namespace=$(DEPLOYMENTNAMESPACE) \
|
|
|
|
--allow-chaos=$(ALLOWCHAOS)
|
2018-03-12 11:18:50 +00:00
|
|
|
|
2018-02-20 08:49:01 +00:00
|
|
|
# Testing
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: run-unit-tests
|
2018-02-27 14:32:09 +00:00
|
|
|
run-unit-tests: $(GOBUILDDIR) $(SOURCES)
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
-v $(SRCDIR):/usr/code \
|
2018-05-14 07:13:05 +00:00
|
|
|
-v $(CACHEVOL):/usr/gocache \
|
|
|
|
-e GOCACHE=/usr/gocache \
|
2018-02-27 14:32:09 +00:00
|
|
|
-e GOPATH=/usr/code/.gobuild \
|
|
|
|
-e GOOS=linux \
|
|
|
|
-e GOARCH=amd64 \
|
|
|
|
-e CGO_ENABLED=0 \
|
|
|
|
-w /usr/code/ \
|
|
|
|
golang:$(GOVERSION) \
|
2018-03-01 15:10:20 +00:00
|
|
|
go test $(TESTVERBOSEOPTIONS) \
|
2018-03-13 15:02:32 +00:00
|
|
|
$(REPOPATH)/pkg/apis/deployment/v1alpha \
|
2018-05-18 14:31:31 +00:00
|
|
|
$(REPOPATH)/pkg/apis/replication/v1alpha \
|
2018-03-08 11:30:33 +00:00
|
|
|
$(REPOPATH)/pkg/apis/storage/v1alpha \
|
2018-03-23 11:15:22 +00:00
|
|
|
$(REPOPATH)/pkg/deployment/reconcile \
|
2018-03-27 14:10:48 +00:00
|
|
|
$(REPOPATH)/pkg/deployment/resources \
|
2018-06-08 06:10:05 +00:00
|
|
|
$(REPOPATH)/pkg/storage \
|
2018-03-06 20:16:11 +00:00
|
|
|
$(REPOPATH)/pkg/util/k8sutil \
|
2018-04-05 14:31:27 +00:00
|
|
|
$(REPOPATH)/pkg/util/k8sutil/test \
|
|
|
|
$(REPOPATH)/pkg/util/probe \
|
|
|
|
$(REPOPATH)/pkg/util/validation
|
2018-02-27 14:32:09 +00:00
|
|
|
|
2018-02-20 08:49:01 +00:00
|
|
|
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
|
|
|
|
@mkdir -p $(BINDIR)
|
2018-02-20 09:58:28 +00:00
|
|
|
docker run \
|
2018-02-20 08:49:01 +00:00
|
|
|
--rm \
|
|
|
|
-v $(SRCDIR):/usr/code \
|
2018-05-14 07:13:05 +00:00
|
|
|
-v $(CACHEVOL):/usr/gocache \
|
|
|
|
-e GOCACHE=/usr/gocache \
|
2018-02-20 08:49:01 +00:00
|
|
|
-e GOPATH=/usr/code/.gobuild \
|
|
|
|
-e GOOS=linux \
|
|
|
|
-e GOARCH=amd64 \
|
|
|
|
-e CGO_ENABLED=0 \
|
|
|
|
-w /usr/code/ \
|
|
|
|
golang:$(GOVERSION) \
|
2018-02-27 14:32:09 +00:00
|
|
|
go test -c -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o /usr/code/bin/$(TESTBINNAME) $(REPOPATH)/tests
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker-test
|
2018-02-20 08:49:01 +00:00
|
|
|
docker-test: $(TESTBIN)
|
2018-02-20 17:53:33 +00:00
|
|
|
docker build --quiet -f $(DOCKERTESTFILE) -t $(TESTIMAGE) .
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: run-tests
|
2018-02-20 08:49:01 +00:00
|
|
|
run-tests: docker-test
|
2018-02-20 17:53:33 +00:00
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(OPERATORIMAGE)
|
|
|
|
docker push $(TESTIMAGE)
|
|
|
|
endif
|
2018-03-12 12:44:25 +00:00
|
|
|
ifneq ($(DEPLOYMENTNAMESPACE), default)
|
2018-03-12 11:18:50 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_delete_namespace.sh $(DEPLOYMENTNAMESPACE)
|
|
|
|
kubectl create namespace $(DEPLOYMENTNAMESPACE)
|
2018-03-12 12:44:25 +00:00
|
|
|
endif
|
2018-03-19 14:39:18 +00:00
|
|
|
kubectl apply -f manifests/crd.yaml
|
2018-03-19 10:09:20 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHSTORAGE)
|
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
|
2018-05-18 09:54:53 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
|
2018-03-29 08:44:57 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHTEST)
|
2018-03-12 11:18:50 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
|
2018-03-19 13:45:47 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2018-06-15 06:16:52 +00:00
|
|
|
$(DURATIONTESTBIN): $(GOBUILDDIR) $(SOURCES)
|
|
|
|
@mkdir -p $(BINDIR)
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
-v $(SRCDIR):/usr/code \
|
|
|
|
-v $(CACHEVOL):/usr/gocache \
|
|
|
|
-e GOCACHE=/usr/gocache \
|
|
|
|
-e GOPATH=/usr/code/.gobuild \
|
|
|
|
-e GOOS=linux \
|
|
|
|
-e GOARCH=amd64 \
|
|
|
|
-e CGO_ENABLED=0 \
|
|
|
|
-w /usr/code/ \
|
|
|
|
golang:$(GOVERSION) \
|
|
|
|
go build -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o /usr/code/bin/$(DURATIONTESTBINNAME) $(REPOPATH)/tests/duration
|
|
|
|
|
|
|
|
.PHONY: docker-duration-test
|
|
|
|
docker-duration-test: $(DURATIONTESTBIN)
|
|
|
|
docker build --quiet -f $(DOCKERDURATIONTESTFILE) -t $(DURATIONTESTIMAGE) .
|
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(DURATIONTESTIMAGE)
|
|
|
|
endif
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: cleanup-tests
|
2018-02-27 10:31:27 +00:00
|
|
|
cleanup-tests:
|
2018-03-12 11:18:50 +00:00
|
|
|
ifneq ($(DEPLOYMENTNAMESPACE), default)
|
|
|
|
$(ROOTDIR)/scripts/kube_delete_namespace.sh $(DEPLOYMENTNAMESPACE)
|
|
|
|
endif
|
2018-02-27 10:31:27 +00:00
|
|
|
|
2018-02-20 08:49:01 +00:00
|
|
|
# Release building
|
|
|
|
|
2018-04-03 07:11:44 +00:00
|
|
|
.PHONY: patch-readme
|
|
|
|
patch-readme:
|
|
|
|
$(ROOTDIR)/scripts/patch_readme.sh $(VERSION_MAJOR_MINOR_PATCH)
|
|
|
|
|
2018-04-03 06:47:56 +00:00
|
|
|
.PHONY: update-changelog
|
|
|
|
changelog:
|
2018-04-06 12:17:41 +00:00
|
|
|
docker run --rm \
|
2018-04-03 06:47:56 +00:00
|
|
|
-e CHANGELOG_GITHUB_TOKEN=$(shell cat ~/.arangodb/github-token) \
|
|
|
|
-v "$(ROOTDIR)":/usr/local/src/your-app \
|
|
|
|
ferrarimarco/github-changelog-generator \
|
|
|
|
--user arangodb \
|
|
|
|
--project kube-arangodb \
|
|
|
|
--no-author
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker-push
|
2018-02-09 10:11:33 +00:00
|
|
|
docker-push: docker
|
|
|
|
ifneq ($(DOCKERNAMESPACE), arangodb)
|
2018-02-20 17:53:33 +00:00
|
|
|
docker tag $(OPERATORIMAGE) $(DOCKERNAMESPACE)/arangodb-operator
|
2018-02-09 10:11:33 +00:00
|
|
|
endif
|
|
|
|
docker push $(DOCKERNAMESPACE)/arangodb-operator
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker-push-version
|
2018-02-09 10:11:33 +00:00
|
|
|
docker-push-version: docker
|
|
|
|
docker tag arangodb/arangodb-operator arangodb/arangodb-operator:$(VERSION)
|
|
|
|
docker tag arangodb/arangodb-operator arangodb/arangodb-operator:$(VERSION_MAJOR_MINOR)
|
|
|
|
docker tag arangodb/arangodb-operator arangodb/arangodb-operator:$(VERSION_MAJOR)
|
|
|
|
docker tag arangodb/arangodb-operator arangodb/arangodb-operator:latest
|
|
|
|
docker push arangodb/arangodb-operator:$(VERSION)
|
|
|
|
docker push arangodb/arangodb-operator:$(VERSION_MAJOR_MINOR)
|
|
|
|
docker push arangodb/arangodb-operator:$(VERSION_MAJOR)
|
|
|
|
docker push arangodb/arangodb-operator:latest
|
|
|
|
|
|
|
|
$(RELEASE): $(GOBUILDDIR) $(SOURCES) $(GHRELEASE)
|
|
|
|
GOPATH=$(GOBUILDDIR) go build -o $(RELEASE) $(REPOPATH)/tools/release
|
|
|
|
|
2018-03-13 13:45:43 +00:00
|
|
|
.PHONY: build-ghrelease
|
|
|
|
build-ghrelease: $(GHRELEASE)
|
|
|
|
|
2018-02-09 10:11:33 +00:00
|
|
|
$(GHRELEASE): $(GOBUILDDIR)
|
|
|
|
GOPATH=$(GOBUILDDIR) go build -o $(GHRELEASE) github.com/aktau/github-release
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: release-patch
|
2018-02-09 10:11:33 +00:00
|
|
|
release-patch: $(RELEASE)
|
|
|
|
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=patch
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: release-minor
|
2018-02-09 10:11:33 +00:00
|
|
|
release-minor: $(RELEASE)
|
|
|
|
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=minor
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: release-major
|
2018-02-09 10:11:33 +00:00
|
|
|
release-major: $(RELEASE)
|
|
|
|
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=major
|
|
|
|
|
2018-02-13 12:49:04 +00:00
|
|
|
## Kubernetes utilities
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: minikube-start
|
2018-02-13 12:49:04 +00:00
|
|
|
minikube-start:
|
|
|
|
minikube start --cpus=4 --memory=6144
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: delete-operator
|
2018-02-13 12:49:04 +00:00
|
|
|
delete-operator:
|
2018-03-29 08:44:57 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHTEST) --ignore-not-found
|
2018-03-19 10:09:20 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHDEPLOYMENT) --ignore-not-found
|
2018-05-18 09:54:53 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHDEPLOYMENTREPLICATION) --ignore-not-found
|
2018-03-19 10:09:20 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHSTORAGE) --ignore-not-found
|
2018-02-13 12:49:04 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: redeploy-operator
|
|
|
|
redeploy-operator: delete-operator manifests
|
2018-03-19 14:39:18 +00:00
|
|
|
kubectl apply -f manifests/crd.yaml
|
2018-03-19 10:09:20 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHSTORAGE)
|
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
|
2018-05-18 09:54:53 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
|
2018-03-29 08:44:57 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHTEST)
|
2018-02-13 12:49:04 +00:00
|
|
|
kubectl get pods
|