Skip to content

Commit fad7c29

Browse files
authored
Merge pull request #386 from arangodb/feature/servicemonitor
Add service monitor.
2 parents b8203c2 + 2c12ceb commit fad7c29

File tree

16 files changed

+540
-11
lines changed

16 files changed

+540
-11
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ ARANGOSYNCTESTCTRLBINNAME := $(PROJECT)_sync_test_ctrl
121121
ARANGOSYNCTESTCTRLBIN := $(BINDIR)/$(ARANGOSYNCTESTCTRLBINNAME)
122122

123123
.PHONY: all
124-
all: verify-generated build
124+
all: build
125+
126+
.PHONY: allall
127+
allall: verify-generated build
125128

126129
#
127130
# Tip: Run `eval $(minikube docker-env)` before calling make if you're developing on minikube.

docs/Manual/Deployment/Kubernetes/DeploymentResource.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,54 @@ There are two magic values for the secret name:
354354
- `None` specifies no action. This disables root password randomization. This is the default value. (Thus the root password is empty - not recommended)
355355
- `Auto` specifies automatic name generation, which is `<deploymentname>-root-password`.
356356

357+
### `spec.metrics.enabled: bool`
358+
359+
If this is set to `true`, the operator runs a sidecar container for
360+
every DBserver pod and every coordinator pod. The sidecar container runs
361+
the ArangoDB-exporter and exposes metrics of the corresponding `arangod`
362+
instance in Prometheus format on port 9101 under path `/metrics`. You
363+
also have to specify a string for `spec.metrics.image`, which is the
364+
Docker image name of the `arangodb-exporter`. At the time of this
365+
writing you should use `arangodb/arangodb-exporter:0.1.6`. See [this
366+
repository](https://github.com/arangodb-helper/arangodb-exporter) for
367+
the latest version. If the image name is left empty, the same image as
368+
for the main deployment is used. Note however, that current ArangoDB
369+
releases (<= 3.4.5) do not ship the exporter in their image. This is
370+
going to change in the future.
371+
372+
In addition to the sidecar containers the operator will deploy a service
373+
to access the exporter ports (from within the k8s cluster), and a
374+
resource of type `ServiceMonitor`, provided the corresponding custom
375+
resource definition is deployed in the k8s cluster. If you are running
376+
Prometheus in the same k8s cluster with the Prometheus operator, this
377+
will be the case. The `ServiceMonitor` will have the following labels
378+
set:
379+
380+
- `app: arangodb`
381+
- `arango_deployment: YOUR_DEPLOYMENT_NAME`
382+
- `context: metrics`
383+
- `metrics: prometheus`
384+
385+
This makes it possible that you configure your Prometheus deployment to
386+
automatically start monitoring on the available Prometheus feeds. To
387+
this end, you must configure the `serviceMonitorSelector` in the specs
388+
of your Prometheus deployment to match these labels. For example:
389+
390+
```yaml
391+
serviceMonitorSelector:
392+
matchLabels:
393+
metrics: prometheus
394+
```
395+
396+
would automatically select all pods of all ArangoDB cluster deployments
397+
which have metrics enabled.
398+
399+
### `spec.metrics.image: string`
400+
401+
See above, this is the name of the Docker image for the ArangoDB
402+
exporter to expose metrics. If empty, the same image as for the main
403+
deployment is used.
404+
357405
### `spec.<group>.count: number`
358406

359407
This setting specifies the number of servers to start for the given group.
@@ -457,4 +505,4 @@ because servers in these groups do not need persistent storage.
457505

458506
Please use VolumeClaimTemplate from now on. This field is not considered if
459507
VolumeClaimTemplate is set. Note however, that the information in requests
460-
is completely handed over to the pod in this case.
508+
is completely handed over to the pod in this case.

docs/Manual/Deployment/Kubernetes/Metrics.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ The metrics are exposed through HTTPS on port `8528` under path `/metrics`.
88
Look at [examples/metrics](https://github.com/arangodb/kube-arangodb/tree/master/examples/metrics)
99
for examples of `Services` and `ServiceMonitors` you can use to integrate
1010
with Prometheus through the [Prometheus-Operator by CoreOS](https://github.com/coreos/prometheus-operator).
11+
12+
Furthermore, the operator can run sidecar containers for ArangoDB
13+
deployments of type Cluster which expose metrics in Prometheus format.
14+
Use the attribute `spec.metrics` to set this up see the [spec
15+
reference](./DeploymentResource.md) for details.

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ require (
3737
github.com/coreos/go-semver v0.3.0
3838
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
3939
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
40+
github.com/coreos/prometheus-operator v0.30.0
4041
github.com/cpuguy83/go-md2man v1.0.10
4142
github.com/davecgh/go-spew v1.1.1
4243
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
@@ -45,7 +46,7 @@ require (
4546
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
4647
github.com/dustin/go-broadcast v0.0.0-20171205050544-f664265f5a66
4748
github.com/dustin/go-humanize v1.0.0
48-
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633
49+
github.com/emicklei/go-restful v2.6.0+incompatible
4950
github.com/evanphx/json-patch v4.2.0+incompatible // indirect
5051
github.com/ewoutp/go-gitlab-client v0.0.0-20150214183219-6e4464cd3221
5152
github.com/ghodss/yaml v1.0.0
@@ -55,8 +56,8 @@ require (
5556
github.com/go-kit/kit v0.8.0
5657
github.com/go-openapi/analysis v0.19.0
5758
github.com/go-openapi/errors v0.19.0
58-
github.com/go-openapi/jsonpointer v0.18.0
59-
github.com/go-openapi/jsonreference v0.18.0
59+
github.com/go-openapi/jsonpointer v0.19.0
60+
github.com/go-openapi/jsonreference v0.19.0
6061
github.com/go-openapi/loads v0.19.0
6162
github.com/go-openapi/runtime v0.19.0
6263
github.com/go-openapi/spec v0.18.0
@@ -130,7 +131,7 @@ require (
130131
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
131132
golang.org/x/sync v0.0.0-20190423024810-112230192c58
132133
golang.org/x/sys v0.0.0-20190506115046-ca7f33d4116e
133-
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db
134+
golang.org/x/text v0.3.1
134135
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
135136
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc
136137
google.golang.org/api v0.4.0 // indirect
@@ -147,9 +148,8 @@ require (
147148
k8s.io/apiextensions-apiserver v0.0.0-20190409022649-727a075fdec8
148149
k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d
149150
k8s.io/client-go v11.0.0+incompatible
150-
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6
151+
k8s.io/gengo v0.0.0-20190327210449-e17681d19d3a
151152
k8s.io/klog v0.3.0
152153
k8s.io/kube-openapi v0.0.0-20190502190224-411b2483e503 // indirect
153154
k8s.io/utils v0.0.0-20190506122338-8fab8cb257d5 // indirect
154-
sigs.k8s.io/yaml v1.1.0 // indirect
155155
)

0 commit comments

Comments
 (0)