Skip to content

Commit

Permalink
adding chart for prometheus-couchdb-exporters (helm#7494)
Browse files Browse the repository at this point in the history
* adding chart for prometheus-couchdb-exporters

Signed-off-by: gkarthiks <[email protected]>

* Upgrading the deployment api version from vibeta2 to v1

Signed-off-by: gkarthiks <[email protected]>

* adding rbac

Signed-off-by: gkarthiks <[email protected]>
  • Loading branch information
gkarthiks authored and k8s-ci-robot committed Oct 4, 2018
1 parent df459ad commit b517f4a
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/prometheus-couchdb-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions stable/prometheus-couchdb-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart to export the metrics from couchdb in Prometheus format.
name: prometheus-couchdb-exporter
home: https://github.com/gesellix/couchdb-prometheus-exporter
version: 0.1.0
keywords:
- couchdb-exporter
sources:
- https://github.com/gesellix/couchdb-prometheus-exporter
maintainers:
- name: gkarthiks
email: [email protected]
engine: gotpl
78 changes: 78 additions & 0 deletions stable/prometheus-couchdb-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# prometheus-couchdb-exporter

[couchdb-prometheus-exporter](https://github.com/gesellix/couchdb-prometheus-exporter) is a Prometheus exporter for CouchDB metrics.

## TL;DR;

```bash
$ helm install stable/prometheus-couchdb-exporter
```

## Introduction

This chart bootstraps a [couchdb-exporter](https://github.com/gesellix/couchdb-prometheus-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-couchdb-exporter
```

The command deploys prometheus-couchdb-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 table lists the configurable parameters and their default values.

| Parameter | Description | Default |
| ---------------------- | --------------------------------------------------- | --------------------------------------- |
| `replicaCount` | desired number of prometheus-couchdb-exporter pods | `1` |
| `image.repository` | prometheus-couchdb-exporter image repository | `gesellix/couchdb-prometheus-exporter` |
| `image.tag` | prometheus-couchdb-exporter image tag | `16` |
| `image.pullPolicy` | image pull policy | `IfNotPresent` |
| `service.type` | desired service type | `ClusterIP` |
| `service.port` | service external port | `9984` |
| `ingress.enabled` | enable ingress controller resource | `false` |
| `ingress.annotations` | annotations for the host's ingress records | `false` |
| `ingress.path` | path for the ingress route | `/` |
| `ingress.hosts` | list of host address for ingress creation | |
| `ingress.tls` | utilize TLS backend in ingress | |
| `resources` | cpu/memory resource requests/limits | {} |
| `nodeSelector` | node labels for pod assignment | {} |
| `tolerations` | tolerations for pod assignment | {} |
| `affinity` | affinity settings for proxy pod assignments | {} |
| `couchdb.uri` | address of the couchdb | `http://couchdb.default.svc:5984` |
| `couchdb.databases` | comma separated databases to monitor | `_all_dbs` |


For more information please refer to the [couchdb-prometheus-exporter]https://github.com/gesellix/couchdb-prometheus-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 "couchdb.uri=http://mycouchdb:5984" \
stable/prometheus-couchdb-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-couchdb-exporter
```
19 changes: 19 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "prometheus-couchdb-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-couchdb-exporter.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "prometheus-couchdb-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "prometheus-couchdb-exporter.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
43 changes: 43 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheus-couchdb-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-couchdb-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-couchdb-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "prometheus-couchdb-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "prometheus-couchdb-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
58 changes: 58 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ template "prometheus-couchdb-exporter.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/couchdb-prometheus-exporter",
"-telemetry.address=0.0.0.0:9984",
"-logtostderr",
"-couchdb.uri={{ .Values.couchdb.uri }}",
"-databases={{ .Values.couchdb.databases }}"]
ports:
- name: http
containerPort: 9984
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 60
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 60
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 }}
38 changes: 38 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "prometheus-couchdb-exporter.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if .Values.rbac.pspEnabled }}
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
privileged: false
allowPrivilegeEscalation: false
requiredDropCapabilities:
- ALL
volumes:
- 'configMap'
- 'emptyDir'
- 'projected'
- 'secret'
- 'downwardAPI'
hostNetwork: false
hostIPC: false
hostPID: false
runAsUser:
rule: 'RunAsAny'
seLinux:
rule: 'RunAsAny'
supplementalGroups:
rule: 'RunAsAny'
fsGroup:
rule: 'RunAsAny'
readOnlyRootFilesystem: false
{{- end }}
18 changes: 18 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.rbac.pspEnabled }}
rules:
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames: [{{ template "prometheus-couchdb-exporter.fullname" . }}]
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "prometheus-couchdb-exporter.serviceAccountName" . }}
{{- end -}}
19 changes: 19 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-couchdb-exporter.fullname" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "prometheus-couchdb-exporter.name" . }}
release: {{ .Release.Name }}
11 changes: 11 additions & 0 deletions stable/prometheus-couchdb-exporter/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-couchdb-exporter.serviceAccountName" . }}
labels:
app: {{ template "prometheus-couchdb-exporter.name" . }}
chart: {{ template "prometheus-couchdb-exporter.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- end -}}
Loading

0 comments on commit b517f4a

Please sign in to comment.