Adding prometheus-to-sd chart (#2363)

* Adding prometheus-to-sd chart

* Updated description

* #1785 namespace defined templates with chart name

* updating Chart.yaml

* aligned the parameters table

* do not limit resources by default and allow the user adjust as needed

* Making the linter happy

* use {{ .Release.Name }} for resource naming

* Revert "use {{ .Release.Name }} for resource naming"

This reverts commit 518ad934b66ec2f39218615539d8fb41bb8e23d5.

* fullname to match .Release.Name

* updated apiVersion for deployment resource

* github username

* Adding nodeSelector default value and docs
This commit is contained in:
acondrat
2017-11-24 11:20:17 +01:00
committed by Reinhard Nägele
parent a6525a2c48
commit 4e33fc6c26
7 changed files with 162 additions and 0 deletions
+21
View File
@@ -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
+12
View File
@@ -0,0 +1,12 @@
apiVersion: v1
appVersion: 0.2.2
description: Scrape metrics stored in prometheus format and push them to the Stackdriver
home: https://github.com/GoogleCloudPlatform/k8s-stackdriver/tree/master/prometheus-to-sd
keywords:
- prometheus
- stackdriver
maintainers:
- name: acondrat
email: arcadie.condrat@gmail.com
name: prometheus-to-sd
version: 0.1.0
+67
View File
@@ -0,0 +1,67 @@
# prometheus-to-sd
[prometheus-to-sd](https://github.com/GoogleCloudPlatform/k8s-stackdriver/tree/master/prometheus-to-sd) is a simple component that can scrape metrics stored in prometheus text format from one or multiple components and push them to the Stackdriver
## TL;DR;
```bash
$ helm install stable/prometheus-to-sd
```
## Prerequisites
- a service exposing metrics in prometheus format
- k8s cluster should run on GCE or GKE
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/prometheus-to-sd
```
The command deploys prometheus-to-sd 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 |
| ------------------ | ----------------------------------------------------------------------------------------- | ------------------------------------------- |
| `image.repository` | prometheus-to-sd image repository | `gcr.io/google-containers/prometheus-to-sd` |
| `image.tag` | prometheus-to-sd image tag | `v0.2.2` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `port` | Profiler port | `6060` |
| `metricSources` | Sources for metrics in the next format: component-name:http://host:port?whitelisted=a,b,c | `{}` |
| `nodeSelector` | node labels for pod assignment | `{}` |
For more information please refer to the [prometheus-to-sd](https://github.com/GoogleCloudPlatform/k8s-stackdriver/tree/master/prometheus-to-sd) documentation.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set "metricsSources.kube-state-metrics=http://kube-state-metrics:8080" \
stable/prometheus-to-sd
```
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-to-sd
```
Multiple metrics sources can be defined.
@@ -0,0 +1,2 @@
Check prometheus-to-sd pod
$ kubectl get pods --namespace={{ .Release.Namespace }}
@@ -0,0 +1,15 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheus-to-sd.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).
*/}}
{{- define "prometheus-to-sd.fullname" -}}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,36 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "prometheus-to-sd.fullname" . }}
labels:
app: {{ template "prometheus-to-sd.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "prometheus-to-sd.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: profiler
containerPort: {{ .Values.port }}
command:
- /monitor
- --stackdriver-prefix=custom.googleapis.com
{{- range $key, $value := .Values.metricsSources }}
- --source={{ $key }}:{{ $value }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
+9
View File
@@ -0,0 +1,9 @@
replicaCount: 1
image:
repository: gcr.io/google-containers/prometheus-to-sd
tag: v0.2.2
pullPolicy: IfNotPresent
resources: {}
port: 6060
metricsSources: {}
nodeSelector: {}