Added prometheus-rabbitmq-exporter helm chart (#5311)

* Added prometheus-rabbitmq-exporter helm chart

* Deleted empty line

* Moved from incubator to stable

* Updated diferences with helm 2.8+

* Corrected indent, incubator reference on README and defaulted annotations to {}
This commit is contained in:
Juanchimienti
2018-05-16 06:10:31 -07:00
committed by k8s-ci-robot
parent af9728f415
commit e275f6f9dc
8 changed files with 285 additions and 0 deletions
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
@@ -0,0 +1,11 @@
apiVersion: v1
description: Rabbitmq metrics exporter for prometheus
name: prometheus-rabbitmq-exporter
version: 0.1.1
appVersion: v0.28.0
home: https://github.com/kbudde/rabbitmq_exporter
sources:
- https://github.com/kbudde/rabbitmq_exporter
mantainers:
- name: juanchimienti
email: juan.chimienti@gmail.com
@@ -0,0 +1,76 @@
# prometheus-rabbitmq-exporter
[rabbitmq_exporter](https://github.com/kbudde/rabbitmq_exporter) is a Prometheus exporter for rabbitmq metrics.
## TL;DR;
```bash
$ helm install stable/prometheus-rabbitmq-exporter
```
## Introduction
This chart bootstraps a [rabbitmq_exporter](https://github.com/kbudde/rabbitmq_exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Prerequisites
- Kubernetes 1.8+ with Beta APIs enabled
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/prometheus-rabbitmq-exporter
```
The command deploys prometheus-rabbitmq-exporter on the Kubernetes cluster in the default configuration.
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```bash
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following tables lists the configurable parameters and their default values.
| Parameter | Description | Default |
| ------------------------ | ---------------------------------------------------------------------- | ------------------------- |
| `replicaCount` | desired number of prometheus-rabbitmq-exporter pods | `1` |
| `image.repository` | prometheus-rabbitmq-exporter image repository | `kbudde/rabbitmq-exporter`|
| `image.tag` | prometheus-rabbitmq-exporter image tag | `v0.28.0` |
| `image.pullPolicy` | image pull policy | `IfNotPresent` |
| `service.type` | desired service type | `ClusterIP` |
| `service.internalport` | service listening port | `9121` |
| `service.externalPort` | public service port | `9419` |
| `resources` | cpu/memory resource requests/limits | {} |
| `loglevel` | exporter log level | {} |
| `rabbitmq.url` | rabbitm managment url | `http://myrabbit:15672` |
| `rabbitmq.user` | rabbitm user login | `guest` |
| `rabbitmq.password` | rabbitm password login | `guest` |
| `rabbitmq.capabilities` | comma-separated list of capabilities supported by the RabbitMQ server | `bert,no_sort` |
| `rabbitmq.include_queues`| regex queue filter. just matching names are exported | `.*` |
| `rabbitmq.skip_queues` | regex, matching queue names are not exported | `.*` |
| `annotation` | pod annotations for easier discovery | {} |
For more information please refer to the [rabbitmq_exporter](https://github.com/kbudde/rabbitmq_exporter) documentation.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set "rabbitmq.url=http://myrabbit:15672" \
stable/prometheus-rabbitmq-exporter
```
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install --name my-release -f values.yaml stable/prometheus-rabbitmq-exporter
```
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "prometheus-rabbitmq-exporter.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "prometheus-rabbitmq-exporter.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "prometheus-rabbitmq-exporter.fullname" . }} )
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "prometheus-rabbitmq-exporter.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
echo "Visit http://127.0.0.1:8080 to use your application"
{{- end }}
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheus-rabbitmq-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "prometheus-rabbitmq-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "prometheus-rabbitmq-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,68 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "prometheus-rabbitmq-exporter.fullname" . }}
labels:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
chart: {{ template "prometheus-rabbitmq-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
release: {{ .Release.Name }}
annotations:
{{ toYaml .Values.annotations | indent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: RABBIT_URL
value: "{{ .Values.rabbitmq.url }}"
- name: RABBIT_USER
value: "{{ .Values.rabbitmq.user }}"
- name: RABBIT_PASSWORD
value: "{{ .Values.rabbitmq.password }}"
- name: PUBLISH_PORT
value: "{{ .Values.service.internalPort }}"
- name: LOG_LEVEL
value: "{{ .Values.loglevel }}"
- name: RABBIT_CAPABILITIES
value: "{{ .Values.rabbitmq.capabilities }}"
- name: INCLUDE_QUEUES
value: "{{ .Values.rabbitmq.include_queues }}"
- name: SKIP_QUEUES
value: "{{ .Values.rabbitmq.skip_queues }}"
ports:
- containerPort: {{ .Values.service.internalPort }}
livenessProbe:
httpGet:
path: /
port: {{ .Values.service.internalPort }}
readinessProbe:
httpGet:
path: /
port: {{ .Values.service.internalPort }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-rabbitmq-exporter.fullname" . }}
labels:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
chart: {{ template "prometheus-rabbitmq-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
name: rabbitmq-exporter
selector:
app: {{ template "prometheus-rabbitmq-exporter.name" . }}
release: {{ .Release.Name }}
@@ -0,0 +1,43 @@
# Default values for prometheus-rabbitmq-exporter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: kbudde/rabbitmq-exporter
tag: v0.28.0
pullPolicy: IfNotPresent
service:
type: ClusterIP
externalPort: 9419
internalPort: 9419
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
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
loglevel: info
rabbitmq:
url: http://myrabbit:15672
user: guest
password: guest
capabilities: bert,no_sort
include_queues: ".*"
skip_queues: "^$"
annotation: {}
# prometheus.io/scrape: "true"
# prometheus.io/path: "/metrics"
# prometheus.io/port: 9419