Skip to content

Commit

Permalink
add initial chart for helm-exporter (helm#9764)
Browse files Browse the repository at this point in the history
Signed-off-by: Shane Starcher <[email protected]>
  • Loading branch information
sstarcher authored and k8s-ci-robot committed Dec 14, 2018
1 parent 7c16cdd commit f4b4ea2
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/helm-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
11 changes: 11 additions & 0 deletions stable/helm-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
appVersion: "0.1.0"
description: Exports helm release stats to prometheus
name: helm-exporter
version: 0.1.0
home: https://github.com/sstarcher/helm-exporter
sources:
- https://github.com/sstarcher/helm-exporter
maintainers:
- name: sstarcher
email: [email protected]
4 changes: 4 additions & 0 deletions stable/helm-exporter/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- sstarcher
reviewers:
- sstarcher
59 changes: 59 additions & 0 deletions stable/helm-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# helm-exporter

Installs [helm-exporter](https://github.com/sstarcher/helm-exporter) to export helm stats to prometheus.

## TL;DR;

```console
$ helm install stable/helm-exporter
```

## Introduction

This chart bootstraps a [helm-exporter](https://github.com/sstarcher/helm-exporter) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install stable/helm-exporter --name my-release
```

The command deploys helm-exporter on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ 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 of the helm-exporter chart and their default values.

Parameter | Description | Default
--- | --- | ---
`affinity` | affinity configuration for pod assignment | `{}`
`image.repository` | Image | `sstarcher/helm-exporter`
`image.tag` | Image tag | `0.1.0`
`image.pullPolicy` | Image pull policy | `IfNotPresent`
`nodeSelector` | node labels for pod assignment | `{}`
`resources` | pod resource requests & limits | `{}`
`tolerations` | List of node taints to tolerate (requires Kubernetes 1.6+) | `[]`

```console
$ helm install stable/helm-exporter --name my-release
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```console
$ helm install stable/helm-exporter --name my-release -f values.yaml
```

> **Tip**: You can use the default [values.yaml](values.yaml)
4 changes: 4 additions & 0 deletions stable/helm-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helm-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:9100 to use your application"
kubectl port-forward $POD_NAME 9100
43 changes: 43 additions & 0 deletions stable/helm-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 "helm-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 "helm-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 "helm-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "helm-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "helm-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
56 changes: 56 additions & 0 deletions stable/helm-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "helm-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
helm.sh/chart: {{ include "helm-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 9100
protocol: TCP
livenessProbe:
httpGet:
path: /metrics
port: http
readinessProbe:
httpGet:
path: /metrics
port: http
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.rbac.create }}
serviceAccountName: {{ template "helm-exporter.fullname" . }}
{{- else }}
serviceAccountName: "{{ .Values.rbac.serviceAccountName }}"
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
22 changes: 22 additions & 0 deletions stable/helm-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "helm-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
helm.sh/chart: {{ include "helm-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
prometheus.io/scrape: "true"
spec:
type: ClusterIP
clusterIP: None
ports:
- port: 9100
targetPort: http
protocol: TCP
name: metrics
selector:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
11 changes: 11 additions & 0 deletions stable/helm-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:
labels:
app.kubernetes.io/name: {{ include "helm-exporter.name" . }}
helm.sh/chart: {{ include "helm-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ template "helm-exporter.serviceAccountName" . }}
{{- end }}
28 changes: 28 additions & 0 deletions stable/helm-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
replicaCount: 1

image:
repository: sstarcher/helm-exporter
tag: 0.1.0
pullPolicy: Always

nameOverride: ""
fullnameOverride: ""

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

rbac:
# Specifies whether RBAC resources should be created
create: 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:

0 comments on commit f4b4ea2

Please sign in to comment.