diff --git a/stable/prometheus-couchdb-exporter/.helmignore b/stable/prometheus-couchdb-exporter/.helmignore new file mode 100644 index 000000000000..f0c131944441 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/.helmignore @@ -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 diff --git a/stable/prometheus-couchdb-exporter/Chart.yaml b/stable/prometheus-couchdb-exporter/Chart.yaml new file mode 100644 index 000000000000..1837b9b8d7d0 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/Chart.yaml @@ -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: github.gkarthiks@gmail.com +engine: gotpl diff --git a/stable/prometheus-couchdb-exporter/README.md b/stable/prometheus-couchdb-exporter/README.md new file mode 100644 index 000000000000..1755ae134d51 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/README.md @@ -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 +``` diff --git a/stable/prometheus-couchdb-exporter/templates/NOTES.txt b/stable/prometheus-couchdb-exporter/templates/NOTES.txt new file mode 100644 index 000000000000..fb839a472e04 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/NOTES.txt @@ -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 }} diff --git a/stable/prometheus-couchdb-exporter/templates/_helpers.tpl b/stable/prometheus-couchdb-exporter/templates/_helpers.tpl new file mode 100644 index 000000000000..e37e8ebc533c --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/_helpers.tpl @@ -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 -}} \ No newline at end of file diff --git a/stable/prometheus-couchdb-exporter/templates/deployment.yaml b/stable/prometheus-couchdb-exporter/templates/deployment.yaml new file mode 100644 index 000000000000..2981f1498eb4 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/deployment.yaml @@ -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 }} diff --git a/stable/prometheus-couchdb-exporter/templates/ingress.yaml b/stable/prometheus-couchdb-exporter/templates/ingress.yaml new file mode 100644 index 000000000000..3d3715653b7e --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/ingress.yaml @@ -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 }} diff --git a/stable/prometheus-couchdb-exporter/templates/podsecuritypolicy.yaml b/stable/prometheus-couchdb-exporter/templates/podsecuritypolicy.yaml new file mode 100644 index 000000000000..d2da180a436e --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/podsecuritypolicy.yaml @@ -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 }} \ No newline at end of file diff --git a/stable/prometheus-couchdb-exporter/templates/role.yaml b/stable/prometheus-couchdb-exporter/templates/role.yaml new file mode 100644 index 000000000000..4a22e40bf2f2 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/role.yaml @@ -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 }} \ No newline at end of file diff --git a/stable/prometheus-couchdb-exporter/templates/rolebinding.yaml b/stable/prometheus-couchdb-exporter/templates/rolebinding.yaml new file mode 100644 index 000000000000..bd80e7224b16 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/rolebinding.yaml @@ -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 -}} \ No newline at end of file diff --git a/stable/prometheus-couchdb-exporter/templates/service.yaml b/stable/prometheus-couchdb-exporter/templates/service.yaml new file mode 100644 index 000000000000..c3e9e2a091aa --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/service.yaml @@ -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 }} diff --git a/stable/prometheus-couchdb-exporter/templates/serviceaccount.yaml b/stable/prometheus-couchdb-exporter/templates/serviceaccount.yaml new file mode 100644 index 000000000000..3e8018b58840 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/templates/serviceaccount.yaml @@ -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 -}} \ No newline at end of file diff --git a/stable/prometheus-couchdb-exporter/values.yaml b/stable/prometheus-couchdb-exporter/values.yaml new file mode 100644 index 000000000000..773a7ddf71b7 --- /dev/null +++ b/stable/prometheus-couchdb-exporter/values.yaml @@ -0,0 +1,69 @@ +# Default values for prometheus-couchdb-exporter. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +rbac: + # Specifies whether RBAC resources should be created + create: true + # Specifies whether a PodSecurityPolicy should be created + pspEnabled: true +serviceAccount: + # Specifies whether a ServiceAccount should be created + create: true + # The name of the ServiceAccount to use. + # If not set and create is true, a name is generated using the fullname template + name: + +replicaCount: 1 + +image: + repository: gesellix/couchdb-prometheus-exporter + tag: 16 + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 9984 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + # - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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: {} + +## CouchDB exporter configuratons +couchdb: + ## URI ofthe couchdb instance + uri: http://couchdb.default.svc:5984 + ## Specify the list of databases to get the disk usage stats as comma seperates like "db-1,db-2" + ## or to get stats for every database, please use "_all_dbs" + databases: _all_dbs + ## CouchDB username + # username: + ## CouchDB Password + # password: