From eadc656f550e4d6b68dfc7000ca01c50ebcf0a2d Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Thu, 24 Oct 2019 17:53:05 +0530 Subject: [PATCH] [bitnami/influxdb] add servicemonitor support Signed-off-by: Sameer Naik --- bitnami/influxdb/Chart.yaml | 2 +- bitnami/influxdb/README.md | 9 ++++-- .../templates/influxdb/servicemonitor.yaml | 30 +++++++++++++++++++ bitnami/influxdb/values-production.yaml | 24 +++++++++++++++ bitnami/influxdb/values.yaml | 24 +++++++++++++++ 5 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 bitnami/influxdb/templates/influxdb/servicemonitor.yaml diff --git a/bitnami/influxdb/Chart.yaml b/bitnami/influxdb/Chart.yaml index c61756302..d0995efba 100644 --- a/bitnami/influxdb/Chart.yaml +++ b/bitnami/influxdb/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: influxdb sources: - https://github.com/bitnami/bitnami-docker-influxdb -version: 0.1.3 +version: 0.2.0 diff --git a/bitnami/influxdb/README.md b/bitnami/influxdb/README.md index ff3b6fb5f..c32232c81 100644 --- a/bitnami/influxdb/README.md +++ b/bitnami/influxdb/README.md @@ -49,8 +49,8 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the InfluxDB chart and their default values. -| Parameter | Description | Default | -| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| Parameter | Description | Default | +|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------| | `global.imageRegistry` | Global Docker image registry | `nil` | | `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `global.storageClass` | Global storage class for dynamic provisioning | `nil` | @@ -148,6 +148,11 @@ The following tables lists the configurable parameters of the InfluxDB chart and | `metrics.service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` | | `metrics.service.loadBalancerSourceRanges` | Address that are allowed when service is LoadBalancer | `[]` | | `metrics.service.clusterIP` | Static clusterIP or None for headless services | `nil` | +| `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` | +| `metrics.serviceMonitor.namespace` | Namespace in which Prometheus is running | `nil` | +| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. | `nil` (Prometheus Operator default value) | +| `metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `nil` (Prometheus Operator default value) | +| `metrics.serviceMonitor.selector` | Prometheus instance selector labels | `nil` | | `networkPolicy.enabled` | Enable NetworkPolicy | `false` | | `networkPolicy.allowExternal` | Don't require client label for connections | `true` | | `persistence.enabled` | Enable data persistence | `true` | diff --git a/bitnami/influxdb/templates/influxdb/servicemonitor.yaml b/bitnami/influxdb/templates/influxdb/servicemonitor.yaml new file mode 100644 index 000000000..97c1d416a --- /dev/null +++ b/bitnami/influxdb/templates/influxdb/servicemonitor.yaml @@ -0,0 +1,30 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "influxdb.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- end }} + labels: {{ include "influxdb.labels" . | nindent 4 }} + app.kubernetes.io/component: influxdb + {{- range $key, $value := .Values.metrics.serviceMonitor.selector }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + selector: + matchLabels: {{ include "influxdb.matchLabels" . | nindent 6 }} + app.kubernetes.io/component: influxdb + endpoints: + - port: http + path: "/metrics" + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} diff --git a/bitnami/influxdb/values-production.yaml b/bitnami/influxdb/values-production.yaml index 436708342..7d414eb57 100644 --- a/bitnami/influxdb/values-production.yaml +++ b/bitnami/influxdb/values-production.yaml @@ -471,6 +471,30 @@ metrics: prometheus.io/port: "{{ .Values.influxdb.service.port }}" prometheus.io/path: "/metrics" + ## Prometheus Operator ServiceMonitor configuration + ## + serviceMonitor: + enabled: false + ## Namespace in which Prometheus is running + ## + # namespace: monitoring + + ## Interval at which metrics should be scraped. + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## + # interval: 10s + + ## Timeout after which the scrape is ended + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## + # scrapeTimeout: 10s + + ## ServiceMonitor selector labels + ## ref: https://github.com/bitnami/charts/tree/master/bitnami/prometheus-operator#prometheus-configuration + ## + # selector: + # prometheus: my-prometheus + ## NetworkPolicy paramaters ## networkPolicy: diff --git a/bitnami/influxdb/values.yaml b/bitnami/influxdb/values.yaml index e86c95457..1b3835b65 100644 --- a/bitnami/influxdb/values.yaml +++ b/bitnami/influxdb/values.yaml @@ -471,6 +471,30 @@ metrics: prometheus.io/port: "{{ .Values.influxdb.service.port }}" prometheus.io/path: "/metrics" + ## Prometheus Operator ServiceMonitor configuration + ## + serviceMonitor: + enabled: false + ## Namespace in which Prometheus is running + ## + # namespace: monitoring + + ## Interval at which metrics should be scraped. + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## + # interval: 10s + + ## Timeout after which the scrape is ended + ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## + # scrapeTimeout: 10s + + ## ServiceMonitor selector labels + ## ref: https://github.com/bitnami/charts/tree/master/bitnami/prometheus-operator#prometheus-configuration + ## + # selector: + # prometheus: my-prometheus + ## NetworkPolicy paramaters ## networkPolicy: