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)
|
2019-10-16 07:05:56 +00:00
|
|
|
DOCKERCLI := $(shell which docker)
|
2018-02-09 10:11:33 +00:00
|
|
|
|
|
|
|
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
|
2019-10-16 07:05:56 +00:00
|
|
|
REPODIR := $(ORGDIR)/$(REPONAME)
|
2018-02-09 10:11:33 +00:00
|
|
|
REPOPATH := $(ORGPATH)/$(REPONAME)
|
|
|
|
|
|
|
|
GOPATH := $(GOBUILDDIR)
|
2019-10-16 07:05:56 +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
|
|
|
|
2019-10-16 07:05:56 +00:00
|
|
|
DOCKERFILE := Dockerfile
|
|
|
|
DOCKERTESTFILE := Dockerfile.test
|
|
|
|
DOCKERDURATIONTESTFILE := tests/duration/Dockerfile
|
|
|
|
|
2019-09-24 07:22:06 +00:00
|
|
|
HELM ?= $(shell which helm)
|
|
|
|
|
|
|
|
.PHONY: helm
|
|
|
|
helm:
|
|
|
|
ifeq ($(HELM),)
|
|
|
|
$(error Before templating you need to install helm in PATH or export helm binary using "export HELM=<path to helm>")
|
|
|
|
endif
|
|
|
|
|
|
|
|
HELM_PACKAGE_CMD = $(HELM) package "$(ROOTDIR)/chart/$(CHART_NAME)" \
|
|
|
|
-d "$(ROOTDIR)/bin/charts" \
|
|
|
|
--save=false
|
|
|
|
|
2019-09-23 07:00:10 +00:00
|
|
|
HELM_CMD = $(HELM) template "$(ROOTDIR)/chart/$(CHART_NAME)" \
|
|
|
|
--name "$(NAME)" \
|
|
|
|
--set "operator.image=$(OPERATORIMAGE)" \
|
|
|
|
--set "operator.imagePullPolicy=Always" \
|
2019-09-24 07:22:06 +00:00
|
|
|
--set "operator.resources=null" \
|
2019-09-23 07:00:10 +00:00
|
|
|
--namespace "$(DEPLOYMENTNAMESPACE)"
|
|
|
|
|
2019-06-25 11:55:48 +00:00
|
|
|
ifndef LOCALONLY
|
2018-03-12 12:28:19 +00:00
|
|
|
PUSHIMAGES := 1
|
2018-03-12 11:18:50 +00:00
|
|
|
endif
|
|
|
|
|
2019-06-25 11:55:48 +00:00
|
|
|
ifdef IMAGETAG
|
2018-03-12 11:18:50 +00:00
|
|
|
IMAGESUFFIX := :$(IMAGETAG)
|
2019-06-25 11:55:48 +00:00
|
|
|
else
|
2018-03-12 11:18:50 +00:00
|
|
|
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-10-31 09:31:07 +00:00
|
|
|
MANIFESTPATHCRD := manifests/arango-crd$(MANIFESTSUFFIX).yaml
|
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
|
2019-09-27 11:04:23 +00:00
|
|
|
MANIFESTPATHBACKUP := manifests/arango-backup$(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
|
|
|
|
|
2019-10-31 06:48:27 +00:00
|
|
|
BASEUBIIMAGE ?= registry.access.redhat.com/ubi8/ubi-minimal:8.0
|
|
|
|
|
2018-02-20 17:53:33 +00:00
|
|
|
ifndef OPERATORIMAGE
|
2018-03-19 13:51:31 +00:00
|
|
|
OPERATORIMAGE := $(DOCKERNAMESPACE)/kube-arangodb$(IMAGESUFFIX)
|
2018-02-20 17:53:33 +00:00
|
|
|
endif
|
2019-10-31 06:48:27 +00:00
|
|
|
ifndef OPERATORUBIIMAGE
|
|
|
|
OPERATORUBIIMAGE := $(DOCKERNAMESPACE)/kube-arangodb$(IMAGESUFFIX)-ubi
|
|
|
|
endif
|
2018-02-20 17:53:33 +00:00
|
|
|
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-12-03 13:34:58 +00:00
|
|
|
ifndef ENTERPRISELICENSE
|
|
|
|
ENTERPRISELICENSE := $(DEFAULTENTERPRISELICENSE)
|
|
|
|
endif
|
2018-07-06 06:14:51 +00:00
|
|
|
DASHBOARDBUILDIMAGE := kube-arangodb-dashboard-builder
|
2018-02-20 17:53:33 +00:00
|
|
|
|
2018-03-30 13:40:11 +00:00
|
|
|
ifndef ALLOWCHAOS
|
|
|
|
ALLOWCHAOS := true
|
|
|
|
endif
|
|
|
|
|
2019-10-16 07:05:56 +00:00
|
|
|
BINNAME := $(PROJECT)
|
|
|
|
BIN := $(BINDIR)/$(BINNAME)
|
|
|
|
TESTBINNAME := $(PROJECT)_test
|
|
|
|
TESTBIN := $(BINDIR)/$(TESTBINNAME)
|
2018-06-15 06:16:52 +00:00
|
|
|
DURATIONTESTBINNAME := $(PROJECT)_duration_test
|
|
|
|
DURATIONTESTBIN := $(BINDIR)/$(DURATIONTESTBINNAME)
|
2019-06-25 11:55:48 +00:00
|
|
|
RELEASE := $(GOBUILDDIR)/bin/release
|
|
|
|
GHRELEASE := $(GOBUILDDIR)/bin/github-release
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-01 10:15:18 +00:00
|
|
|
TESTLENGTHOPTIONS := -test.short
|
2019-03-04 09:31:27 +00:00
|
|
|
TESTTIMEOUT := 30m
|
2018-03-01 10:15:18 +00:00
|
|
|
ifeq ($(LONG), 1)
|
|
|
|
TESTLENGTHOPTIONS :=
|
2019-09-27 11:04:23 +00:00
|
|
|
TESTTIMEOUT := 300m
|
2018-03-01 10:15:18 +00:00
|
|
|
endif
|
2019-10-16 07:05:56 +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-11-30 10:23:38 +00:00
|
|
|
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js' -not -path './test/*') $(DASHBOARDDIR)/package.json
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2019-03-06 13:21:36 +00:00
|
|
|
ifndef ARANGOSYNCSRCDIR
|
|
|
|
ARANGOSYNCSRCDIR := $(SCRIPTDIR)/arangosync
|
|
|
|
endif
|
|
|
|
DOCKERARANGOSYNCCTRLFILE=tests/sync/Dockerfile
|
|
|
|
ifndef ARANGOSYNCTESTCTRLIMAGE
|
|
|
|
ARANGOSYNCTESTCTRLIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-sync-test-ctrl$(IMAGESUFFIX)
|
|
|
|
endif
|
|
|
|
ifndef ARANGOSYNCTESTIMAGE
|
|
|
|
ARANGOSYNCTESTIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-sync-test$(IMAGESUFFIX)
|
|
|
|
endif
|
|
|
|
ifndef ARANGOSYNCIMAGE
|
|
|
|
ARANGOSYNCIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-sync$(IMAGESUFFIX)
|
|
|
|
endif
|
|
|
|
ARANGOSYNCTESTCTRLBINNAME := $(PROJECT)_sync_test_ctrl
|
|
|
|
ARANGOSYNCTESTCTRLBIN := $(BINDIR)/$(ARANGOSYNCTESTCTRLBINNAME)
|
|
|
|
|
2019-09-24 15:25:09 +00:00
|
|
|
.DEFAULT_GOAL := all
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: all
|
2019-06-25 11:55:48 +00:00
|
|
|
all: check-vars verify-generated build
|
|
|
|
|
|
|
|
.PHONY: compile
|
|
|
|
compile: check-vars build
|
2019-05-14 15:26:43 +00:00
|
|
|
|
2019-06-25 11:55:48 +00:00
|
|
|
# allall is now obsolete
|
2019-05-14 15:26:43 +00:00
|
|
|
.PHONY: allall
|
2019-06-25 11:55:48 +00:00
|
|
|
allall: all
|
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.
|
|
|
|
#
|
|
|
|
|
2019-09-27 11:04:23 +00:00
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
|
|
|
golangci-lint run --no-config --issues-exit-code=1 --deadline=30m --disable-all --enable=deadcode --enable=gocyclo \
|
|
|
|
--enable=golint --enable=varcheck --enable=structcheck --enable=maligned --enable=errcheck \
|
|
|
|
--enable=dupl --enable=ineffassign --enable=interfacer --enable=unconvert --enable=goconst \
|
|
|
|
--enable=gosec --enable=megacheck --exclude-use-default=false \
|
|
|
|
$(ROOTDIR)/pkg/backup/...
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: build
|
2019-10-31 06:48:27 +00:00
|
|
|
build: docker docker-ubi 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:
|
2019-10-16 07:05:56 +00:00
|
|
|
rm -Rf $(BIN) $(BINDIR) $(DASHBOARDDIR)/build $(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: update-vendor
|
2018-02-09 14:27:40 +00:00
|
|
|
update-vendor:
|
2019-05-07 08:10:23 +00:00
|
|
|
@rm -Rf $(VENDORDIR)/k8s.io/code-generator
|
|
|
|
@git clone --branch kubernetes-1.14.1 https://github.com/kubernetes/code-generator.git $(VENDORDIR)/k8s.io/code-generator
|
2018-02-09 10:11:33 +00:00
|
|
|
@rm -Rf $(VENDORDIR)/k8s.io/code-generator/.git
|
2019-05-07 08:10:23 +00:00
|
|
|
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: update-generated
|
2019-05-07 09:25:49 +00:00
|
|
|
update-generated:
|
2019-05-14 08:57:50 +00:00
|
|
|
@rm -fr $(ORGDIR)
|
2019-05-07 09:25:49 +00:00
|
|
|
@mkdir -p $(ORGDIR)
|
2019-05-14 08:57:50 +00:00
|
|
|
@ln -s -f $(SCRIPTDIR) $(ORGDIR)/kube-arangodb
|
2019-05-14 09:02:02 +00:00
|
|
|
GOPATH=$(GOBUILDDIR) $(VENDORDIR)/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" \
|
2020-03-03 09:34:54 +00:00
|
|
|
"deployment:v1 replication:v1 storage:v1alpha backup:v1" \
|
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-06 06:14:51 +00:00
|
|
|
dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
|
|
|
|
cd $(DASHBOARDDIR) && docker build -t $(DASHBOARDBUILDIMAGE) -f Dockerfile.build $(DASHBOARDDIR)
|
|
|
|
@mkdir -p $(DASHBOARDDIR)/build
|
|
|
|
docker run --rm \
|
2018-07-10 06:27:27 +00:00
|
|
|
-u $(shell id -u):$(shell id -g) \
|
2018-07-06 06:14:51 +00:00
|
|
|
-v $(DASHBOARDDIR)/build:/usr/code/build \
|
|
|
|
-v $(DASHBOARDDIR)/public:/usr/code/public:ro \
|
|
|
|
-v $(DASHBOARDDIR)/src:/usr/code/src:ro \
|
|
|
|
$(DASHBOARDBUILDIMAGE)
|
2019-05-07 09:25:49 +00:00
|
|
|
go run github.com/jessevdk/go-assets-builder -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
|
2018-07-02 12:58:06 +00:00
|
|
|
|
2019-10-16 07:05:56 +00:00
|
|
|
$(BIN): $(SOURCES) dashboard/assets.go VERSION
|
|
|
|
@mkdir -p $(BINDIR)
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(BIN) $(REPOPATH)
|
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker
|
2019-10-16 07:05:56 +00:00
|
|
|
docker: check-vars $(BIN)
|
2020-02-27 07:28:25 +00:00
|
|
|
docker build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" -t $(OPERATORIMAGE) .
|
2018-02-22 15:54:36 +00:00
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(OPERATORIMAGE)
|
|
|
|
endif
|
2018-02-09 10:11:33 +00:00
|
|
|
|
2019-10-31 06:48:27 +00:00
|
|
|
.PHONY: docker-ubi
|
|
|
|
docker-ubi: check-vars $(BIN)
|
2020-02-27 07:28:25 +00:00
|
|
|
docker build --no-cache -f "$(DOCKERFILE).ubi" --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "IMAGE=$(BASEUBIIMAGE)" -t $(OPERATORUBIIMAGE)-local-only-build .
|
|
|
|
docker build --no-cache -f $(DOCKERFILE) --build-arg "VERSION=${VERSION_MAJOR_MINOR_PATCH}" --build-arg "IMAGE=$(OPERATORUBIIMAGE)-local-only-build" -t $(OPERATORUBIIMAGE) .
|
2019-10-31 06:48:27 +00:00
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(OPERATORUBIIMAGE)
|
|
|
|
endif
|
|
|
|
|
2019-06-25 11:55:48 +00:00
|
|
|
# Manifests
|
2018-03-12 11:18:50 +00:00
|
|
|
|
2019-09-23 07:00:10 +00:00
|
|
|
.PHONY: manifests-crd
|
|
|
|
manifests-crd: export CHART_NAME := kube-arangodb-crd
|
|
|
|
manifests-crd: export NAME := crd
|
2019-09-24 07:22:06 +00:00
|
|
|
manifests-crd: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@echo Building manifests for CRD - $(MANIFESTPATHCRD)
|
|
|
|
@$(HELM_CMD) > "$(MANIFESTPATHCRD)"
|
|
|
|
|
|
|
|
.PHONY: manifests-test
|
|
|
|
manifests-test: export CHART_NAME := kube-arangodb-test
|
|
|
|
manifests-test: export NAME := arangodb-test
|
2019-09-24 07:22:06 +00:00
|
|
|
manifests-test: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@echo Building manifests for test - $(MANIFESTPATHTEST)
|
|
|
|
@$(HELM_CMD) > "$(MANIFESTPATHTEST)"
|
|
|
|
|
|
|
|
.PHONY: manifests-operator-deployment
|
|
|
|
manifests-operator-deployment: export CHART_NAME := kube-arangodb
|
|
|
|
manifests-operator-deployment: export NAME := deployment
|
2019-09-24 07:22:06 +00:00
|
|
|
manifests-operator-deployment: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@echo Building manifests for Operator Deployment - $(MANIFESTPATHDEPLOYMENT)
|
|
|
|
@$(HELM_CMD) \
|
|
|
|
--set "operator.features.deployment=true" \
|
|
|
|
--set "operator.features.deploymentReplications=false" \
|
2019-09-27 11:04:23 +00:00
|
|
|
--set "operator.features.storage=false" \
|
|
|
|
--set "operator.features.backup=false" > "$(MANIFESTPATHDEPLOYMENT)"
|
2019-09-23 07:00:10 +00:00
|
|
|
|
|
|
|
.PHONY: manifests-operator-deployment-replication
|
|
|
|
manifests-operator-deployment-replication: export CHART_NAME := kube-arangodb
|
|
|
|
manifests-operator-deployment-replication: export NAME := deployment-replication
|
2019-09-24 07:22:06 +00:00
|
|
|
manifests-operator-deployment-replication: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@echo Building manifests for Operator Deployment Replication - $(MANIFESTPATHDEPLOYMENTREPLICATION)
|
|
|
|
@$(HELM_CMD) \
|
|
|
|
--set "operator.features.deployment=false" \
|
|
|
|
--set "operator.features.deploymentReplications=true" \
|
2019-09-27 11:04:23 +00:00
|
|
|
--set "operator.features.storage=false" \
|
|
|
|
--set "operator.features.backup=false" > "$(MANIFESTPATHDEPLOYMENTREPLICATION)"
|
2019-09-23 07:00:10 +00:00
|
|
|
|
|
|
|
.PHONY: manifests-operator-storage
|
|
|
|
manifests-operator-storage: export CHART_NAME := kube-arangodb
|
|
|
|
manifests-operator-storage: export NAME := storage
|
2019-09-24 07:22:06 +00:00
|
|
|
manifests-operator-storage: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@echo Building manifests for Operator Storage - $(MANIFESTPATHSTORAGE)
|
|
|
|
@$(HELM_CMD) \
|
|
|
|
--set "operator.features.deployment=false" \
|
|
|
|
--set "operator.features.deploymentReplications=false" \
|
2019-09-27 11:04:23 +00:00
|
|
|
--set "operator.features.storage=true" \
|
|
|
|
--set "operator.features.backup=false" > "$(MANIFESTPATHSTORAGE)"
|
|
|
|
|
|
|
|
.PHONY: manifests-operator-backup
|
|
|
|
manifests-operator-backup: export CHART_NAME := kube-arangodb
|
|
|
|
manifests-operator-backup: export NAME := backup
|
|
|
|
manifests-operator-backup: helm
|
|
|
|
@echo Building manifests for Operator Backup - $(MANIFESTPATHBACKUP)
|
|
|
|
@$(HELM_CMD) \
|
|
|
|
--set "operator.features.deployment=false" \
|
|
|
|
--set "operator.features.deploymentReplications=false" \
|
|
|
|
--set "operator.features.storage=false" \
|
|
|
|
--set "operator.features.backup=true" > "$(MANIFESTPATHBACKUP)"
|
2019-09-23 07:00:10 +00:00
|
|
|
|
|
|
|
.PHONY: manifests-operator
|
2019-09-27 11:04:23 +00:00
|
|
|
manifests-operator: manifests-operator-deployment manifests-operator-deployment-replication manifests-operator-storage manifests-operator-backup
|
2019-09-23 07:00:10 +00:00
|
|
|
|
2019-09-24 07:22:06 +00:00
|
|
|
.PHONY: chart-crd
|
|
|
|
chart-crd: export CHART_NAME := kube-arangodb-crd
|
|
|
|
chart-crd: helm
|
|
|
|
@mkdir -p "$(ROOTDIR)/bin/charts"
|
|
|
|
@$(HELM_PACKAGE_CMD)
|
|
|
|
|
|
|
|
.PHONY: chart-operator
|
|
|
|
chart-operator: export CHART_NAME := kube-arangodb
|
|
|
|
chart-operator: helm
|
2019-09-23 07:00:10 +00:00
|
|
|
@mkdir -p "$(ROOTDIR)/bin/charts"
|
2019-09-24 07:22:06 +00:00
|
|
|
@$(HELM_PACKAGE_CMD)
|
2019-09-23 07:00:10 +00:00
|
|
|
|
2019-09-24 07:22:06 +00:00
|
|
|
.PHONY: manifests
|
|
|
|
manifests: helm manifests-crd manifests-operator manifests-test chart-crd chart-operator
|
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
|
2019-05-07 08:10:23 +00:00
|
|
|
run-unit-tests: $(SOURCES)
|
2019-10-16 07:05:56 +00:00
|
|
|
go test $(TESTVERBOSEOPTIONS) \
|
2019-11-04 07:49:24 +00:00
|
|
|
$(REPOPATH)/pkg/apis/backup/... \
|
|
|
|
$(REPOPATH)/pkg/apis/deployment/... \
|
|
|
|
$(REPOPATH)/pkg/apis/replication/... \
|
|
|
|
$(REPOPATH)/pkg/apis/storage/... \
|
2019-10-18 07:54:27 +00:00
|
|
|
$(REPOPATH)/pkg/deployment/... \
|
2019-10-16 07:05:56 +00:00
|
|
|
$(REPOPATH)/pkg/storage \
|
|
|
|
$(REPOPATH)/pkg/util/k8sutil \
|
|
|
|
$(REPOPATH)/pkg/util/k8sutil/test \
|
|
|
|
$(REPOPATH)/pkg/util/probe \
|
|
|
|
$(REPOPATH)/pkg/util/validation \
|
|
|
|
$(REPOPATH)/pkg/backup/...
|
|
|
|
|
|
|
|
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
|
|
|
|
@mkdir -p $(BINDIR)
|
|
|
|
CGO_ENABLED=0 go test -c -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(TESTBIN) $(REPOPATH)/tests
|
2018-02-27 14:32:09 +00:00
|
|
|
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2018-03-12 11:18:50 +00:00
|
|
|
.PHONY: docker-test
|
2019-10-16 07:05:56 +00:00
|
|
|
docker-test: $(TESTBIN)
|
|
|
|
docker build --quiet -f $(DOCKERTESTFILE) -t $(TESTIMAGE) .
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2019-03-04 08:16:10 +00:00
|
|
|
.PHONY: run-upgrade-tests
|
|
|
|
run-upgrade-tests:
|
|
|
|
TESTOPTIONS="-test.run=TestUpgrade" make run-tests
|
|
|
|
|
2019-03-06 13:21:36 +00:00
|
|
|
.PHONY: prepare-run-tests
|
|
|
|
prepare-run-tests:
|
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(OPERATORIMAGE)
|
|
|
|
endif
|
|
|
|
ifneq ($(DEPLOYMENTNAMESPACE), default)
|
|
|
|
$(ROOTDIR)/scripts/kube_delete_namespace.sh $(DEPLOYMENTNAMESPACE)
|
|
|
|
kubectl create namespace $(DEPLOYMENTNAMESPACE)
|
|
|
|
endif
|
|
|
|
kubectl apply -f $(MANIFESTPATHCRD)
|
|
|
|
kubectl apply -f $(MANIFESTPATHSTORAGE)
|
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
|
|
|
|
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
|
2019-09-27 11:04:23 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHBACKUP)
|
2019-03-06 13:21:36 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHTEST)
|
|
|
|
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
|
|
|
|
$(ROOTDIR)/scripts/kube_create_license_key_secret.sh "$(DEPLOYMENTNAMESPACE)" '$(ENTERPRISELICENSE)'
|
2019-09-27 11:04:23 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_create_backup_remote_secret.sh "$(DEPLOYMENTNAMESPACE)" '$(TEST_REMOTE_SECRET)'
|
2019-03-06 13:21:36 +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-10-31 09:31:07 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHCRD)
|
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)
|
2019-09-27 11:04:23 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHBACKUP)
|
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-12-04 12:39:38 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_create_license_key_secret.sh "$(DEPLOYMENTNAMESPACE)" '$(ENTERPRISELICENSE)'
|
2019-09-27 11:04:23 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_create_backup_remote_secret.sh "$(DEPLOYMENTNAMESPACE)" '$(TEST_REMOTE_SECRET)'
|
|
|
|
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ARANGODIMAGE)" '$(ENTERPRISEIMAGE)' '$(TESTTIMEOUT)' '$(TESTLENGTHOPTIONS)' '$(TESTOPTIONS)' '$(TEST_REMOTE_REPOSITORY)'
|
2018-02-20 08:49:01 +00:00
|
|
|
|
2019-05-07 08:22:05 +00:00
|
|
|
$(DURATIONTESTBIN): $(SOURCES)
|
|
|
|
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(DURATIONTESTBINNAME) $(REPOPATH)/tests/duration
|
2019-06-25 11:55:48 +00:00
|
|
|
|
2018-06-15 06:16:52 +00:00
|
|
|
|
|
|
|
.PHONY: docker-duration-test
|
|
|
|
docker-duration-test: $(DURATIONTESTBIN)
|
2019-10-16 07:05:56 +00:00
|
|
|
docker build --quiet -f $(DOCKERDURATIONTESTFILE) -t $(DURATIONTESTIMAGE) .
|
2018-06-15 06:16:52 +00:00
|
|
|
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-08-09 12:59:04 +00:00
|
|
|
kubectl delete ArangoDeployment -n $(DEPLOYMENTNAMESPACE) --all
|
|
|
|
sleep 10
|
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)
|
|
|
|
|
2019-09-25 10:31:12 +00:00
|
|
|
.PHONY: patch-chart
|
|
|
|
patch-chart:
|
|
|
|
$(ROOTDIR)/scripts/patch_chart.sh "$(VERSION_MAJOR_MINOR_PATCH)" "$(OPERATORIMAGE)"
|
|
|
|
|
2018-09-07 12:45:15 +00:00
|
|
|
.PHONY: changelog
|
2018-04-03 06:47:56 +00:00
|
|
|
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 \
|
2018-11-06 10:18:13 +00:00
|
|
|
ferrarimarco/github-changelog-generator:1.14.3 \
|
2018-04-03 06:47:56 +00:00
|
|
|
--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)
|
|
|
|
|
2019-06-25 11:55:48 +00:00
|
|
|
$(GHRELEASE): $(GOBUILDDIR)
|
2018-02-09 10:11:33 +00:00
|
|
|
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)
|
2019-06-25 11:55:48 +00:00
|
|
|
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=patch
|
2018-02-09 10:11:33 +00:00
|
|
|
|
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)
|
2019-06-25 11:55:48 +00:00
|
|
|
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=major
|
2018-02-09 10:11:33 +00:00
|
|
|
|
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
|
2019-09-27 11:04:23 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHBACKUP) --ignore-not-found
|
2018-03-19 10:09:20 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHSTORAGE) --ignore-not-found
|
2018-10-31 09:31:07 +00:00
|
|
|
kubectl delete -f $(MANIFESTPATHCRD) --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-10-31 09:31:07 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHCRD)
|
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)
|
2019-09-27 11:04:23 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHBACKUP)
|
2018-03-29 08:44:57 +00:00
|
|
|
kubectl apply -f $(MANIFESTPATHTEST)
|
2019-06-25 11:55:48 +00:00
|
|
|
kubectl get pods
|
2019-03-06 13:21:36 +00:00
|
|
|
|
|
|
|
## ArangoSync Tests
|
|
|
|
|
|
|
|
$(ARANGOSYNCTESTCTRLBIN): $(GOBUILDDIR) $(SOURCES)
|
|
|
|
@mkdir -p $(BINDIR)
|
2019-06-24 07:28:11 +00:00
|
|
|
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(ARANGOSYNCTESTCTRLBIN) $(REPOPATH)/tests/sync
|
2019-03-06 13:21:36 +00:00
|
|
|
|
|
|
|
.PHONY: check-sync-vars
|
|
|
|
check-sync-vars:
|
|
|
|
ifndef ARANGOSYNCSRCDIR
|
|
|
|
@echo ARANGOSYNCSRCDIR must point to the arangosync source directory
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
ifndef ARANGODIMAGE
|
|
|
|
@echo ARANGODIMAGE must point to the usable arangodb enterprise image
|
|
|
|
@exit 1
|
2019-03-07 08:37:48 +00:00
|
|
|
endif
|
|
|
|
ifndef ENTERPRISELICENSE
|
|
|
|
@echo For tests using ArangoSync you most likely need the license key. Please set ENTERPRISELICENSE.
|
|
|
|
@exit 1
|
2019-03-06 13:21:36 +00:00
|
|
|
endif
|
|
|
|
@echo Using ArangoSync source at $(ARANGOSYNCSRCDIR)
|
|
|
|
@echo Using ArangoDB image $(ARANGODIMAGE)
|
|
|
|
|
|
|
|
.PHONY: docker-sync
|
|
|
|
docker-sync: check-sync-vars
|
2019-03-11 09:38:57 +00:00
|
|
|
SYNCIMAGE=$(ARANGOSYNCIMAGE) TESTIMAGE=$(ARANGOSYNCTESTIMAGE) $(MAKE) -C $(ARANGOSYNCSRCDIR) docker docker-test
|
2019-03-06 13:21:36 +00:00
|
|
|
|
|
|
|
.PHONY:
|
|
|
|
docker-sync-test-ctrl: $(ARANGOSYNCTESTCTRLBIN)
|
|
|
|
docker build --quiet -f $(DOCKERARANGOSYNCCTRLFILE) -t $(ARANGOSYNCTESTCTRLIMAGE) .
|
|
|
|
|
|
|
|
.PHONY:
|
|
|
|
run-sync-tests: check-vars docker-sync docker-sync-test-ctrl prepare-run-tests
|
|
|
|
ifdef PUSHIMAGES
|
|
|
|
docker push $(ARANGOSYNCTESTCTRLIMAGE)
|
|
|
|
docker push $(ARANGOSYNCTESTIMAGE)
|
|
|
|
docker push $(ARANGOSYNCIMAGE)
|
|
|
|
endif
|
2019-05-14 08:57:50 +00:00
|
|
|
$(ROOTDIR)/scripts/kube_run_sync_tests.sh $(DEPLOYMENTNAMESPACE) '$(ARANGODIMAGE)' '$(ARANGOSYNCIMAGE)' '$(ARANGOSYNCTESTIMAGE)' '$(ARANGOSYNCTESTCTRLIMAGE)' '$(TESTOPTIONS)'
|