Skip to content

Commit ee0c1f8

Browse files
committed
Merge remote-tracking branch 'origin/master' into tests/apis-storage-v1alpha
* origin/master: (145 commits) Enable LONG on kube-arangodb-long test fix rocksdb_encryption_test fix - /api/version will answer on all servers (not leader only) fixes required after merge add downgrade tests add missing uniuri Merged in master Fixed unit-test packages Fixed unit tests Do not Fail the deployment, unless there is REALLY no other way Updated tests Refactor DeploymentState to DeploymentPhase Revert example change Added detection on unschedulable pods Detect pods not being scheduled Same fix on ArangoLocalStorage AsOwner no longer things the owner refers to a controller. It refers to the ArangoDeployment disable upgrade tests to 3.4 until 3.4 is available on hub.docker.com Listen for secret changes Log improvements ...
2 parents 97afe56 + 3b7e3e7 commit ee0c1f8

File tree

144 files changed

+7209
-1911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+7209
-1911
lines changed

Jenkinsfile.groovy

Lines changed: 72 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,72 @@ def notifySlack(String buildStatus = 'STARTED') {
1919
slackSend(color: color, channel: '#status-k8s', message: msg)
2020
}
2121

22+
def fetchParamsFromGitLog() {
23+
def myParams = [:];
24+
// Copy configured params
25+
for (entry in params) {
26+
myParams[entry.key] = entry.value;
27+
}
28+
29+
// Is this a LONG test?
30+
if ("${env.JOB_NAME}" == "kube-arangodb-long") {
31+
myParams["LONG"] = true;
32+
}
33+
34+
// Fetch params configured in git commit messages
35+
// Syntax: [ci OPT=value]
36+
// Example: [ci TESTOPTIONS="-test.run ^TestSimpleSingle$"]
37+
def options = sh(returnStdout: true, script: "git log --reverse remotes/origin/master..HEAD | grep -o \'\\[ci[^\\[]*\\]\' | sed -E \'s/\\[ci (.*)\\]/\\1/\'").trim().split("\n")
38+
for (opt in options) {
39+
def idx = opt.indexOf('=');
40+
if (idx > 0) {
41+
def key = opt.substring(0, idx);
42+
def value = opt.substring(idx+1).replaceAll('^\"|\"$', '');
43+
myParams[key] = value;
44+
//println("Overwriting myParams.${key} with ${value}");
45+
}
46+
}
47+
48+
// Show params in log
49+
for (entry in myParams) {
50+
println("Using myParams.${entry.key} with ${entry.value}");
51+
}
52+
53+
return myParams;
54+
}
55+
2256
def kubeConfigRoot = "/home/jenkins/.kube"
2357

