Skip to content

Commit 3cc2b4f

Browse files
authored
REVERT/to_0.4.0 (#476)
1 parent 82cd2b0 commit 3cc2b4f

23 files changed

+480
-675
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
.git
33
.gobuild
44
docs
5+
pkg
56
tools
67
deps
8+
dashboard

Dockerfile

+3-40
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
1-
# Upgrading to golang:1.13-alpine:
2-
# It is possible once prometheus-operator will release new version (newer then 0.33.0)
1+
FROM scratch
32

4-
# Download packages required by kube-arangodb
5-
FROM golang:1.12.9-alpine AS downloader
3+
ADD bin/arangodb_operator /usr/bin/
64

7-
# git is required by 'go mod'
8-
RUN apk add git
9-
10-
WORKDIR /app
11-
12-
COPY go.mod .
13-
COPY go.sum .
14-
# It is done only once unless go.mod has been changed
15-
RUN go mod download
16-
17-
18-
19-
# Compile Golang kube-arangodb sources with downloaded dependencies
20-
FROM downloader AS builder
21-
ARG VERSION
22-
ARG COMMIT
23-
24-
COPY *.go /app/
25-
COPY pkg /app/pkg
26-
COPY dashboard/assets.go /app/dashboard/assets.go
27-
28-
ENV GO111MODULE=on
29-
ENV CGO_ENABLED=0
30-
ENV GOARCH=amd64
31-
ENV GOOS=linux
32-
33-
RUN go build -installsuffix netgo -ldflags "-X main.projectVersion=${VERSION} -X main.projectBuild=${COMMIT}" -o /arangodb_operator
34-
35-
36-
37-
# Build the final production image with only binary file
38-
FROM scratch
39-
40-
COPY --from=builder /arangodb_operator /usr/bin/arangodb_operator
41-
42-
ENTRYPOINT [ "/usr/bin/arangodb_operator" ]
5+
ENTRYPOINT [ "/usr/bin/arangodb_operator" ]

Dockerfile.test

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM scratch
2+
3+
ADD bin/arangodb_operator_test /usr/bin/
4+
5+
ENTRYPOINT [ "/usr/bin/arangodb_operator_test" ]

Dockerfile.unittest

-24
This file was deleted.

Makefile

+41-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ VERSION_MAJOR_MINOR_PATCH := $(shell echo $(VERSION) | cut -f 1 -d '+')
66
VERSION_MAJOR_MINOR := $(shell echo $(VERSION_MAJOR_MINOR_PATCH) | cut -f 1,2 -d '.')
77
VERSION_MAJOR := $(shell echo $(VERSION_MAJOR_MINOR) | cut -f 1 -d '.')
88
COMMIT := $(shell git rev-parse --short HEAD)
9+
DOCKERCLI := $(shell which docker)
910

1011
GOBUILDDIR := $(SCRIPTDIR)/.gobuild
1112
SRCDIR := $(SCRIPTDIR)
@@ -17,13 +18,19 @@ DASHBOARDDIR := $(ROOTDIR)/dashboard
1718
ORGPATH := github.com/arangodb
1819
ORGDIR := $(GOBUILDDIR)/src/$(ORGPATH)
1920
REPONAME := kube-arangodb
21+
REPODIR := $(ORGDIR)/$(REPONAME)
2022
REPOPATH := $(ORGPATH)/$(REPONAME)
2123

2224
GOPATH := $(GOBUILDDIR)
25+
GOVERSION := 1.10.0-alpine
2326

2427
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
2528
GOASSETSBUILDER := $(GOBUILDDIR)/bin/go-assets-builder$(shell go env GOEXE)
2629

30+
DOCKERFILE := Dockerfile
31+
DOCKERTESTFILE := Dockerfile.test
32+
DOCKERDURATIONTESTFILE := tests/duration/Dockerfile
33+
2734
HELM ?= $(shell which helm)
2835

2936
.PHONY: helm
@@ -92,6 +99,10 @@ ifndef ALLOWCHAOS
9299
ALLOWCHAOS := true
93100
endif
94101

102+
BINNAME := $(PROJECT)
103+
BIN := $(BINDIR)/$(BINNAME)
104+
TESTBINNAME := $(PROJECT)_test
105+
TESTBIN := $(BINDIR)/$(TESTBINNAME)
95106
DURATIONTESTBINNAME := $(PROJECT)_duration_test
96107
DURATIONTESTBIN := $(BINDIR)/$(DURATIONTESTBINNAME)
97108
RELEASE := $(GOBUILDDIR)/bin/release
@@ -103,6 +114,9 @@ ifeq ($(LONG), 1)
103114
TESTLENGTHOPTIONS :=
104115
TESTTIMEOUT := 300m
105116
endif
117+
ifdef VERBOSE
118+
TESTVERBOSEOPTIONS := -v
119+
endif
106120

107121
SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
108122
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR)/src -name '*.js' -not -path './test/*') $(DASHBOARDDIR)/package.json
@@ -151,7 +165,7 @@ build: docker manifests
151165

