Skip to content

Commit

Permalink
add kafdrop chart (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
florentinadolf authored Apr 12, 2021
1 parent ed0d5a7 commit 700199d
Show file tree
Hide file tree
Showing 9 changed files with 1,645 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/kafdrop/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
5 changes: 5 additions & 0 deletions charts/kafdrop/.kube-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
checks:
exclude:
- (( prepend ))
- "run-as-non-root"
25 changes: 25 additions & 0 deletions charts/kafdrop/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: kafdrop
description: Unofficial Helm Chart for Kafdrop
version: 0.2.3
appVersion: 3.27.0
type: application
home: https://github.com/obsidiandynamics/kafdrop
icon: https://raw.githubusercontent.com/wiki/obsidiandynamics/kafdrop/images/kafdrop-logo.png
keywords:
- Apache Kafka
- Kafdrop
- Browsing
maintainers:
- name: SRE
email: [email protected]
dependencies:
- name: manifests
version: "~0.5.0"
repository: https://bedag.github.io/helm-charts/
annotations:
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/prerelease: "false"
artifacthub.io/images: |
- name: kafdrop
image: obsidiandynamics/kafdrop:3.27.0
202 changes: 202 additions & 0 deletions charts/kafdrop/README.md

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions charts/kafdrop/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# kafdrop

{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}

{{ template "chart.description" . }}

The chart is under active development and may contain bugs/unfinished documentation. Any testing/contributions are welcome! :)

{{ template "chart.homepageLine" . }}

{{/*
Chart Maintainers
*/}}
{{ template "chart.maintainersSection" . }}

{{/*
Chart Sources
*/}}
{{ template "chart.sourcesSection" . }}

{{/*
Chart Requirements
*/}}
{{ template "chart.requirementsSection" . }}

# Major Changes

Major Changes to functions are documented with the version affected. **Before upgrading the dependency version, check this section out!**

| **Change** | **Chart Version** | **Description** | **Commits/PRs** |
| :--------- | :---------------- | :-------------- | :-------------- |
|||||

{{/*
Chart Values
*/}}
{{ template "chart.valuesSection" . }}
106 changes: 106 additions & 0 deletions charts/kafdrop/templates/_kafdrop.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{{/*
Copyright © 2021 Bedag Informatik AG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{/*
Kafdrop Configuration
Renders Broker Connections correctly, if they are type slice, Handles the default, when it's already a single string
*/}}
{{- define "kafdrop.connections" -}}
{{- $connections := $.Values.config.kafka.connections -}}
{{- if kindIs "slice" $.Values.config.kafka.connections }}
{{- $connections = ($.Values.config.kafka.connections | join ", ") -}}
{{- end }}
{{- printf "%s" $connections -}}
{{- end }}
{{/*
Kafdrop Configuration
Renders Broker Connections correctly, if they are type slice, Handles the default, when it's already a single string
*/}}
{{- define "kafdrop.jvmopts" -}}
{{- $jvmopts := $.Values.config.jvm -}}
{{- if kindIs "slice" $.Values.config.jvm }}
{{- $jvmopts = ($.Values.config.jvm | join " ") -}}
{{- end }}
{{- printf "%s" $jvmopts -}}
{{- end -}}

{{/*
Kafdrop Configuration Merges Commandline Arguments with Protocol Path, if defined
*/}}
{{- define "kafdrop.protobuf" -}}
{{- if $.Values.config.protoDesc.enabled -}} --message.format=PROTOBUF --protobufdesc.directory={{- $.Values.config.protoDesc.path -}} {{- end -}}
{{- end -}}

{{/*
Kafdrop Configuration
Merges Commandline Arguments with Protocol Path, if defined
*/}}
{{- define "kafdrop.cmdArgs" -}}
{{- if $.Values.config.cmdArgs }}
{{- $args := $.Values.config.cmdArgs -}}
{{- if kindIs "slice" $.Values.config.cmdArgs }}
{{- $args = ($.Values.config.cmdArgs| join " ") -}}
{{- end }}
{{- printf "%s %s" $args (include "kafdrop.protobuf" .) -}}
{{- end }}
{{- end -}}

{{- define "kafdrop.endpoint" }}
{{- $.Values.config.server.context | trimSuffix "/" | nospace }}/actuator/health
{{- end }}