24-
def buildTestSteps(String kubeConfigRoot, String kubeconfig) {
58+
def buildBuildSteps(Map myParams) {
59+
return {
60+
timestamps {
61+
withEnv([
62+
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
63+
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
64+
"IMAGETAG=jenkins-test",
65+
"LONG=${myParams.LONG ? 1 : 0}",
66+
"TESTOPTIONS=${myParams.TESTOPTIONS}",
67+
]) {
68+
sh "make"
69+
sh "make run-unit-tests"
70+
sh "make docker-test"
71+
}
72+
}
73+
}
74+
}
75+
76+
def buildTestSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
2577
return {
2678
timestamps {
2779
withCredentials([string(credentialsId: 'ENTERPRISEIMAGE', variable: 'DEFAULTENTERPRISEIMAGE')]) {
2880
withEnv([
29-
"DEPLOYMENTNAMESPACE=${params.TESTNAMESPACE}-${env.GIT_COMMIT}",
30-
"DOCKERNAMESPACE=${params.DOCKERNAMESPACE}",
31-
"ENTERPRISEIMAGE=${params.ENTERPRISEIMAGE}",
81+
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
82+
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
83+
"ENTERPRISEIMAGE=${myParams.ENTERPRISEIMAGE}",
3284
"IMAGETAG=jenkins-test",
3385
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
34-
"LONG=${params.LONG ? 1 : 0}",
86+
"LONG=${myParams.LONG ? 1 : 0}",
87+
"TESTOPTIONS=${myParams.TESTOPTIONS}",
3588
]) {
3689
sh "make run-tests"
3790
}
@@ -40,12 +93,12 @@ def buildTestSteps(String kubeConfigRoot, String kubeconfig) {
4093
}
4194
}
4295

43-
def buildCleanupSteps(String kubeConfigRoot, String kubeconfig) {
96+
def buildCleanupSteps(Map myParams, String kubeConfigRoot, String kubeconfig) {
4497
return {
4598
timestamps {
4699
withEnv([
47-
"DEPLOYMENTNAMESPACE=${params.TESTNAMESPACE}-${env.GIT_COMMIT}",
48-
"DOCKERNAMESPACE=${params.DOCKERNAMESPACE}",
100+
"DEPLOYMENTNAMESPACE=${myParams.TESTNAMESPACE}-${env.GIT_COMMIT}",
101+
"DOCKERNAMESPACE=${myParams.DOCKERNAMESPACE}",
49102
"KUBECONFIG=${kubeConfigRoot}/${kubeconfig}",
50103
]) {
51104
sh "make cleanup-tests"
@@ -66,31 +119,26 @@ pipeline {
66119
string(name: 'KUBECONFIGS', defaultValue: 'kube-ams1,scw-183a3b', description: 'KUBECONFIGS is a comma separated list of Kubernetes configuration files (relative to /home/jenkins/.kube) on which the tests are run', )
67120
string(name: 'TESTNAMESPACE', defaultValue: 'jenkins', description: 'TESTNAMESPACE sets the kubernetes namespace to ru tests in (this must be short!!)', )
68121
string(name: 'ENTERPRISEIMAGE', defaultValue: '', description: 'ENTERPRISEIMAGE sets the docker image used for enterprise tests)', )
122+
string(name: 'TESTOPTIONS', defaultValue: '', description: 'TESTOPTIONS is used to pass additional test options to the integration test', )
69123
}
70124
stages {
71125
stage('Build') {
72126
steps {
73-
timestamps {
74-
withEnv([
75-
"DEPLOYMENTNAMESPACE=${params.TESTNAMESPACE}-${env.GIT_COMMIT}",
76-
"DOCKERNAMESPACE=${params.DOCKERNAMESPACE}",
77-
"IMAGETAG=jenkins-test",
78-
"LONG=${params.LONG ? 1 : 0}",
79-
]) {
80-
sh "make"
81-
sh "make run-unit-tests"
82-
sh "make docker-test"
83-
}
127+
script {
128+
def myParams = fetchParamsFromGitLog();
129+
def buildSteps = buildBuildSteps(myParams);
130+
buildSteps();
84131
}
85132
}
86133
}
87134
stage('Test') {
88135
steps {
89136
script {
90-
def configs = "${params.KUBECONFIGS}".split(",")
137+
def myParams = fetchParamsFromGitLog();
138+
def configs = "${myParams.KUBECONFIGS}".split(",")
91139
def testTasks = [:]
92140
for (kubeconfig in configs) {
93-
testTasks["${kubeconfig}"] = buildTestSteps(kubeConfigRoot, kubeconfig)
141+
testTasks["${kubeconfig}"] = buildTestSteps(myParams, kubeConfigRoot, kubeconfig)
94142
}
95143
parallel testTasks
96144
}
@@ -101,10 +149,11 @@ pipeline {
101149
post {
102150
always {
103151
script {
104-
def configs = "${params.KUBECONFIGS}".split(",")
152+
def myParams = fetchParamsFromGitLog();
153+
def configs = "${myParams['KUBECONFIGS']}".split(",")
105154
def cleanupTasks = [:]
106155
for (kubeconfig in configs) {
107-
cleanupTasks["${kubeconfig}"] = buildCleanupSteps(kubeConfigRoot, kubeconfig)
156+
cleanupTasks["${kubeconfig}"] = buildCleanupSteps(myParams, kubeConfigRoot, kubeconfig)
108157
}
109158
parallel cleanupTasks
110159
}

Makefile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,25 @@ else
4040
IMAGESUFFIX := :dev
4141
endif
4242

43-
ifndef MANIFESTPATH
44-
MANIFESTPATH := manifests/arango-operator-dev.yaml
43+
ifeq ($(MANIFESTSUFFIX),-)
44+
# Release setting
45+
MANIFESTSUFFIX :=
46+
else
47+
ifndef MANIFESTSUFFIX
48+
MANIFESTSUFFIX := -dev
49+
endif
4550
endif
51+
MANIFESTPATHDEPLOYMENT := manifests/arango-deployment$(MANIFESTSUFFIX).yaml
52+
MANIFESTPATHSTORAGE := manifests/arango-storage$(MANIFESTSUFFIX).yaml
4653
ifndef DEPLOYMENTNAMESPACE
4754
DEPLOYMENTNAMESPACE := default
4855
endif
4956

5057
ifndef OPERATORIMAGE
51-
OPERATORIMAGE := $(DOCKERNAMESPACE)/arangodb-operator$(IMAGESUFFIX)
58+
OPERATORIMAGE := $(DOCKERNAMESPACE)/kube-arangodb$(IMAGESUFFIX)
5259
endif
5360
ifndef TESTIMAGE
54-
TESTIMAGE := $(DOCKERNAMESPACE)/arangodb-operator-test$(IMAGESUFFIX)
61+
TESTIMAGE := $(DOCKERNAMESPACE)/kube-arangodb-test$(IMAGESUFFIX)
5562
endif
5663
ifndef ENTERPRISEIMAGE
5764
ENTERPRISEIMAGE := $(DEFAULTENTERPRISEIMAGE)
@@ -189,7 +196,7 @@ endif
189196
.PHONY: manifests
190197
manifests: $(GOBUILDDIR)
191198
GOPATH=$(GOBUILDDIR) go run $(ROOTDIR)/tools/manifests/manifest_builder.go \
192-
--output=$(MANIFESTPATH) \
199+
--output-suffix=$(MANIFESTSUFFIX) \
193200
--image=$(OPERATORIMAGE) \
194201
--image-sha256=$(IMAGESHA256) \
195202
--namespace=$(DEPLOYMENTNAMESPACE)
@@ -210,7 +217,8 @@ run-unit-tests: $(GOBUILDDIR) $(SOURCES)
210217
go test $(TESTVERBOSEOPTIONS) \
211218
$(REPOPATH)/pkg/apis/deployment/v1alpha \
212219
$(REPOPATH)/pkg/apis/storage/v1alpha \
213-
$(REPOPATH)/pkg/deployment \
220+
$(REPOPATH)/pkg/deployment/reconcile \
221+
$(REPOPATH)/pkg/deployment/resources \
214222
$(REPOPATH)/pkg/util/k8sutil \
215223
$(REPOPATH)/pkg/util/k8sutil/test
216224

@@ -241,15 +249,11 @@ ifneq ($(DEPLOYMENTNAMESPACE), default)
241249
$(ROOTDIR)/scripts/kube_delete_namespace.sh $(DEPLOYMENTNAMESPACE)
242250
kubectl create namespace $(DEPLOYMENTNAMESPACE)
243251
endif
244-
kubectl apply -f $(MANIFESTPATH)
252+
kubectl apply -f manifests/crd.yaml
253+
kubectl apply -f $(MANIFESTPATHSTORAGE)
254+
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
245255
$(ROOTDIR)/scripts/kube_create_storage.sh $(DEPLOYMENTNAMESPACE)
246-
kubectl --namespace $(DEPLOYMENTNAMESPACE) \
247-
run arangodb-operator-test -i --rm --quiet --restart=Never \
248-
--image=$(TESTIMAGE) \
249-
--env="ENTERPRISEIMAGE=$(ENTERPRISEIMAGE)" \
250-
--env="TEST_NAMESPACE=$(DEPLOYMENTNAMESPACE)" \
251-
-- \
252-
-test.v -test.timeout $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
256+
$(ROOTDIR)/scripts/kube_run_tests.sh $(DEPLOYMENTNAMESPACE) $(TESTIMAGE) "$(ENTERPRISEIMAGE)" $(TESTTIMEOUT) $(TESTLENGTHOPTIONS)
253257
ifneq ($(DEPLOYMENTNAMESPACE), default)
254258
kubectl delete namespace $(DEPLOYMENTNAMESPACE) --ignore-not-found --now
255259
endif
@@ -309,9 +313,12 @@ minikube-start:
309313

310314
.PHONY: delete-operator
311315
delete-operator:
312-
kubectl delete -f $(MANIFESTPATH) --ignore-not-found
316+
kubectl delete -f $(MANIFESTPATHDEPLOYMENT) --ignore-not-found
317+
kubectl delete -f $(MANIFESTPATHSTORAGE) --ignore-not-found
313318

314319
.PHONY: redeploy-operator
315320
redeploy-operator: delete-operator manifests
316-
kubectl apply -f $(MANIFESTPATH)
321+
kubectl apply -f manifests/crd.yaml
322+
kubectl apply -f $(MANIFESTPATHSTORAGE)
323+
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
317324
kubectl get pods

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22

33
"Starter for Kubernetes"
44

5-
State: In development
5+
State: In heavy development. DO NOT USE FOR ANY PRODUCTION LIKE PURPOSE! THINGS WILL CHANGE.
66

77
- [User manual](./docs/user/README.md)
88
- [Design documents](./docs/design/README.md)
99

10+
## Installation of latest release
11+
12+
```bash
13+
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.0.1/manifests/crd.yaml
14+
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.0.1/manifests/arango-deployment.yaml
15+
# To use `ArangoLocalStorage`, also run
16+
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.0.1/manifests/arango-storage.yaml
17+
```
18+
1019
## Building
1120

1221
```bash
1322
DOCKERNAMESPACE=<your dockerhub account> make
14-
kubectl apply -f manifests/arango-operator-dev.yaml
23+
kubectl apply -f manifests/crd.yaml
24+
kubectl apply -f manifests/arango-deployment-dev.yaml
25+
# To use `ArangoLocalStorage`, also run
26+
kubectl apply -f manifests/arango-storage-dev.yaml
1527
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.0+git
1+
0.0.1+git

deps/github.com/arangodb/go-driver/http/connection.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ type ConnectionConfig struct {
6767
// directly after use, resulting in a large number of connections in `TIME_WAIT` state.
6868
// When this value is not set, the driver will set it to 64 automatically.
6969
Transport http.RoundTripper
70+
// DontFollowRedirect; if set, redirect will not be followed, response from the initial request will be returned without an error
71+
// DontFollowRedirect takes precendance over FailOnRedirect.
72+
DontFollowRedirect bool
7073
// FailOnRedirect; if set, redirect will not be followed, instead the status code is returned as error
7174
FailOnRedirect bool
7275
// Cluster configuration settings
@@ -137,7 +140,11 @@ func newHTTPConnection(endpoint string, config ConnectionConfig) (driver.Connect
137140
httpClient := &http.Client{
138141
Transport: config.Transport,
139142
}
140-
if config.FailOnRedirect {
143+
if config.DontFollowRedirect {
144+
httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
145+
return http.ErrUseLastResponse // Do not wrap, standard library will not understand
146+
}
147+
} else if config.FailOnRedirect {
141148
httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
142149
return driver.ArangoError{
143150
HasError: true,

docs/user/custom_resource.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ and restarting it.
142142
This setting specifies the name of a kubernetes `Secret` that contains
143143
a standard CA certificate + private key used to sign certificates for individual
144144
ArangoDB servers.
145-
The default value is empty. TBD
145+
When no name is specified, it defaults to `<deployment-name>-ca`.
146+
To disable authentication, set this value to `None`.
146147

147148
If you specify a name of a `Secret` that does not exist, a self-signed CA certificate + key is created
148149
and stored in a `Secret` with given name.

docs/user/tls.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# TLS
22

3-
The ArangoDB operator allows you to create ArangoDB deployments that use
3+
The ArangoDB operator will by default create ArangoDB deployments that use
44
secure TLS connections.
55

66
It uses a single CA certificate (stored in a Kubernetes secret) and
77
one certificate per ArangoDB server (stored in a Kubernetes secret per server).
88

9+
To disable TLS, set `spec.tls.caSecretName` to `None`.
10+
911
## Install CA certificate
1012

1113
If the CA certificate is self-signed, it will not be trusted by browsers,
@@ -16,7 +18,7 @@ To do so, you first have to fetch the CA certificate from its Kubernetes
1618
secret.
1719

1820
```bash
19-
kubectl get secret <deploy-name> --template='{{index .data "ca.crt"}}' | base64 -D > ca.crt
21+
kubectl get secret <deploy-name>-ca --template='{{index .data "ca.crt"}}' | base64 -D > ca.crt
2022
```
2123

2224
### Windows
@@ -39,4 +41,4 @@ sudo /usr/bin/security remove-trusted-cert -d ca.crt
3941

4042
### Linux
4143

42-
TODO
44+
TODO

docs/user/usage.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ The ArangoDB operator needs to be installed in your Kubernetes
66
cluster first. To do so, clone this repository and run:
77

88
```bash
9-
kubectl apply -f manifests/arango-operator.yaml
9+
kubectl apply -f manifests/crd.yaml
10+
kubectl apply -f manifests/arango-deployment.yaml
11+
```
12+
13+
To use `ArangoLocalStorage`, also run:
14+
15+
```bash
16+
kubectl apply -f manifests/arango-storage.yaml
1017
```
1118

1219
## Cluster creation
@@ -37,5 +44,7 @@ To remove the entire ArangoDB operator, remove all
3744
clusters first and then remove the operator by running:
3845

3946
```bash
40-
kubectl delete -f manifests/arango-operator.yaml
47+
kubectl delete -f manifests/arango-deployment.yaml
48+
# If `ArangoLocalStorage` is installed
49+
kubectl delete -f manifests/arango-storage.yaml
4150
```

examples/nodeport-cluster.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ spec:
77
app: arangodb
88
role: coordinator
99
type: NodePort
10+
publishNotReadyAddresses: true
1011
ports:
1112
- protocol: TCP
1213
port: 8529
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: "database.arangodb.com/v1alpha"
2+
kind: "ArangoDeployment"
3+
metadata:
4+
name: "example-simple-cluster-no-tls"
5+
spec:
6+
mode: cluster
7+
tls:
8+
caSecretName: None

0 commit comments

Comments
 (0)