152166
.PHONY: clean
153167
clean:
154-
rm -Rf $(BINDIR) $(DASHBOARDDIR)/build $(DASHBOARDDIR)/node_modules
168+
rm -Rf $(BIN) $(BINDIR) $(DASHBOARDDIR)/build $(DASHBOARDDIR)/node_modules
155169

156170
.PHONY: check-vars
157171
check-vars:
@@ -196,9 +210,13 @@ dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
196210
$(DASHBOARDBUILDIMAGE)
197211
go run github.com/jessevdk/go-assets-builder -s /dashboard/build/ -o dashboard/assets.go -p dashboard dashboard/build
198212

213+
$(BIN): $(SOURCES) dashboard/assets.go VERSION
214+
@mkdir -p $(BINDIR)
215+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(BIN) $(REPOPATH)
216+
199217
.PHONY: docker
200-
docker: check-vars $(SOURCES) dashboard/assets.go VERSION
201-
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) -f Dockerfile -t $(OPERATORIMAGE) .
218+
docker: check-vars $(BIN)
219+
docker build -f $(DOCKERFILE) -t $(OPERATORIMAGE) .
202220
ifdef PUSHIMAGES
203221
docker push $(OPERATORIMAGE)
204222
endif
@@ -285,16 +303,28 @@ manifests: helm manifests-crd manifests-operator manifests-test chart-crd chart-
285303

286304
.PHONY: run-unit-tests
287305
run-unit-tests: $(SOURCES)
288-
ifdef VERBOSE
289-
docker build --build-arg VERBOSE=-v -f Dockerfile.unittest .
290-
else
291-
docker build -f Dockerfile.unittest .
292-
endif
306+
go test $(TESTVERBOSEOPTIONS) \
307+
$(REPOPATH)/pkg/apis/backup/v1alpha \
308+
$(REPOPATH)/pkg/apis/deployment/v1alpha \
309+
$(REPOPATH)/pkg/apis/replication/v1alpha \
310+
$(REPOPATH)/pkg/apis/storage/v1alpha \
311+
$(REPOPATH)/pkg/deployment/reconcile \
312+
$(REPOPATH)/pkg/deployment/resources \
313+
$(REPOPATH)/pkg/storage \
314+
$(REPOPATH)/pkg/util/k8sutil \
315+
$(REPOPATH)/pkg/util/k8sutil/test \
316+
$(REPOPATH)/pkg/util/probe \
317+
$(REPOPATH)/pkg/util/validation \
318+
$(REPOPATH)/pkg/backup/...
319+
320+
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
321+
@mkdir -p $(BINDIR)
322+
CGO_ENABLED=0 go test -c -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(TESTBIN) $(REPOPATH)/tests
293323

294324

295325
.PHONY: docker-test
296-
docker-test: check-vars $(GOBUILDDIR) $(SOURCES)
297-
docker build --quiet -f tests/Dockerfile -t $(TESTIMAGE) .
326+
docker-test: $(TESTBIN)
327+
docker build --quiet -f $(DOCKERTESTFILE) -t $(TESTIMAGE) .
298328

299329
.PHONY: run-upgrade-tests
300330
run-upgrade-tests:
@@ -346,7 +376,7 @@ $(DURATIONTESTBIN): $(SOURCES)
346376

347377
.PHONY: docker-duration-test
348378
docker-duration-test: $(DURATIONTESTBIN)
349-
docker build --quiet -f tests/duration/Dockerfile -t $(DURATIONTESTIMAGE) .
379+
docker build --quiet -f $(DOCKERDURATIONTESTFILE) -t $(DURATIONTESTIMAGE) .
350380
ifdef PUSHIMAGES
351381
docker push $(DURATIONTESTIMAGE)
352382
endif

