Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Helm Chart #135

Merged
merged 1 commit into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions charts/kafka-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
.vscode/
9 changes: 9 additions & 0 deletions charts/kafka-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: kafka-exporter
version: 1.0.0
home: https://github.com/abhishekjiitr/kafka-exporter-helm
maintainers:
- name: abhishekjiitr
email: abhi2254015@gmail.com
5 changes: 5 additions & 0 deletions charts/kafka-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1.To see the metrics
{{- if contains "ClusterIP" .Values.service.type }}
kubectl port-forward svc/{{ include "kafka-exporter.fullname" . }} {{ .Values.service.port }}
echo "Visit http://127.0.0.1:{{ .Values.service.port }} to use your application"
{{- end }}
32 changes: 32 additions & 0 deletions charts/kafka-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kafka-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 "kafka-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 "kafka-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
85 changes: 85 additions & 0 deletions charts/kafka-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kafka-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
helm.sh/chart: {{ include "kafka-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 "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
{{- if .Values.kafkaExporter}}
{{- range .Values.kafkaExporter.kafka.servers }}
- "--kafka.server={{ . }}"
{{- end }}
{{- if .Values.kafkaExporter.kafka.version }}
- --kafka.version={{ .Values.kafkaExporter.kafka.version }}
{{- end }}
{{- end}}
{{- if .Values.kafkaExporter.sasl.enabled }}
- --sasl.enabled
{{- if not .Values.kafkaExporter.sasl.handshake }}
- --sasl.handshake=false
{{- end }}
- --sasl.username={{ .Values.kafkaExporter.sasl.username }}
- --sasl.password={{ .Values.kafkaExporter.sasl.password }}
{{- end }}
{{- if .Values.kafkaExporter.tls.enabled}}
- --tls.enabled
- --tls.ca-file=/etc/tls-certs/ca-file
- --tls.cert-file=/etc/tls-certs/cert-file
- --tls.key-file=/etc/tls-certs/key-file
{{- end }}
{{- if .Values.kafkaExporter.log }}
- --log.level={{ .Values.kafkaExporter.log.level }}
{{- if .Values.kafkaExporter.log.enableSarama }}
- --log.enable-sarama
{{- end }}
{{- end }}
ports:
- name: metrics
containerPort: 9308
protocol: TCP
{{- if .Values.kafkaExporter.tls.enabled }}
volumeMounts:
- name: tls-certs
mountPath: "/etc/tls-certs/"
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}

nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.kafkaExporter.tls.enabled }}
volumes:
- name: tls-certs
secret:
secretName: {{ include "kafka-exporter.fullname" . }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/kafka-exporter/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.kafkaExporter.tls.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "kafka-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
helm.sh/chart: {{ include "kafka-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
ca-file: {{ .Values.kafkaExporter.tls.caFile | b64enc }}
cert-file: {{ .Values.kafkaExporter.tls.certFile | b64enc }}
key-file: {{ .Values.kafkaExporter.tls.keyFile | b64enc }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/kafka-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "kafka-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
helm.sh/chart: {{ include "kafka-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: metrics
protocol: TCP
name: metrics
selector:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
32 changes: 32 additions & 0 deletions charts/kafka-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.prometheus.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "kafka-exporter.fullname" . }}
{{- if .Values.prometheus.serviceMonitor.namespace }}
namespace: {{ .Values.prometheus.serviceMonitor.namespace }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
helm.sh/chart: {{ include "kafka-exporter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.prometheus.serviceMonitor.additionalLabels }}
{{ toYaml .Values.prometheus.serviceMonitor.additionalLabels | indent 4 -}}
{{- end }}
spec:
jobLabel: jobLabel
selector:
matchLabels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
helm.sh/chart: {{ include "kafka-exporter.chart" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: metrics
interval: {{ .Values.prometheus.serviceMonitor.interval }}
{{- if .Values.prometheus.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.prometheus.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}
67 changes: 67 additions & 0 deletions charts/kafka-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Default values for kafka-exporter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: danielqsj/kafka-exporter
tag: latest
pullPolicy: IfNotPresent

nameOverride: ""
fullnameOverride: ""

service:
type: ClusterIP
port: 9308

kafkaExporter:
kafka:
servers: []
# - kafka:9092
# version: "1.0.0"

sasl:
enabled: false
handshake: true
username: ""
password: ""

tls:
enabled: false
insecure-skip-tls-verify: false
caFile: ""
certFile: ""
keyFile: ""

log:
level: info
enableSarama: false

prometheus:
serviceMonitor:
enabled: true
namespace: monitoring
interval: "30s"
additionalLabels:
app: kafka-exporter


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: {}