{{/*
Kafdrop Environment Configuration
*/}}
{{- define "kafdrop.configuration" -}}
- name: KAFKA_BROKERCONNECT
value: "{{ template "kafdrop.connections" . }}"
- name: JVM_OPTS
value: "{{ template "kafdrop.jvmopts" . }}"
- name: SERVER_SERVLET_CONTEXT_PATH
value: "{{ $.Values.config.server.context }}"
- name: SERVER_PORT
value: "{{ $.Values.config.server.port }}"
- name: CMD_ARGS
value: "{{ template "kafdrop.cmdArgs" . }}"
{{- if $.Values.config.kafka.properties.content }}
- name: KAFKA_PROPERTIES
secret: true
value: {{ include "lib.utils.strings.template" (dict "value" .Values.config.kafka.properties.content "context" $) }}
{{- end }}
- name: KAFKA_PROPERTIES_FILE
value: "{{ $.Values.config.kafka.properties.destination }}"
{{- if $.Values.config.kafka.truststore.content }}
- name: KAFKA_TRUSTSTORE
secret: true
value: {{ include "lib.utils.strings.template" (dict "value" .Values.config.kafka.truststore.content "context" $) }}
{{- end }}
- name: KAFKA_TRUSTSTORE_FILE
value: "{{ $.Values.config.kafka.truststore.destination }}"
{{- if $.Values.config.kafka.keystore.content }}
- name: KAFKA_KEYSTORE
secret: true
value: {{ include "lib.utils.strings.template" (dict "value" .Values.config.kafka.keystore.content "context" $) }}
{{- end }}
- name: KAFKA_KEYSTORE_FILE
value: "{{ $.Values.config.kafka.keystore.destination }}"
{{- if $.Values.jmxExporter.enabled }}
- name: JMX_PORT
value: "{{ $.Values.jmxExporter.targetPort }}"
{{- end }}
{{- end -}}
102 changes: 102 additions & 0 deletions charts/kafdrop/templates/bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{{/*

Copyright © 2021 Bedag Informatik AG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}

{{- include "bedag-lib.manifest.bundle" $ | nindent 0 }}

{{/*
kafdrop Chart Bundle
*/}}
{{- define "chart.bundle" -}}
resources:
{{- if $.Values.extraResources }}
{{- toYaml $.Values.extraResources | nindent 2 }}
{{- end }}

{{ $jmxExporter := (fromYaml (include "bedag-lib.utils.presets" (dict "preset" "jmxexporter" "values" $.Values.jmxExporter "context" $))) }}
{{- if $jmxExporter.extraResources }}
{{- toYaml $jmxExporter.extraResources | nindent 2 }}
{{- end }}

- type: "deployment"
values: {{ toYaml $.Values.deployment | nindent 6 }}
overwrites:
podAnnotations:
checksum/config: {{ (toYaml $.Values.config) | sha256sum }}

environment: {{- include "kafdrop.configuration" $ | nindent 8 }}
{{- if $.Values.deployment.environment }}
{{ include "lib.utils.lists.exceptionList" (dict "list" $.Values.deployment.environment "exceptions" (list "KAFKA_BROKERCONNECT" "JVM_OPTS")) | nindent 8 }}
{{- end }}

{{/*
Predefined Ports
*/}}
ports:
{{- if $.Values.deployment.ports }}
{{- toYaml $.Values.deployment.ports | nindent 8 }}
{{- end }}
- name: http
containerPort: {{ $.Values.config.server.port }}
protocol: TCP
{{- if $jmxExporter.ports }}
{{- toYaml $jmxExporter.ports | nindent 8 }}
{{- end }}

{{/*
Predefined Statefulset Volumes
*/}}
{{- if or $.Values.deployment.volumes $jmxExporter.volumes }}
volumes:
{{- if $.Values.deployment.volumes }}
{{- toYaml $.Values.deployment.volumes | nindent 8 }}
{{- end }}
{{- if $jmxExporter.volumes }}
{{- toYaml $jmxExporter.volumes | nindent 8 }}
{{- end }}
{{- end }}

{{/*
Predefined Statefulset Sidecars
*/}}
{{- if or $jmxExporter.container $.Values.deployment.sidecars }}
sidecars:
{{- if $.Values.deployment.sidecars }}
{{- toYaml $.Values.deployment.sidecars | nindent 8 }}
{{- end }}
{{- if $jmxExporter.container }}
- {{- toYaml $jmxExporter.container | nindent 10 }}
{{- end }}
{{- end }}

- type: "service"
values: {{ toYaml $.Values.service | nindent 6 }}

- type: "ingress"
values: {{ toYaml $.Values.ingress | nindent 6 }}

{{- if (gt (int $.Values.deployment.replicaCount) 1) }}
- type: "poddisruptionbudget"
values: {{ toYaml $.Values.pdb | nindent 6 }}
{{- end }}
- type: "horizontalpodautoscaler"
values: {{ toYaml $.Values.autoscaling | nindent 6 }}
overwrites:
scaleTargetRef:
apiVersion: apps/v1
kind: Statefulset
name: '{{ include "lib.utils.common.fullname" $ }}'
{{- end -}}
Loading

0 comments on commit 700199d

Please sign in to comment.