README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ Feature-wise production readiness table:
6565
| Volume Claim Templates | 0.3.11 | new - alpha | |
6666
| Prometheus Metrics export | 0.3.11 | new - alpha | needs Prometheus |
6767
| User sidecar containers | 0.3.11 | new - alpha | |
68-
| Support for ResignLeadership | 0.3.16 | new - alpha | |
69-
| Hot backup | 0.4.0 | new - alpha | needs ArangoDB |
70-
| | | | >= 3.5.1 |
71-
72-
## Release notes for 0.4.0
73-
74-
In this release we have amended the Helm charts again. The same comments
75-
as for 0.3.16 apply. Furthermore, 0.4.0 is the first version to support
76-
hot backups.
7768

7869
## Release notes for 0.3.16
7970

@@ -109,12 +100,12 @@ upgrades.
109100

110101
```bash
111102
# The following will install the custom resources required by the operators.
112-
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.4.0/kube-arangodb-crd-0.4.0.tgz
103+
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.3.16/kube-arangodb-crd-0.3.16.tgz
113104
# The following will install the operator for `ArangoDeployment` &
114105
# `ArangoDeploymentReplication` resources.
115-
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.4.0/kube-arangodb-0.4.0.tgz
106+
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.3.16/kube-arangodb-0.3.16.tgz
116107
# To use `ArangoLocalStorage`, set field `operator.features.storage` to true
117-
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.4.0/kube-arangodb-0.4.0.tgz --set "operator.features.storage=true"
108+
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.3.16/kube-arangodb-0.3.16.tgz --set "operator.features.storage=true"
118109
```
119110

120111
## Upgrading the operator using Helm

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0+git
1+
0.4.0

chart/kube-arangodb/templates/storage-operator/cluster-role.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ metadata:
1313
app.kubernetes.io/instance: {{ .Release.Name }}
1414
release: {{ .Release.Name }}
1515
rules:
16-
- apiGroups: [""]
17-
resources: ["persistentvolumes", "persistentvolumeclaims", "endpoints", "events", "services"]
18-
verbs: ["*"]
1916
- apiGroups: ["apiextensions.k8s.io"]
2017
resources: ["customresourcedefinitions"]
2118
verbs: ["get"]

chart/kube-arangodb/templates/storage-operator/role.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ metadata:
1313
app.kubernetes.io/instance: {{ .Release.Name }}
1414
release: {{ .Release.Name }}
1515
rules:
16+
- apiGroups: [""]
17+
resources: ["persistentvolumes", "persistentvolumeclaims", "endpoints", "events", "services"]
18+
verbs: ["*"]
1619
- apiGroups: [""]
1720
resources: ["pods"]
1821
verbs: ["get", "update"]

go.mod

+55-8
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,94 @@ replace (
88
k8s.io/api => k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
99
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8
1010
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
11+
k8s.io/code-generator => ./deps/k8s.io/code-generator
12+
1113
)
1214

