Skip to content

Commit

Permalink
Push helm kafdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
lmammucari committed Jul 15, 2024
1 parent 4b6942b commit badc2ca
Show file tree
Hide file tree
Showing 8 changed files with 353 additions and 0 deletions.
21 changes: 21 additions & 0 deletions charts/kafdrop/.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
5 changes: 5 additions & 0 deletions charts/kafdrop/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "3.x"
description: A Helm chart for Kafdrop
name: kafdrop
version: 0.1.0
19 changes: 19 additions & 0 deletions charts/kafdrop/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 {{ include "chart.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 {{ include "chart.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart.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.kubernetes.io/name={{ include "chart.name" . }},app.kubernetes.io/instance={{ .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 }}
52 changes: 52 additions & 0 deletions charts/kafdrop/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "chart.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 "chart.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 "chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "capabilities.kubeVersion" }}
{{- if .Values.global.kubeVersion -}}
{{- .Values.global.kubeVersion -}}
{{- else -}}
{{- .Capabilities.KubeVersion -}}
{{- end -}}
{{- end -}}

{{- define "ingress.apiVersion" }}
{{- if .Values.ingress.apiVersion -}}
{{- .Values.ingress.apiVersion -}}
{{- else if semverCompare "<1.14-0" (include "capabilities.kubeVersion" .) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "capabilities.kubeVersion" .) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end }}
{{- end }}
112 changes: 112 additions & 0 deletions charts/kafdrop/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "chart.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
helm.sh/chart: {{ include "chart.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 "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
annotations:
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.hostAliases }}
hostAliases:
{{ toYaml .Values.hostAliases | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: KAFKA_BROKERCONNECT
value: "{{ .Values.kafka.brokerConnect }}"
- name: KAFKA_PROPERTIES
value: "{{ .Values.kafka.properties }}"
- name: KAFKA_TRUSTSTORE
value: "{{ .Values.kafka.truststore }}"
- name: KAFKA_KEYSTORE
value: "{{ .Values.kafka.keystore }}"
- name: JVM_OPTS
value: "{{ .Values.jvm.opts }}"
- name: JMX_PORT
value: "{{ .Values.jmx.port }}"
- name: HOST
value: "{{ .Values.host }}"
- name: SERVER_SERVLET_CONTEXTPATH
value: "{{ .Values.server.servlet.contextPath | trimSuffix "/" }}"
- name: KAFKA_PROPERTIES_FILE
value: "{{ .Values.kafka.propertiesFile }}"
- name: KAFKA_TRUSTSTORE_FILE
value: "{{ .Values.kafka.truststoreFile }}"
- name: KAFKA_KEYSTORE_FILE
value: "{{ .Values.kafka.keystoreFile }}"
- name: SERVER_PORT
value: "{{ .Values.server.port }}"
- name: CMD_ARGS
{{- if .Values.mountProtoDesc.enabled }}
value: "--message.format=PROTOBUF --protobufdesc.directory=/protodesc/ {{ .Values.cmdArgs }}"
{{- else }}
value: "{{ .Values.cmdArgs }}"
{{- end }}

ports:
- name: http
containerPort: 9000
protocol: TCP
livenessProbe:
httpGet:
path: "{{ .Values.server.servlet.contextPath | trimSuffix "/" }}/actuator/health"
port: http
initialDelaySeconds: 180
periodSeconds: 30
timeoutSeconds: 10
readinessProbe:
httpGet:
path: "{{ .Values.server.servlet.contextPath | trimSuffix "/" }}/actuator/health"
port: http
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 10
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 }}
{{- if .Values.mountProtoDesc.enabled }}
volumeMounts:
- mountPath: /protodesc/
name: proto-desc
volumes:
- name: proto-desc
hostPath:
path: {{ .Values.mountProtoDesc.hostPath }}
type: Directory
{{- end }}


43 changes: 43 additions & 0 deletions charts/kafdrop/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "chart.fullname" . -}}
{{- $ingress := .Values.ingress -}}
apiVersion: {{ include "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
helm.sh/chart: {{ include "chart.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with $ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- with (pick $ingress "ingressClassName" "tls") }}
{{- . | toYaml | nindent 2 }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
{{- if eq "networking.k8s.io/v1" (include "ingress.apiVersion" $) }}
- path: {{ $ingress.path }}
pathType: {{ $ingress.pathType | default "ImplementationSpecific" }}
backend:
service:
name: {{ $fullName }}
port:
name: http
{{- else }}
- {{- with (pick $ingress "path" "pathType") }}
{{- . | toYaml | nindent 12 }}
{{- end }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
26 changes: 26 additions & 0 deletions charts/kafdrop/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
annotations:
{{ tpl (toYaml .Values.service.annotations) . | indent 4 }}
{{- end }}
name: {{ include "chart.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "chart.name" . }}
helm.sh/chart: {{ include "chart.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: http
protocol: TCP
name: http
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.service.nodePort}}
{{ end }}
selector:
app.kubernetes.io/name: {{ include "chart.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
75 changes: 75 additions & 0 deletions charts/kafdrop/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
replicaCount: 1

image:
repository: obsidiandynamics/kafdrop
tag: latest
pullPolicy: Always

kafka:
brokerConnect: localhost:9092
properties: ""
truststore: ""
keystore: ""
propertiesFile: "kafka.properties"
truststoreFile: "kafka.truststore.jks"
keystoreFile: "kafka.keystore.jks"

host:

jvm:
opts: ""
jmx:
port: 8686

nameOverride: ""
fullnameOverride: ""

cmdArgs: ""

global:
kubeVersion: ~

server:
port: 9000
servlet:
contextPath: /

service:
annotations: {}
type: NodePort
port: 9000
nodePort: 30900

ingress:
enabled: false
annotations: {}
apiVersion: ~
#ingressClassName: ~
path: /
#pathType: ~
hosts: []
tls: []

resources:
# limits:
# cpu: 100m
# memory: 128Mi
requests:
cpu: 1m
memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

podAnnotations: {}

podLabels: {}

hostAliases: []

mountProtoDesc:
enabled: false
hostPath:

0 comments on commit badc2ca

Please sign in to comment.