From a96b018fbd582b1ea60eef7edcaf10f029ee321a Mon Sep 17 00:00:00 2001 From: ethanocentricity Date: Thu, 22 Mar 2018 17:58:03 -0600 Subject: [PATCH] Support exposing jmx and additional ports (#4072) * Support exposing jmx and additional ports (for example, prometheus as a java agent) * Increment chart version * FIx typo/formatting * Up chart version * Up chart version Signed-off-by: voron --- incubator/kafka/Chart.yaml | 2 +- incubator/kafka/README.md | 2 ++ incubator/kafka/templates/statefulset.yaml | 11 +++++++++++ incubator/kafka/values.yaml | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/incubator/kafka/Chart.yaml b/incubator/kafka/Chart.yaml index a2e6cc94f493..274265b0b23b 100755 --- a/incubator/kafka/Chart.yaml +++ b/incubator/kafka/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: Apache Kafka is publish-subscribe messaging rethought as a distributed commit log. name: kafka -version: 0.4.5 +version: 0.4.6 keywords: - kafka - zookeeper diff --git a/incubator/kafka/README.md b/incubator/kafka/README.md index 50dd778ba90c..220519cc50b8 100644 --- a/incubator/kafka/README.md +++ b/incubator/kafka/README.md @@ -71,6 +71,8 @@ following configurable parameters: | `external.domain` | Domain in which to advertise Kafka external listeners. | `cluster.local` | | `external.init` | External init container settings. | (see `values.yaml`) | | `configurationOverrides` | `Kafka ` [configuration setting][brokerconfigs] overrides in the dictionary format | `{ offsets.topic.replication.factor: 3 }` | +| `jmxPort` | The jmx port to use for brokers. Will expose both the port and set the KAFKA_JMX_PORT env variable. | blank | +| `additionalPorts` | Additional ports to expose on brokers. Useful when the image exposes metrics (like prometheus, etc.) through a javaagent instead of a sidecar | `{}` | | `readinessProbe.initialDelaySeconds` | Number of seconds before probe is initiated. | `30` | | `readinessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `10` | | `readinessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `5` | diff --git a/incubator/kafka/templates/statefulset.yaml b/incubator/kafka/templates/statefulset.yaml index 54b209fe2ad6..8f458c4d334e 100644 --- a/incubator/kafka/templates/statefulset.yaml +++ b/incubator/kafka/templates/statefulset.yaml @@ -86,6 +86,13 @@ spec: name: external-{{ $i }} {{- end }} {{- end }} + {{- if .Values.jmxPort }} + - containerPort: {{ .Values.jmxPort }} + name: jmx + {{- end }} + {{- if .Values.additionalPorts }} +{{ toYaml .Values.additionalPorts | indent 8 }} + {{- end }} resources: {{ toYaml .Values.resources | indent 10 }} env: @@ -105,6 +112,10 @@ spec: - name: {{ printf "KAFKA_%s" $key | replace "." "_" | upper | quote }} value: {{ $value | quote }} {{- end }} + {{- if .Values.jmxPort }} + - name: KAFKA_JMX_PORT + value: "{{ .Values.jmxPort }}" + {{- end }} # This is required because the Downward API does not yet support identification of # pod numbering in statefulsets. Thus, we are required to specify a command which # allows us to extract the pod ID for usage as the Kafka Broker ID. diff --git a/incubator/kafka/values.yaml b/incubator/kafka/values.yaml index c84c9cada35c..c5889789ccb5 100644 --- a/incubator/kafka/values.yaml +++ b/incubator/kafka/values.yaml @@ -103,6 +103,13 @@ configurationOverrides: # "listener.security.protocol.map": |- # PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT +## The jmx port to use for brokers. Will expose both the port and set the KAFKA_JMX_PORT env variable +# jmxPort: 9998 + +## A collection of additional ports to expose on brokers (formatted as normal containerPort yaml) +# Useful when the image exposes metrics (like prometheus, etc.) through a javaagent instead of a sidecar +additionalPorts: {} + ## Persistence configuration. Specify if and how to persist data to a persistent volume. ## persistence: