Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/prometheus-nats-exporter]: add prometheus-operator servicemonitor support #21088

Merged
merged 1 commit into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion stable/prometheus-nats-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.6.0"
description: A Helm chart for prometheus-nats-exporter
name: prometheus-nats-exporter
version: 2.3.0
version: 2.4.0
home: https://github.com/nats-io/prometheus-nats-exporter
sources:
- https://github.com/nats-io/prometheus-nats-exporter
Expand Down
52 changes: 28 additions & 24 deletions stable/prometheus-nats-exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,34 @@ The command removes all the Kubernetes components associated with the chart and

The following table lists the configurable parameters of the postgres Exporter chart and their default values.

| Parameter | Description | Default |
| ------------------------------- | --------------------------------------------- | ---------------------------------------------------------- |
| `image` | Image | `synadia/prometheus-nats-exporter` |
| `imageTag` | Image tag | `0.6.0` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `service.type` | Service type | `ClusterIP` |
| `service.port` | The service port | `80` |
| `service.targetPort` | The target port of the container | `7777` |
| `resources` | | `{}` |
| `config.nats.service` | NATS monitoring [service name][svc-name] | `nats-nats-monitoring` |
| `config.nats.namespace` | Namespace in which NATS deployed | `default` |
| `config.nats.port` | NATS monitoring service port | `8222` |
| `config.metrics.varz` | NATS varz metrics | `true` |
| `config.metrics.channelz` | NATS channelz metrics | `true` |
| `config.metrics.connz` | NATS connz metrics | `true` |
| `config.metrics.routez` | NATS routez metrics | `true` |
| `config.metrics.serverz` | NATS serverz metrics | `true` |
| `config.metrics.subz` | NATS subz metrics | `true` |
| `tolerations` | Add tolerations | `[]` |
| `nodeSelector` | node labels for pod assignment | `{}` |
| `affinity` | node/pod affinities | `{}` |
| `annotations` | Deployment annotations | `{}` |
| `extraContainers` | Additional sidecar containers | `""` |
| `extraVolumes` | Additional volumes for use in extraContainers | `""` |
| Parameter | Description | Default |
| --------------------------------- | ------------------------------------------------------- | ------------------------------------------------ |
| `image` | Image | `synadia/prometheus-nats-exporter` |
| `imageTag` | Image tag | `0.6.0` |
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
| `service.type` | Service type | `ClusterIP` |
| `service.port` | The service port | `80` |
| `service.targetPort` | The target port of the container | `7777` |
| `serviceMonitor.enabled` | Set to true if using the Prometheus Operator | `false` |
| `serviceMonitor.interval` | Interval at which metrics should be scraped | `` |
| `serviceMonitor.namespace` | The namespace where the Prometheus Operator is deployed | `` |
| `serviceMonitor.additionalLabels` | Additional labels to add to the ServiceMonitor | `{}` |
| `resources` | | `{}` |
| `config.nats.service` | NATS monitoring [service name][svc-name] | `nats-nats-monitoring` |
| `config.nats.namespace` | Namespace in which NATS deployed | `default` |
| `config.nats.port` | NATS monitoring service port | `8222` |
| `config.metrics.varz` | NATS varz metrics | `true` |
| `config.metrics.channelz` | NATS channelz metrics | `true` |
| `config.metrics.connz` | NATS connz metrics | `true` |
| `config.metrics.routez` | NATS routez metrics | `true` |
| `config.metrics.serverz` | NATS serverz metrics | `true` |
| `config.metrics.subz` | NATS subz metrics | `true` |
| `tolerations` | Add tolerations | `[]` |
| `nodeSelector` | node labels for pod assignment | `{}` |
| `affinity` | node/pod affinities | `{}` |
| `annotations` | Deployment annotations | `{}` |
| `extraContainers` | Additional sidecar containers | `""` |
| `extraVolumes` | Additional volumes for use in extraContainers | `""` |

[svc-name]: https://github.com/helm/charts/blob/master/stable/nats/templates/monitoring-svc.yaml

Expand Down
35 changes: 35 additions & 0 deletions stable/prometheus-nats-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if and .Values.serviceMonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "prometheus-nats-exporter.fullname" . }}
{{- with .Values.serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "prometheus-nats-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "prometheus-nats-exporter.chart" . }}
{{- with .Values.serviceMonitor.additionalLabels }}
{{ toYaml . | indent 4 }}
{{- end }}
spec:
endpoints:
- port: http
honorLabels: true
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "prometheus-nats-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

7 changes: 7 additions & 0 deletions stable/prometheus-nats-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ service:
port: 80
targetPort: 7777

serviceMonitor:
enabled: false
additionalLabels: {}
namespace:
interval:
scrapeTimeout:

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand Down