1315
require (
14-
github.com/PuerkitoBio/purell v1.1.1 // indirect
16+
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
17+
github.com/Azure/go-autorest/autorest v0.1.0 // indirect
18+
github.com/aktau/github-release v0.7.2 // indirect
1519
github.com/arangodb-helper/go-certificates v0.0.0-20180821055445-9fca24fc2680
1620
github.com/arangodb/arangosync-client v0.6.3
1721
github.com/arangodb/go-driver v0.0.0-20191002124627-11b6bfc64f67
1822
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21
23+
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
24+
github.com/bugagazavr/go-gitlab-client v0.0.0-20150830002541-e5999f934dc4 // indirect
1925
github.com/cenkalti/backoff v2.1.1+incompatible
26+
github.com/coreos/bbolt v1.3.2 // indirect
27+
github.com/coreos/etcd v3.3.13+incompatible // indirect
2028
github.com/coreos/go-semver v0.3.0
29+
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
2130
github.com/coreos/prometheus-operator v0.31.1
31+
github.com/cpuguy83/go-md2man v1.0.10 // indirect
2232
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
2333
github.com/dgrijalva/jwt-go v3.2.0+incompatible
34+
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
35+
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 // indirect
36+
github.com/dustin/go-broadcast v0.0.0-20171205050544-f664265f5a66 // indirect
2437
github.com/evanphx/json-patch v4.2.0+incompatible
38+
github.com/ewoutp/go-gitlab-client v0.0.0-20150214183219-6e4464cd3221 // indirect
2539
github.com/ghodss/yaml v1.0.0
2640
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 // indirect
41+
github.com/gin-gonic/autotls v0.0.0-20190406003154-fb31fc47f521 // indirect
2742
github.com/gin-gonic/gin v1.3.0
28-
github.com/go-openapi/spec v0.18.0 // indirect
29-
github.com/go-openapi/swag v0.18.0 // indirect
43+
github.com/go-openapi/analysis v0.19.0 // indirect
44+
github.com/go-openapi/errors v0.19.0 // indirect
45+
github.com/go-openapi/loads v0.19.0 // indirect
46+
github.com/go-openapi/runtime v0.19.0 // indirect
47+
github.com/go-openapi/strfmt v0.19.0 // indirect
3048
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
49+
github.com/google/btree v1.0.0 // indirect
3150
github.com/google/gofuzz v1.0.0 // indirect
32-
github.com/google/uuid v1.1.1 // indirect
3351
github.com/googleapis/gnostic v0.2.0 // indirect
52+
github.com/gophercloud/gophercloud v0.0.0-20190504011306-6f9faf57fddc // indirect
53+
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 // indirect
54+
github.com/gorilla/websocket v1.4.0 // indirect
55+
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
56+
github.com/helm/helm v2.14.3+incompatible // indirect
3457
github.com/inconshreveable/mousetrap v1.0.0 // indirect
3558
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15
59+
github.com/jessevdk/go-assets-builder v0.0.0-20130903091706-b8483521738f // indirect
60+
github.com/jessevdk/go-flags v1.4.0 // indirect
61+
github.com/jonboulle/clockwork v0.1.0 // indirect
62+
github.com/juju/errgo v0.0.0-20140925100237-08cceb5d0b53 // indirect
3663
github.com/julienschmidt/httprouter v1.2.0
37-
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe // indirect
64+
github.com/manucorporat/stats v0.0.0-20180402194714-3ba42d56d227 // indirect
65+
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect
66+
github.com/mattn/go-colorable v0.1.1 // indirect
3867
github.com/mattn/go-isatty v0.0.7 // indirect
68+
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
69+
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
3970
github.com/pborman/uuid v1.2.0 // indirect
71+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
4072
github.com/pkg/errors v0.8.1
4173
github.com/prometheus/client_golang v1.0.0
74+
github.com/pulcy/pulsar v0.0.0-20180915062927-71ea24b0ec2f // indirect
4275
github.com/robfig/cron v1.2.0
4376
github.com/rs/zerolog v1.14.3
77+
github.com/russross/blackfriday v2.0.0+incompatible // indirect
78+
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
79+
github.com/sourcegraph/go-vcsurl v0.0.0-20161114165620-2305ecca26ab // indirect
4480
github.com/spf13/cobra v0.0.3
4581
github.com/spf13/pflag v1.0.3
82+
github.com/spf13/viper v1.3.2 // indirect
4683
github.com/stretchr/testify v1.3.0
47-
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
84+
github.com/thinkerou/favicon v0.1.0 // indirect
85+
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
86+
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
87+
github.com/ugorji/go v1.1.4 // indirect
88+
github.com/voxelbrain/goptions v0.0.0-20180630082107-58cddc247ea2 // indirect
89+
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
90+
go.uber.org/atomic v1.4.0 // indirect
91+
go.uber.org/multierr v1.1.0 // indirect
92+
go.uber.org/zap v1.10.0 // indirect
4893
golang.org/x/sys v0.0.0-20190506115046-ca7f33d4116e
4994
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
50-
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
51-
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
95+
google.golang.org/api v0.4.0 // indirect
96+
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 // indirect
97+
google.golang.org/grpc v1.20.1 // indirect
98+
gopkg.in/sourcegraph/go-vcsurl.v1 v1.0.0-20131114132947-6b12603ea6fd // indirect
5299
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
53100
k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8
54101
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d

0 commit comments

Comments
 (0)