diff --git a/charts/index.yaml b/charts/index.yaml index 7e5dd237..63018d7f 100644 --- a/charts/index.yaml +++ b/charts/index.yaml @@ -1,8 +1,18 @@ apiVersion: v1 entries: + kafka-topics: + - apiVersion: v2 + created: "2022-03-30T10:25:47.992837+02:00" + description: A Helm Chart to create Kafka Topics utilizing the Strimzi Topic Operator + digest: eb0697bf194c3802d0afed042fb0a7d252890c5c09e016f8ad032f4cd2292ded + name: kafka-topics + type: application + urls: + - kafka-topics/kafka-topics-0.1.0.tgz + version: 0.1.0 producer-app: - apiVersion: v1 - created: "2022-03-02T07:32:10.5412721+01:00" + created: "2022-03-30T10:25:47.993288+02:00" description: A helm chart for deploying a Kafka producer application based on the bakdata KafkaProducerApplication template. digest: 96f8c871b0a31650be34434be23e2d58b0373e2dcd81bcdfaa249724df927f32 @@ -12,7 +22,7 @@ entries: version: 0.1.0 producer-app-cleanup-job: - apiVersion: v1 - created: "2022-03-02T07:32:10.5412721+01:00" + created: "2022-03-30T10:25:47.99369+02:00" description: A helm chart for deploying a clean up job for a Kafka producer application. digest: 4fa5a0223590febf043c66579fb48df961ec241f8efcc13e072c64a11f47ccc1 name: producer-app-cleanup-job @@ -21,7 +31,7 @@ entries: version: 0.1.0 rclone-copy: - apiVersion: v1 - created: "2022-03-02T07:32:10.5412721+01:00" + created: "2022-03-30T10:25:47.994243+02:00" description: A helm chart for rclone copy on Kubernetes. digest: 837699c6f9d9f7b13f42550356d17c0678998164eade46c884932cbce2b05c86 name: rclone-copy @@ -30,7 +40,7 @@ entries: version: 1.0.0 streams-app: - apiVersion: v1 - created: "2022-03-02T07:32:10.5412721+01:00" + created: "2022-03-30T10:25:47.994936+02:00" description: A helm chart for deploying a kafka streams application based on the bakdata KafkaStreamsApplication template. digest: d284cce7b81645b1061e8ca37554c4c4473de9718b7020c6e356a10d6fa3100f @@ -40,7 +50,7 @@ entries: version: 0.1.0 streams-app-cleanup-job: - apiVersion: v1 - created: "2022-03-02T07:32:10.5412721+01:00" + created: "2022-03-30T10:25:47.995363+02:00" description: A helm chart for deploying a kafka streams application based on the bakdata KafkaStreamsApplication template. digest: b346d1fea47603302dc987c3e08e12fc6be553175a84801ac3dad5032a57ddd7 @@ -48,4 +58,4 @@ entries: urls: - streams-app-cleanup-job/streams-app-cleanup-job-0.1.0.tgz version: 0.1.0 -generated: "2022-03-02T07:32:10.5412721+01:00" +generated: "2022-03-30T10:25:47.992006+02:00" diff --git a/charts/kafka-topics/Chart.yaml b/charts/kafka-topics/Chart.yaml new file mode 100644 index 00000000..6744f23b --- /dev/null +++ b/charts/kafka-topics/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: kafka-topics +description: A Helm Chart to create Kafka Topics utilizing the Strimzi Topic Operator +type: application +version: 0.1.0 diff --git a/charts/kafka-topics/kafka-topics-0.1.0.tgz b/charts/kafka-topics/kafka-topics-0.1.0.tgz new file mode 100644 index 00000000..7f2b333d Binary files /dev/null and b/charts/kafka-topics/kafka-topics-0.1.0.tgz differ diff --git a/charts/kafka-topics/templates/_helpers.tpl b/charts/kafka-topics/templates/_helpers.tpl new file mode 100644 index 00000000..c434e78c --- /dev/null +++ b/charts/kafka-topics/templates/_helpers.tpl @@ -0,0 +1,34 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kafka-topics.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kafka-topics.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kafka-topics.labels" -}} +helm.sh/chart: {{ include "kafka-topics.chart" . }} +{{ include "kafka-topics.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kafka-topics.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kafka-topics.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/kafka-topics/templates/topics.yaml b/charts/kafka-topics/templates/topics.yaml new file mode 100644 index 00000000..3367f7d1 --- /dev/null +++ b/charts/kafka-topics/templates/topics.yaml @@ -0,0 +1,34 @@ +{{- $root := . -}} +{{- range .Values.topics }} +apiVersion: kafka.strimzi.io/v1beta2 +kind: KafkaTopic +metadata: + name: {{ .name }} + {{- if $root.Values.namespace }} + namespace: {{ $root.Values.namespace }} + {{- end }} + labels: + strimzi.io/cluster: {{ $root.Values.strimziCluster }} + {{- range $key, $value := $root.Values.labels }} + {{ $key }}: {{ $value }} + {{- end }} + {{ include "kafka-topics.labels" $ | nindent 4 }} +spec: + {{- range $key, $val := (.spec) -}} + {{- if not (eq $key "config") }} # ignore config key because we merge it later + {{ $key }}: {{ $val}} + {{- end }} + {{- end }} + {{- if and (not (.spec).partitions) ($root.Values.partitions) }} + partitions: {{ $root.Values.partitions }} + {{- end }} + {{- if and (not (.spec).replicas) ($root.Values.replicas) }} + replicas: {{ $root.Values.replicas }} + {{- end }} + {{- $config := merge ((.spec).config | default dict) ($root.Values.config | default dict) }} + {{- if $config }} + config: + {{ $config | toYaml | nindent 4 }} + {{- end}} +--- +{{- end }} diff --git a/charts/kafka-topics/values.yaml b/charts/kafka-topics/values.yaml new file mode 100644 index 00000000..226d9bfb --- /dev/null +++ b/charts/kafka-topics/values.yaml @@ -0,0 +1,32 @@ +# Default values for kafka-topics. + +nameOverride: kafka-topics +# Optional define namespace for topics +# namespace: example-namespace + + +strimziCluster: example-cluster + +# Labels for all topics +labels: {} + +# Default topic config for all topics defined in topics list. You can override the values in the respective topic specs +# You must define the number of partitions and replicas here OR in the topic spec. Without defining the number of partitions and replicas, the strimzi topic operator will not create the topic in Kafka +# partitions: 1 +# replicas: 1 +# the configs here are merge with the topic specific confis defined below. The topic specific config will override the configs here if there duplicate keys + # config: + # retention.ms: 10000000 + +# define your topics here, you can find an example for specs here: https://github.com/strimzi/strimzi-kafka-operator/blob/0.28.0/examples/topic/kafka-topic.yaml +topics: + # - name: example-topic + # spec: + # partitions: 1 + # replicas: 1 + # - name: another-topic + # spec: + # config: + # retention.ms: 7200000 + # segment.bytes: 1073741824 + # - name: third-topic