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

Adding missings args and update chart with latest template #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
114 changes: 57 additions & 57 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions charts/kafka-exporter/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
Expand Down
8 changes: 4 additions & 4 deletions charts/kafka-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v1
appVersion: "1.0"
apiVersion: v2
appVersion: "v1.4.2"
description: A Helm chart for Kubernetes
name: kafka-exporter
version: 1.2.0
home: https://github.com/abhishekjiitr/kafka-exporter-helm
version: 1.2.1
home: https://github.com/danielqsj/kafka_exporter/tree/master/charts/kafka-exporter
maintainers:
- name: abhishekjiitr
email: abhi2254015@gmail.com
63 changes: 47 additions & 16 deletions charts/kafka-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,32 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kafka-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- 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 -}}
{{- 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 -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kafka-exporter.labels" -}}
app: kafka-exporter
helm.sh/chart: {{ include "kafka-exporter.chart" . }}
{{ include "kafka-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kafka-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kafka-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kafka-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
196 changes: 145 additions & 51 deletions charts/kafka-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,161 @@ 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 }}
{{- if .Values.labels -}}
{{ .Values.labels | toYaml | nindent 4 -}}
{{- include "kafka-exporter.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{ toYaml .Values.labels | nindent 4 }}
{{- end }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "kafka-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podLabels -}}
{{ .Values.podLabels | toYaml | nindent 8 -}}
{{- include "kafka-exporter.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "kafka-exporter.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
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 }}
{{- with .Values.kafkaExporter }}
{{- /* Kafka */}}
{{- with .kafka }}
{{- range .servers }}
- --kafka.server={{ . }}
{{- end }}
{{- if .version }}
- --kafka.version={{ .version }}
{{- end }}
{{- if .labels }}
- --kafka.labels={{ .labels }}
{{- end }}
{{- end }}
{{- /* SASL */}}
{{- with .sasl }}
{{- if .enabled }}
- --sasl.enabled
{{- if not .Values.kafkaExporter.sasl.handshake }}
{{- if not .handshake }}
- --sasl.handshake=false
{{- end }}
- --sasl.username={{ .Values.kafkaExporter.sasl.username }}
- --sasl.password={{ .Values.kafkaExporter.sasl.password }}
- --sasl.mechanism={{ .Values.kafkaExporter.sasl.mechanism }}
{{- end }}
{{- if .Values.kafkaExporter.tls.enabled}}
{{- end }}
- --sasl.username={{ .username }}
- --sasl.password={{ .password }}
- --sasl.mechanism={{ .mechanism }}
{{- if .serviceName }}
- --sasl.service-name={{ .serviceName }}
{{- end }}
{{- if .kerberosConfigPath }}
- --sasl.kerberos-config-path={{ .kerberosConfigPath }}
{{- end }}
{{- if .realm }}
- --sasl.realm={{ .realm }}
{{- end }}
{{- if .keytabPath }}
- --sasl.keytab-path={{ .keytabPath }}
{{- end }}
{{- if .kerberosAuthType }}
- --sasl.kerberos-auth-type={{ .kerberosAuthType }}
{{- end }}
{{- end }}
{{- end }}
{{- /* TLS */}}
{{- with .tls }}
{{- if .enabled }}
- --tls.enabled
{{- if .Values.kafkaExporter.tls.insecureSkipTlsVerify}}
{{- if .insecureSkipTlsVerify }}
- --tls.insecure-skip-tls-verify
{{- else }}
{{- else }}
{{- if .serverName }}
- --tls.server-name={{ .serverName }}
{{- end }}
- --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 }}
{{- end }}
{{- if .Values.kafkaExporter.log }}
- --verbosity={{ .Values.kafkaExporter.log.verbosity }}
{{- end }}
{{- if .Values.kafkaExporter.log.enableSarama }}
{{- end }}
{{- end }}
{{- end }}
{{- /* Filters */}}
{{- with .filter }}
{{- if .topic }}
- --topic.filter={{ .topic }}
{{- end }}
{{- if .group }}
- --group.filter={{ .group }}
{{- end }}
{{- end }}
{{- /* Web */}}
{{- with .web }}
{{- if .listenAddress }}
- --listen-address={{ .listenAddress }}
{{- end }}
{{- if .telemetryPath }}
- --telemetry-path={{ .telemetryPath }}
{{- end }}
{{- end }}
{{- /* ZooKeeper */}}
{{- with .zookeeper }}
{{- if .consumelag }}
- --use.consumelag.zookeeper
{{- end }}
{{- range .servers }}
- --zookeeper.server={{ . }}
{{- end }}
{{- end }}
{{- /* Refresh */}}
{{- with .refresh }}
{{- if .metadata }}
- --refresh.metadata={{ .metadata }}
{{- end }}
{{- end }}
{{- /* Offset */}}
{{- with .offset }}
{{- if not .showAll }}
- --offset.show-all
{{- end }}
{{- end }}
{{- /* Concurrent */}}
{{- with .concurrent }}
{{- if .enable }}
- --concurrent.enable
{{- end }}
{{- end }}
{{- /* Topic */}}
{{- with .topic }}
{{- if .workers }}
- --topic.workers={{ .workers }}
{{- end }}
{{- end }}
{{- /* Log */}}
{{- with .log }}
{{- if .verbosity }}
- --verbosity={{ .verbosity }}
{{- end }}
{{- if .enableSarama }}
- --log.enable-sarama
{{- end }}
{{- end }}
{{- end }}
ports:
- name: metrics
Expand All @@ -87,31 +183,29 @@ spec:
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 9

resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if and .Values.kafkaExporter.tls.enabled (not .Values.kafkaExporter.tls.insecureSkipTlsVerify) }}
volumeMounts:
- name: tls-certs
mountPath: "/etc/tls-certs/"
readOnly: true
- 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 }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if and .Values.kafkaExporter.tls.enabled (not .Values.kafkaExporter.tls.insecureSkipTlsVerify) }}
volumes:
- name: tls-certs
secret:
secretName: {{ include "kafka-exporter.fullname" . }}
- name: tls-certs
secret:
secretName: {{ include "kafka-exporter.fullname" . }}
{{- end }}
9 changes: 3 additions & 6 deletions charts/kafka-exporter/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ 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 }}
{{- if .Values.labels -}}
{{- .Values.labels | toYaml | nindent 4 }}
{{- include "kafka-exporter.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{ toYaml .Values.labels | nindent 4 }}
{{- end }}
data:
ca-file: {{ .Values.kafkaExporter.tls.caFile | b64enc }}
Expand Down
12 changes: 4 additions & 8 deletions charts/kafka-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ 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 }}
{{- if .Values.labels -}}
{{ .Values.labels | toYaml | nindent 4 -}}
{{- include "kafka-exporter.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{ toYaml .Values.labels | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
Expand All @@ -18,5 +15,4 @@ spec:
protocol: TCP
name: metrics
selector:
app.kubernetes.io/name: {{ include "kafka-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- include "kafka-exporter.selectorLabels" . | nindent 4 }}
15 changes: 15 additions & 0 deletions charts/kafka-exporter/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "kafka-exporter.serviceAccountName" . }}
labels:
{{- include "kafka-exporter.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{ toYaml .Values.labels | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading