Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Prom metrics #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog
#
## 0.2.6 October 22, 2019
- Add a prometheus exporter sidecar

## 0.2.5: August 30, 2019
- __Potentially breaking__: Add release namespace to all resources to work with `helm template`
See https://github.com/helm/helm/issues/5465 for more information.
Expand Down
2 changes: 1 addition & 1 deletion stable/eventstore/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
description: A Helm chart for Kubernetes EventStore.
name: eventstore
home: https://eventstore.org/
version: 0.2.5
version: 0.2.6
appVersion: 4.1.1-hotfix1
keywords:
- eventstore
Expand Down
83 changes: 45 additions & 38 deletions stable/eventstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,44 +68,51 @@ associated with the chart and deletes the release.

The following table lists the configurable parameters of the Event Store chart and their default values.

| Parameter | Description | Default |
| ------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------- |
| `image` | Container image name | `eventstore/eventstore` |
| `imageTag` | Container image tag | `release-4.1.1-hotfix1` |
| `imagePullPolicy` | Container pull policy | `IfNotPresent` |
| `imagePullSecrets` | Specify image pull secrets | `nil` |
| `clusterSize` | The number of nodes in the cluster | `3` |
| `admin.jobImage` | Post install Job image with `curl` installed for setting admin password | `tutum/curl` |
| `admin.jobImageTag` | Post install Job image tag | `latest` |
| `admin.password` | Custom password for admin interface (should be set in separate file) | `nil` |
| `admin.serviceType` | Service type for the admin interface | `ClusterIP` |
| `admin.proxyImage` | NGINX image for admin interface proxy | `nginx` |
| `admin.proxyImageTag` | NGINX image tag | `latest` |
| `podDisruptionBudget.enabled` | Enable a pod disruption budget for nodes | `false` |
| `podDisruptionBudget.minAvailable` | Number of pods that must still be available after eviction | `2` |
| `podDisruptionBudget.maxUnavailable` | Number of pods that can be unavailable after eviction | `nil` |
| `extIp` | External IP address | `0.0.0.0` |
| `intHttpPort` | Internal HTTP port | `2112` |
| `extHttpPort` | External HTTP port | `2113` |
| `intTcpPort` | Internal TCP port | `1112` |
| `extTcpPort` | External TCP port | `1113` |
| `gossipAllowedDiffMs` | The amount of drift, in ms, between clocks on nodes before gossip is rejected | `600000` |
| `eventStoreConfig` | Additional Event Store parameters | `{}` |
| `scavenging.enabled` | Enable the scavenging CronJob for all nodes | `false` |
| `scavenging.image` | The image to use for the scavenging CronJob | `lachlanevenson/k8s-kubectl` |
| `scavenging.imageTag` | The image tag use for the scavenging CronJob | `latest` |
| `scavenging.schedule` | The schedule to use for the scavenging CronJob | `0 2 * * *` |
| `persistence.enabled` | Enable persistence using PVC | `false` |
| `persistence.existingClaim` | Provide an existing PVC | `nil` |
| `persistence.accessMode` | Access Mode for PVC | `ReadWriteOnce` |
| `persistence.size` | Size of data volume | `8Gi` |
| `persistence.mountPath` | Mount path of data volume | `/var/lib/eventstore` |
| `persistence.annotations` | Annotations for PVC | `{}` |
| `resources` | CPU/Memory resource request/limits | Memory: `256Mi`, CPU: `100m` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `podAnnotations` | Pod annotations | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Affinity settings for pod assignment | `{}` |
| Parameter | Description | Default |
| ------------------------------------ | ----------------------------------------------------------------------------- | --------------------------------- |
| `image` | Container image name | `eventstore/eventstore` |
| `imageTag` | Container image tag | `release-4.1.1-hotfix1` |
| `imagePullPolicy` | Container pull policy | `IfNotPresent` |
| `imagePullSecrets` | Specify image pull secrets | `nil` |
| `clusterSize` | The number of nodes in the cluster | `3` |
| `admin.jobImage` | Post install Job image with `curl` installed for setting admin password | `tutum/curl` |
| `admin.jobImageTag` | Post install Job image tag | `latest` |
| `admin.password` | Custom password for admin interface (should be set in separate file) | `nil` |
| `admin.serviceType` | Service type for the admin interface | `ClusterIP` |
| `admin.proxyImage` | NGINX image for admin interface proxy | `nginx` |
| `admin.proxyImageTag` | NGINX image tag | `latest` |
| `podDisruptionBudget.enabled` | Enable a pod disruption budget for nodes | `false` |
| `podDisruptionBudget.minAvailable` | Number of pods that must still be available after eviction | `2` |
| `podDisruptionBudget.maxUnavailable` | Number of pods that can be unavailable after eviction | `nil` |
| `extIp` | External IP address | `0.0.0.0` |
| `intHttpPort` | Internal HTTP port | `2112` |
| `extHttpPort` | External HTTP port | `2113` |
| `intTcpPort` | Internal TCP port | `1112` |
| `extTcpPort` | External TCP port | `1113` |
| `gossipAllowedDiffMs` | The amount of drift, in ms, between clocks on nodes before gossip is rejected | `600000` |
| `eventStoreConfig` | Additional Event Store parameters | `{}` |
| `scavenging.enabled` | Enable the scavenging CronJob for all nodes | `false` |
| `scavenging.image` | The image to use for the scavenging CronJob | `lachlanevenson/k8s-kubectl` |
| `scavenging.imageTag` | The image tag use for the scavenging CronJob | `latest` |
| `scavenging.schedule` | The schedule to use for the scavenging CronJob | `0 2 * * *` |
| `persistence.enabled` | Enable persistence using PVC | `false` |
| `persistence.existingClaim` | Provide an existing PVC | `nil` |
| `persistence.accessMode` | Access Mode for PVC | `ReadWriteOnce` |
| `persistence.size` | Size of data volume | `8Gi` |
| `persistence.mountPath` | Mount path of data volume | `/var/lib/eventstore` |
| `persistence.annotations` | Annotations for PVC | `{}` |
| `resources` | CPU/Memory resource request/limits | Memory: `256Mi`, CPU: `100m` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `podAnnotations` | Pod annotations | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Affinity settings for pod assignment | `{}` |
| `metrics.enabled` | Enable a sidecar to export prometheus metrics | `false` |
| `metrics.image.registry` | Docker registry from which to pull the metrics image | `docker.io` |
| `metrics.image.repository` | Docker repository from which to pull the metrics image | `marcinbudny/eventstore_exporter` |
| `metrics.image.tag` | Metric exporter image tag to pull | `0.7.0` |
| `metrics.port` | Metrics exporter port | `9448` |
| `metrics.resources` | CPU/Memory resource requests/limits for the metrics exporter | `{}` |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`
or create a `values.yaml` file and use `helm install --values values.yaml`.
Expand Down
7 changes: 7 additions & 0 deletions stable/eventstore/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ Create DNS used to access the service from within the cluster.
{{- define "eventstore.dns" -}}
{{ include "eventstore.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
{{- end -}}

{{- define "eventstore.metrics.image" -}}
{{- $registryName := default "docker.io" .Values.metrics.image.registry -}}
{{- $repositoryName := .Values.metrics.image.repository -}}
{{- $tag := default "latest" .Values.metrics.image.tag | toString -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
36 changes: 30 additions & 6 deletions stable/eventstore/templates/eventstore-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ spec:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/eventstore-configmap.yaml") . | sha256sum }}
{{- if .Values.metrics.enabled }}
prometheus.io/scrape: "true"
prometheus.io/port: {{ .Values.metrics.port | quote }}
{{- end }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "eventstore.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: database
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
Expand All @@ -44,6 +47,26 @@ spec:
{{- end}}
{{- end }}
containers:
{{- if .Values.metrics.enabled }}
- name: prometheus-exporter
image: {{ template "eventstore.metrics.image" . }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
env:
- name: EVENTSTORE_USER
value: admin
- name: EVENTSTORE_PASSWORD
value: {{- if .Values.admin.password }} {{- .Values.admin.password }} {{- else }} changeit {{- end }}
- name: PORT
value: {{ .Values.metrics.port | quote }}
- name: CLUSTER_MODE
value: {{- if and .Values.extIp (gt (.Values.clusterSize | float64) 1.0) }} cluster {{- else }} single {{- end }}
ports:
- name: metrics
containerPort: {{ .Values.metrics.port }}
{{- if .Values.metrics.resources }}
resources: {{- toYaml .Values.metrics.resources | nindent 12 -}}
{{- end }}
{{- end }}
- name: {{ .Chart.Name }}
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.imagePullPolicy }}
Expand Down Expand Up @@ -88,8 +111,9 @@ spec:
initialDelaySeconds: 15
timeoutSeconds: 5
periodSeconds: 15
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 12 -}}
{{- end }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
Expand Down
11 changes: 11 additions & 0 deletions stable/eventstore/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ persistence:
mountPath: /var/lib/eventstore
annotations: {}

## Export prometheus metrics
metrics:
enabled: false
image:
registry: docker.io
repository: marcinbudny/eventstore_exporter
tag: 0.7.0
## The port on which the exporter sidecar will expose its metrics
port: 9448
resources: {}

resources: {}
## If you want to specify resources, uncomment the following
## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
Expand Down