From 9fcd5cc898d36c96ea346e1736042e0050266483 Mon Sep 17 00:00:00 2001 From: Sameer Naik Date: Fri, 25 Oct 2019 15:15:47 +0530 Subject: [PATCH] [bitnami/kibana] adds servicemonitor support Signed-off-by: Sameer Naik --- bitnami/kibana/README.md | 171 ++++++++++--------- bitnami/kibana/templates/servicemonitor.yaml | 28 +++ bitnami/kibana/values-production.yaml | 24 +++ bitnami/kibana/values.yaml | 24 +++ 4 files changed, 164 insertions(+), 83 deletions(-) create mode 100644 bitnami/kibana/templates/servicemonitor.yaml diff --git a/bitnami/kibana/README.md b/bitnami/kibana/README.md index 837fb8a77..a09d43cbc 100644 --- a/bitnami/kibana/README.md +++ b/bitnami/kibana/README.md @@ -67,89 +67,94 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the kibana chart and their default values. -| 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` | -| `image.registry` | Kibana image registry | `docker.io` | -| `image.repository` | Kibana image name | `bitnami/kibana` | -| `image.tag` | Kibana image tag | `{TAG_NAME}` | -| `image.pullPolicy` | Kibana image pull policy | `IfNotPresent` | -| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | -| `nameOverride` | String to partially override kibana.fullname template with a string (will prepend the release name) | `nil` | -| `fullnameOverride` | String to fully override kibana.fullname template with a string | `nil` | -| `replicaCount` | Number of replicas of the Kibana Pod | `1` | -| `updateStrategy` | Update strategy for deployment (evaluated as a template) | `{type: "RollingUpdate"}` | -| `schedulerName` | Alternative scheduler | `nil` | -| `plugins` | Array containing the Kibana plugins to be installed in deployment | `[]` | -| `savedObjects.urls` | Array containing links to NDJSON files to be imported during Kibana initialization | `[]` | -| `savedObjects.configmap` | Configmap containing NDJSON files to be imported during Kibana initialization (evaluated as a template) | `[]` | -| `extraConfiguration` | Extra settings to be added to the default kibana.yml configmap that the chart creates (unless replaced using `configurationCM`). Evaluated as a template | `nil` | -| `configurationCM` | ConfigMap containing a kibana.yml file that will replace the default one specified in configuration.yaml | `nil` | -| `extraEnvVars` | Array containing extra env vars to configure Kibana | `nil` | -| `extraEnvVarsCM` | ConfigMap containing extra env vars to configure Kibana | `nil` | -| `extraEnvVarsSecret` | Secret containing extra env vars to configure Kibana (in case of sensitive data) | `nil` | -| `extraVolumes` | Array of extra volumes to be added to the Kibana deployment (evaluated as template). Requires setting `extraVolumeMounts` | `nil` | -| `extraVolumeMounts` | Array of extra volume mounts to be added to the Kibana deployment (evaluated as template). Normally used with `extraVolumes`. | `nil` | -| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` | -| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | -| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | -| `volumePermissions.image.tag` | Init container volume-permissions image tag | `stretch` | -| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | -| `volumePermissions.resources` | Init container resource requests/limit | `nil` | -| `persistence.enabled` | Enable persistence | `true` | -| `presistence.storageClass` | Storage class to use with the PVC | `nil` | -| `persistence.accessMode` | Access mode to the PV | `ReadWriteOnce` | -| `persistence.size` | Size for the PV | `10Gi` | -| `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | -| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | -| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `readinessProbe.enabled` | Enable/disable the Readiness probe | `true` | -| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | -| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | -| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `service.type` | Kubernetes Service type | | `ClusterIP` | -| `service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | -| `service.annotations` | Annotations for Kibana service (evaluated as a template) | `{}` | -| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | -| `service.loadBalancerIP` | loadBalancerIP if Kibana service type is `LoadBalancer` | `nil` | -| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value). Evaluated as a template. | `nil` | -| `forceInitScripts` | Force the execution of the init scripts located in `/docker-entrypoint-initdb.d` | `false` | -| `initScriptsCM` | ConfigMap containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (evaluated as a template) | `nil` | -| `initScriptsSecret` | Secret containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (that contain sensitive data). Evaluated as a template. | `nil` | -| `ingress.enabled` | Enable ingress controller resource | `false` | -| `ingress.certManager` | Add annotations for cert-manager | `false` | -| `ingress.annotations` | Ingress annotations | `[]` | -| `ingress.hosts[0].name` | Hostname to your Kibana installation | `kibana.local` | -| `ingress.hosts[0].path` | Path within the url structure | `/` | -| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | -| `ingress.hosts[0].tlsHosts` | Array of TLS hosts for ingress record (defaults to `ingress.hosts[0].name` if `nil`) | `nil` | -| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `kibana.local-tls` | -| `securityContext.enabled` | Enable securityContext on for Kibana deployment | `true` | -| `securityContext.runAsUser` | User for the security context | `1001` | -| `securityContext.fsGroup` | Group to configure permissions for volumes | `1001` | -| `resources` | Configure resource requests and limits (evaluated as a template) | `nil` | -| `nodeSelector` | Node labels for pod assignment (evaluated as a template) | `{}` | -| `tolerations` | Tolerations for pod assignment (evaluated as a template) | `[]` | -| `affinity` | Affinity for pod assignment (evaluated as a template) | `{}` | -| `podAnnotations` | Pod annotations (evaluated as a template) | `{}` | -| `sidecars` | Attach additional containers to the pod (evaluated as a template) | `nil` | -| `initContainers` | Add additional init containers to the pod (evaluated as a template) | `nil` | -| `metrics.enabled` | Start a side-car prometheus exporter | `false` | -| `metrics.service.annotations` | Prometheus annotations for the Kibana service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | -| `elasticsearch.enabled` | Use bundled Elasticsearch | `true` | -| `elasticsearch.sysctlImage.enabled` | Use sysctl image for bundled Elasticsearch | `true` | -| `elasticsearch.master.replicas` | Desired number of Elasticsearch master-eligible nodes | `1` | -| `elasticsearch.coordinating.replicas` | Desired number of Elasticsearch coordinating-only nodes | `1` | -| `elasticsearch.data.replicas` | Desired number of Elasticsearch data nodes | `1` | -| `elasticsearch.external.hosts` | Array containing the hostnames for the already existing Elasticsearch instances | `nil` | -| `elasticsearch.external.port` | Port for the accessing external Elasticsearch instances | `nil` | +| 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` | | +| `image.registry` | Kibana image registry | `docker.io` | | +| `image.repository` | Kibana image name | `bitnami/kibana` | | +| `image.tag` | Kibana image tag | `{TAG_NAME}` | | +| `image.pullPolicy` | Kibana image pull policy | `IfNotPresent` | | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | +| `nameOverride` | String to partially override kibana.fullname template with a string (will prepend the release name) | `nil` | | +| `fullnameOverride` | String to fully override kibana.fullname template with a string | `nil` | | +| `replicaCount` | Number of replicas of the Kibana Pod | `1` | | +| `updateStrategy` | Update strategy for deployment (evaluated as a template) | `{type: "RollingUpdate"}` | | +| `schedulerName` | Alternative scheduler | `nil` | | +| `plugins` | Array containing the Kibana plugins to be installed in deployment | `[]` | | +| `savedObjects.urls` | Array containing links to NDJSON files to be imported during Kibana initialization | `[]` | | +| `savedObjects.configmap` | Configmap containing NDJSON files to be imported during Kibana initialization (evaluated as a template) | `[]` | | +| `extraConfiguration` | Extra settings to be added to the default kibana.yml configmap that the chart creates (unless replaced using `configurationCM`). Evaluated as a template | `nil` | | +| `configurationCM` | ConfigMap containing a kibana.yml file that will replace the default one specified in configuration.yaml | `nil` | | +| `extraEnvVars` | Array containing extra env vars to configure Kibana | `nil` | | +| `extraEnvVarsCM` | ConfigMap containing extra env vars to configure Kibana | `nil` | | +| `extraEnvVarsSecret` | Secret containing extra env vars to configure Kibana (in case of sensitive data) | `nil` | | +| `extraVolumes` | Array of extra volumes to be added to the Kibana deployment (evaluated as template). Requires setting `extraVolumeMounts` | `nil` | | +| `extraVolumeMounts` | Array of extra volume mounts to be added to the Kibana deployment (evaluated as template). Normally used with `extraVolumes`. | `nil` | | +| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` | | +| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | | +| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | | +| `volumePermissions.image.tag` | Init container volume-permissions image tag | `stretch` | | +| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | | +| `volumePermissions.resources` | Init container resource requests/limit | `nil` | | +| `persistence.enabled` | Enable persistence | `true` | | +| `presistence.storageClass` | Storage class to use with the PVC | `nil` | | +| `persistence.accessMode` | Access mode to the PV | `ReadWriteOnce` | | +| `persistence.size` | Size for the PV | `10Gi` | | +| `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` | | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | | +| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | | +| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | | +| `readinessProbe.enabled` | Enable/disable the Readiness probe | `true` | | +| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | | +| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | | +| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | | +| `service.type` | Kubernetes Service type | | `ClusterIP` | +| `service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | | +| `service.annotations` | Annotations for Kibana service (evaluated as a template) | `{}` | | +| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | +| `service.loadBalancerIP` | loadBalancerIP if Kibana service type is `LoadBalancer` | `nil` | | +| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value). Evaluated as a template. | `nil` | | +| `forceInitScripts` | Force the execution of the init scripts located in `/docker-entrypoint-initdb.d` | `false` | | +| `initScriptsCM` | ConfigMap containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (evaluated as a template) | `nil` | | +| `initScriptsSecret` | Secret containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (that contain sensitive data). Evaluated as a template. | `nil` | | +| `ingress.enabled` | Enable ingress controller resource | `false` | | +| `ingress.certManager` | Add annotations for cert-manager | `false` | | +| `ingress.annotations` | Ingress annotations | `[]` | | +| `ingress.hosts[0].name` | Hostname to your Kibana installation | `kibana.local` | | +| `ingress.hosts[0].path` | Path within the url structure | `/` | | +| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | | +| `ingress.hosts[0].tlsHosts` | Array of TLS hosts for ingress record (defaults to `ingress.hosts[0].name` if `nil`) | `nil` | | +| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `kibana.local-tls` | | +| `securityContext.enabled` | Enable securityContext on for Kibana deployment | `true` | | +| `securityContext.runAsUser` | User for the security context | `1001` | | +| `securityContext.fsGroup` | Group to configure permissions for volumes | `1001` | | +| `resources` | Configure resource requests and limits (evaluated as a template) | `nil` | | +| `nodeSelector` | Node labels for pod assignment (evaluated as a template) | `{}` | | +| `tolerations` | Tolerations for pod assignment (evaluated as a template) | `[]` | | +| `affinity` | Affinity for pod assignment (evaluated as a template) | `{}` | | +| `podAnnotations` | Pod annotations (evaluated as a template) | `{}` | | +| `sidecars` | Attach additional containers to the pod (evaluated as a template) | `nil` | | +| `initContainers` | Add additional init containers to the pod (evaluated as a template) | `nil` | | +| `metrics.enabled` | Start a side-car prometheus exporter | `false` | | +| `metrics.service.annotations` | Prometheus annotations for the Kibana service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | | +| `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` | | +| `elasticsearch.enabled` | Use bundled Elasticsearch | `true` | | +| `elasticsearch.sysctlImage.enabled` | Use sysctl image for bundled Elasticsearch | `true` | | +| `elasticsearch.master.replicas` | Desired number of Elasticsearch master-eligible nodes | `1` | | +| `elasticsearch.coordinating.replicas` | Desired number of Elasticsearch coordinating-only nodes | `1` | | +| `elasticsearch.data.replicas` | Desired number of Elasticsearch data nodes | `1` | | +| `elasticsearch.external.hosts` | Array containing the hostnames for the already existing Elasticsearch instances | `nil` | | +| `elasticsearch.external.port` | Port for the accessing external Elasticsearch instances | `nil` | | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/bitnami/kibana/templates/servicemonitor.yaml b/bitnami/kibana/templates/servicemonitor.yaml new file mode 100644 index 000000000..6aa495223 --- /dev/null +++ b/bitnami/kibana/templates/servicemonitor.yaml @@ -0,0 +1,28 @@ +{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "kibana.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- end }} + labels: {{- include "kibana.labels" . | nindent 4 }} + {{- range $key, $value := .Values.metrics.serviceMonitor.selector }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + selector: + matchLabels: {{- include "kibana.matchLabels" . | nindent 6 }} + endpoints: + - port: http + path: "_prometheus/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/kibana/values-production.yaml b/bitnami/kibana/values-production.yaml index f2a0b8b02..c67095ac0 100644 --- a/bitnami/kibana/values-production.yaml +++ b/bitnami/kibana/values-production.yaml @@ -312,6 +312,30 @@ metrics: prometheus.io/port: "80" prometheus.io/path: "_prometheus/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 + ## Properties for Elasticsearch ## elasticsearch: diff --git a/bitnami/kibana/values.yaml b/bitnami/kibana/values.yaml index 14be880b5..c50e48871 100644 --- a/bitnami/kibana/values.yaml +++ b/bitnami/kibana/values.yaml @@ -312,6 +312,30 @@ metrics: prometheus.io/port: "80" prometheus.io/path: "_prometheus/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 + ## Properties for Elasticsearch ## elasticsearch: