Skip to content

Commit bed3cb3

Browse files
committed
Merge branch 'master' into chaos
2 parents 48020c8 + fc89337 commit bed3cb3

File tree

12 files changed

+274
-11
lines changed

12 files changed

+274
-11
lines changed

CHANGELOG.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Change Log
2+
3+
## [Unreleased](https://github.com/arangodb/kube-arangodb/tree/HEAD)
4+
5+
[Full Changelog](https://github.com/arangodb/kube-arangodb/compare/0.0.1...HEAD)
6+
7+
**Closed issues:**
8+
9+
- make sure scripts terminate to avoid hanging CI [\#63](https://github.com/arangodb/kube-arangodb/issues/63)
10+
- prefix environment variables [\#62](https://github.com/arangodb/kube-arangodb/issues/62)
11+
- warning when passing string literal "None" as spec.tls.caSecretName [\#60](https://github.com/arangodb/kube-arangodb/issues/60)
12+
13+
**Merged pull requests:**
14+
15+
- Added helper to prepull arangodb \(enterprise\) image. This allows the normal tests to have decent timeouts while prevent a timeout caused by a long during image pull. [\#94](https://github.com/arangodb/kube-arangodb/pull/94)
16+
- Tracking recent pod terminations [\#91](https://github.com/arangodb/kube-arangodb/pull/91)
17+
- Enable LONG on kube-arangodb-long test [\#90](https://github.com/arangodb/kube-arangodb/pull/90)
18+
- Tests/modes [\#88](https://github.com/arangodb/kube-arangodb/pull/88)
19+
- increase timeout for long running tests [\#87](https://github.com/arangodb/kube-arangodb/pull/87)
20+
- fix rocksdb\_encryption\_test [\#86](https://github.com/arangodb/kube-arangodb/pull/86)
21+
- fix - /api/version will answer on all servers \(not leader only\) [\#85](https://github.com/arangodb/kube-arangodb/pull/85)
22+
- fixes required after merge [\#84](https://github.com/arangodb/kube-arangodb/pull/84)
23+
- Deployment state -\> phase [\#83](https://github.com/arangodb/kube-arangodb/pull/83)
24+
- Added detection on unschedulable pods [\#82](https://github.com/arangodb/kube-arangodb/pull/82)
25+
- AsOwner no longer things the owner refers to a controller. It refers to the ArangoDeployment [\#81](https://github.com/arangodb/kube-arangodb/pull/81)
26+
- Store & compare hash of secrets. [\#80](https://github.com/arangodb/kube-arangodb/pull/80)
27+
- Control jenkins from git commit log. [\#79](https://github.com/arangodb/kube-arangodb/pull/79)
28+
- Fix scale-up [\#78](https://github.com/arangodb/kube-arangodb/pull/78)
29+
- Added terminated-pod cleanup to speed up re-creation of pods. [\#77](https://github.com/arangodb/kube-arangodb/pull/77)
30+
- add upgrade tests [\#76](https://github.com/arangodb/kube-arangodb/pull/76)
31+
- check result of api version call [\#75](https://github.com/arangodb/kube-arangodb/pull/75)
32+
- Also watch changes in PVCs and Services [\#74](https://github.com/arangodb/kube-arangodb/pull/74)
33+
- Feature/test individual pod deletion [\#72](https://github.com/arangodb/kube-arangodb/pull/72)
34+
- Moved low level resource \(pod,pvc,secret,service\) creation & inspection to resources sub-package. [\#71](https://github.com/arangodb/kube-arangodb/pull/71)
35+
- Moved reconciliation code to separate package [\#70](https://github.com/arangodb/kube-arangodb/pull/70)
36+
- Test/different deployments resilient [\#69](https://github.com/arangodb/kube-arangodb/pull/69)
37+
- Store accepted spec [\#68](https://github.com/arangodb/kube-arangodb/pull/68)
38+
- Fixed behavior for scaling UI integration wrt startup of the cluster [\#67](https://github.com/arangodb/kube-arangodb/pull/67)
39+
- Fixed immitable `mode` field. [\#66](https://github.com/arangodb/kube-arangodb/pull/66)
40+
- Integrate with scaling web-UI [\#65](https://github.com/arangodb/kube-arangodb/pull/65)
41+
- add test for different deployments [\#64](https://github.com/arangodb/kube-arangodb/pull/64)
42+
- Fixed validation of tls.caSecretName=None [\#61](https://github.com/arangodb/kube-arangodb/pull/61)
43+
- Feature/add tests for immutable cluster parameters [\#59](https://github.com/arangodb/kube-arangodb/pull/59)
44+
- rename test function [\#58](https://github.com/arangodb/kube-arangodb/pull/58)
45+
- Detecting ImageID & ArangoDB version. [\#57](https://github.com/arangodb/kube-arangodb/pull/57)
46+
- Adds ssl support for scaling test [\#53](https://github.com/arangodb/kube-arangodb/pull/53)
47+
- Rotation support for members. [\#49](https://github.com/arangodb/kube-arangodb/pull/49)
48+
- begin to add tests for `apis/storage/v1alpha` [\#36](https://github.com/arangodb/kube-arangodb/pull/36)
49+
50+
## [0.0.1](https://github.com/arangodb/kube-arangodb/tree/0.0.1) (2018-03-20)
51+
**Merged pull requests:**
52+
53+
- Changed scope of ArangoLocalStorage to Cluster. [\#56](https://github.com/arangodb/kube-arangodb/pull/56)
54+
- External crd creation [\#55](https://github.com/arangodb/kube-arangodb/pull/55)
55+
- Rename default docker image to kube-arangodb [\#54](https://github.com/arangodb/kube-arangodb/pull/54)
56+
- Splitting operator in two parts [\#52](https://github.com/arangodb/kube-arangodb/pull/52)
57+
- Turn on TLS by default [\#51](https://github.com/arangodb/kube-arangodb/pull/51)
58+
- Rename repository to `kube-arangodb` [\#48](https://github.com/arangodb/kube-arangodb/pull/48)
59+
- Use single image tag to prevent polluting the docker hub [\#47](https://github.com/arangodb/kube-arangodb/pull/47)
60+
- Renamed pkg/apis/arangodb to pkg/apis/deployment [\#46](https://github.com/arangodb/kube-arangodb/pull/46)
61+
- Added release code [\#45](https://github.com/arangodb/kube-arangodb/pull/45)
62+
- Cleaning up deployment, avoiding docker overrides [\#44](https://github.com/arangodb/kube-arangodb/pull/44)
63+
- TLS support [\#43](https://github.com/arangodb/kube-arangodb/pull/43)
64+
- Adds "Storage Resource" to user README [\#42](https://github.com/arangodb/kube-arangodb/pull/42)
65+
- Reworked TLS spec [\#41](https://github.com/arangodb/kube-arangodb/pull/41)
66+
- Set sesion affinity for coordinator [\#40](https://github.com/arangodb/kube-arangodb/pull/40)
67+
- Set PublishNotReadyAddresses on coordinator&syncmasters service [\#39](https://github.com/arangodb/kube-arangodb/pull/39)
68+
- Prepare test cluster [\#38](https://github.com/arangodb/kube-arangodb/pull/38)
69+
- Run tests on multiple clusters in parallel [\#37](https://github.com/arangodb/kube-arangodb/pull/37)
70+
- Implemented isDefault behavior of storage class [\#35](https://github.com/arangodb/kube-arangodb/pull/35)
71+
- add some tests for util/k8sutil/erros.go [\#32](https://github.com/arangodb/kube-arangodb/pull/32)
72+
- Adding `ArangoLocalStorage` resource \(wip\) [\#31](https://github.com/arangodb/kube-arangodb/pull/31)
73+
- Added custom resource spec for ArangoDB Storage operator. [\#30](https://github.com/arangodb/kube-arangodb/pull/30)
74+
- Added unit tests for k8s secrets & utility methods [\#28](https://github.com/arangodb/kube-arangodb/pull/28)
75+
- Added unit test for creating affinity [\#27](https://github.com/arangodb/kube-arangodb/pull/27)
76+
- More simple tests [\#26](https://github.com/arangodb/kube-arangodb/pull/26)
77+
- Changed default storage engine to RocksDB [\#24](https://github.com/arangodb/kube-arangodb/pull/24)
78+
- Adding command line tests for arangod commandlines. [\#23](https://github.com/arangodb/kube-arangodb/pull/23)
79+
- UnitTests for plan\_builder [\#22](https://github.com/arangodb/kube-arangodb/pull/22)
80+
- Unit tests for apis/arangodb/v1alpha package [\#21](https://github.com/arangodb/kube-arangodb/pull/21)
81+
- Fix bash error [\#20](https://github.com/arangodb/kube-arangodb/pull/20)
82+
- Renamed Controller to Operator [\#19](https://github.com/arangodb/kube-arangodb/pull/19)
83+
- Cleanup kubernetes after tests [\#18](https://github.com/arangodb/kube-arangodb/pull/18)
84+
- Adding rocksdb encryption key support [\#17](https://github.com/arangodb/kube-arangodb/pull/17)
85+
- Adding test design [\#16](https://github.com/arangodb/kube-arangodb/pull/16)
86+
- avoid sub-shell creation [\#15](https://github.com/arangodb/kube-arangodb/pull/15)
87+
- Adding authentication support [\#14](https://github.com/arangodb/kube-arangodb/pull/14)
88+
- Scaling deployments [\#13](https://github.com/arangodb/kube-arangodb/pull/13)
89+
- Test framework [\#11](https://github.com/arangodb/kube-arangodb/pull/11)
90+
- Change docs to "authentication default on" [\#10](https://github.com/arangodb/kube-arangodb/pull/10)
91+
- Pod monitoring [\#9](https://github.com/arangodb/kube-arangodb/pull/9)
92+
- Pod affinity [\#8](https://github.com/arangodb/kube-arangodb/pull/8)
93+
- Extended storage docs wrt local storage [\#7](https://github.com/arangodb/kube-arangodb/pull/7)
94+
- Adding event support [\#6](https://github.com/arangodb/kube-arangodb/pull/6)
95+
- Added pod probes [\#5](https://github.com/arangodb/kube-arangodb/pull/5)
96+
- Creating pods [\#4](https://github.com/arangodb/kube-arangodb/pull/4)
97+
- Extending spec & status object. Implementing service & pvc creation [\#3](https://github.com/arangodb/kube-arangodb/pull/3)
98+
- Initial API objects & vendoring [\#2](https://github.com/arangodb/kube-arangodb/pull/2)
99+
- Added specification of custom resource [\#1](https://github.com/arangodb/kube-arangodb/pull/1)
100+
101+
102+
103+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,20 @@ endif
273273

274274
# Release building
275275

276+
.PHONY: patch-readme
277+
patch-readme:
278+
$(ROOTDIR)/scripts/patch_readme.sh $(VERSION_MAJOR_MINOR_PATCH)
279+
280+
.PHONY: update-changelog
281+
changelog:
282+
docker run -it --rm \
283+
-e CHANGELOG_GITHUB_TOKEN=$(shell cat ~/.arangodb/github-token) \
284+
-v "$(ROOTDIR)":/usr/local/src/your-app \
285+
ferrarimarco/github-changelog-generator \
286+
--user arangodb \
287+
--project kube-arangodb \
288+
--no-author
289+
276290
.PHONY: docker-push
277291
docker-push: docker
278292
ifneq ($(DOCKERNAMESPACE), arangodb)

main.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"github.com/arangodb/kube-arangodb/pkg/operator"
4949
"github.com/arangodb/kube-arangodb/pkg/util/constants"
5050
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
51+
"github.com/arangodb/kube-arangodb/pkg/util/probe"
5152
"github.com/arangodb/kube-arangodb/pkg/util/retry"
5253
)
5354

@@ -82,6 +83,8 @@ var (
8283
chaosOptions struct {
8384
allowed bool
8485
}
86+
deploymentProbe probe.Probe
87+
storageProbe probe.Probe
8588
)
8689

8790
func init() {
@@ -137,7 +140,9 @@ func cmdMainRun(cmd *cobra.Command, args []string) {
137140
cliLog.Fatal().Err(err).Msg("Failed to get hostname")
138141
}
139142

140-
//http.HandleFunc(probe.HTTPReadyzEndpoint, probe.ReadyzHandler)
143+
http.HandleFunc("/health", probe.LivenessHandler)
144+
http.HandleFunc("/ready/deployment", deploymentProbe.ReadyHandler)
145+
http.HandleFunc("/ready/storage", storageProbe.ReadyHandler)
141146
http.Handle("/metrics", prometheus.Handler())
142147
listenAddr := net.JoinHostPort(server.host, strconv.Itoa(server.port))
143148
go http.ListenAndServe(listenAddr, nil)
@@ -188,11 +193,13 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
188193
AllowChaos: chaosOptions.allowed,
189194
}
190195
deps := operator.Dependencies{
191-
LogService: logService,
192-
KubeCli: kubecli,
193-
KubeExtCli: kubeExtCli,
194-
CRCli: crCli,
195-
EventRecorder: eventRecorder,
196+
LogService: logService,
197+
KubeCli: kubecli,
198+
KubeExtCli: kubeExtCli,
199+
CRCli: crCli,
200+
EventRecorder: eventRecorder,
201+
DeploymentProbe: &deploymentProbe,
202+
StorageProbe: &storageProbe,
196203
}
197204

198205
return cfg, deps, nil

manifests/templates/deployment/deployment.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ metadata:
66
namespace: {{ .Deployment.Operator.Namespace }}
77
spec:
88
replicas: 1
9+
strategy:
10+
type: Recreate
911
template:
1012
metadata:
1113
labels:
@@ -27,3 +29,18 @@ spec:
2729
valueFrom:
2830
fieldRef:
2931
fieldPath: metadata.name
32+
ports:
33+
- name: metrics
34+
containerPort: 8528
35+
livenessProbe:
36+
httpGet:
37+
path: /health
38+
port: 8528
39+
initialDelaySeconds: 5
40+
periodSeconds: 10
41+
readinessProbe:
42+
httpGet:
43+
path: /ready/deployment
44+
port: 8528
45+
initialDelaySeconds: 5
46+
periodSeconds: 10

manifests/templates/storage/deployment.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ metadata:
1414
namespace: {{ .Storage.Operator.Namespace }}
1515
spec:
1616
replicas: 1
17+
strategy:
18+
type: Recreate
1719
template:
1820
metadata:
1921
labels:
@@ -35,3 +37,19 @@ spec:
3537
valueFrom:
3638
fieldRef:
3739
fieldPath: metadata.name
40+
ports:
41+
- name: metrics
42+
containerPort: 8528
43+
livenessProbe:
44+
httpGet:
45+
path: /health
46+
port: 8528
47+
initialDelaySeconds: 5
48+
periodSeconds: 10
49+
readinessProbe:
50+
httpGet:
51+
path: /ready/storage
52+
port: 8528
53+
initialDelaySeconds: 5
54+
periodSeconds: 10
55+

pkg/operator/operator.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
4040
"github.com/arangodb/kube-arangodb/pkg/logging"
4141
"github.com/arangodb/kube-arangodb/pkg/storage"
42+
"github.com/arangodb/kube-arangodb/pkg/util/probe"
4243
)
4344

4445
const (
@@ -71,11 +72,13 @@ type Config struct {
7172
}
7273

7374
type Dependencies struct {
74-
LogService logging.Service
75-
KubeCli kubernetes.Interface
76-
KubeExtCli apiextensionsclient.Interface
77-
CRCli versioned.Interface
78-
EventRecorder record.EventRecorder
75+
LogService logging.Service
76+
KubeCli kubernetes.Interface
77+
KubeExtCli apiextensionsclient.Interface
78+
CRCli versioned.Interface
79+
EventRecorder record.EventRecorder
80+
DeploymentProbe *probe.Probe
81+
StorageProbe *probe.Probe
7982
}
8083

8184
// NewOperator instantiates a new operator from given config & dependencies.

pkg/operator/operator_deployment.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func (o *Operator) runDeployments(stop <-chan struct{}) {
5858
DeleteFunc: o.onDeleteArangoDeployment,
5959
}, cache.Indexers{})
6060

61+
o.Dependencies.DeploymentProbe.SetReady()
6162
informer.Run(stop)
6263
}
6364

pkg/operator/operator_local_storage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func (o *Operator) runLocalStorages(stop <-chan struct{}) {
5858
DeleteFunc: o.onDeleteArangoLocalStorage,
5959
}, cache.Indexers{})
6060

61+
o.Dependencies.StorageProbe.SetReady()
6162
informer.Run(stop)
6263
}
6364

pkg/util/probe/health.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
// Author Ewout Prangsma
21+
//
22+
23+
package probe
24+
25+
import (
26+
"net/http"
27+
)
28+
29+
// LivenessHandler writes back the HTTP status code 200 to indicate a healthy operator.
30+
func LivenessHandler(w http.ResponseWriter, r *http.Request) {
31+
w.WriteHeader(http.StatusOK)
32+
}

pkg/util/probe/ready.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
// Author Ewout Prangsma
21+
//
22+
23+
package probe
24+
25+
import (
26+
"net/http"
27+
"sync/atomic"
28+
)
29+
30+
// Probe wraps a readiness probe handler.
31+
type Probe struct {
32+
ready int32
33+
}
34+
35+
// SetReady marks the probe as ready.
36+
func (p *Probe) SetReady() {
37+
atomic.StoreInt32(&p.ready, 1)
38+
}
39+
40+
// ReadyHandler writes back the HTTP status code 200 if the operator is ready, and 500 otherwise.
41+
func (p *Probe) ReadyHandler(w http.ResponseWriter, r *http.Request) {
42+
isReady := atomic.LoadInt32(&p.ready) != 0
43+
if isReady {
44+
w.WriteHeader(http.StatusOK)
45+
} else {
46+
w.WriteHeader(http.StatusInternalServerError)
47+
}
48+
}

0 commit comments

Comments
 (0)