Add ability to set Prometheus ServiceMonitor namespace to realese namespace (#19253)

Signed-off-by: vkropotko <vjkropotko@gmail.com>
This commit is contained in:
Viacheslav Kropotko
2019-12-02 07:15:04 -08:00
committed by Kubernetes Prow Robot
parent 4b76cf73dc
commit 07fbbd7fb6
5 changed files with 97 additions and 86 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
description: Apache Kafka is publish-subscribe messaging rethought as a distributed
commit log.
name: kafka
version: 0.20.5
version: 0.20.6
appVersion: 5.0.1
keywords:
- kafka
+84 -83
View File
@@ -56,89 +56,90 @@ following configurable parameters:
| Parameter | Description | Default |
|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| `image` | Kafka Container image name | `confluentinc/cp-kafka` |
| `imageTag` | Kafka Container image tag | `5.0.1` |
| `imagePullPolicy` | Kafka Container pull policy | `IfNotPresent` |
| `replicas` | Kafka Brokers | `3` |
| `component` | Kafka k8s selector key | `kafka` |
| `resources` | Kafka resource requests and limits | `{}` |
| `securityContext` | Kafka containers security context | `{}` |
| `kafkaHeapOptions` | Kafka broker JVM heap options | `-Xmx1G-Xms1G` |
| `logSubPath` | Subpath under `persistence.mountPath` where kafka logs will be placed. | `logs` |
| `schedulerName` | Name of Kubernetes scheduler (other than the default) | `nil` |
| `serviceAccountName` | Name of Kubernetes serviceAccount. Useful when needing to pull images from custom repositories | `nil` |
| `priorityClassName` | Name of Kubernetes Pod PriorityClass. https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass | `nil` |
| `affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `tolerations` | List of node tolerations for the pods. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` |
| `headless.annotations` | List of annotations for the headless service. https://kubernetes.io/docs/concepts/services-networking/service/#headless-services | `[]` |
| `headless.targetPort` | Target port to be used for the headless service. This is not a required value. | `nil` |
| `headless.port` | Port to be used for the headless service. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `9092` |
| `external.enabled` | If True, exposes Kafka brokers via NodePort (PLAINTEXT by default) | `false` |
| `external.dns.useInternal` | If True, add Annotation for internal DNS service | `false` |
| `external.dns.useExternal` | If True, add Annotation for external DNS service | `true` |
| `external.servicePort` | TCP port configured at external services (one per pod) to relay from NodePort to the external listener port. | '19092' |
| `external.firstListenerPort` | TCP port which is added pod index number to arrive at the port used for NodePort and external listener port. | '31090' |
| `external.domain` | Domain in which to advertise Kafka external listeners. | `cluster.local` |
| `external.type` | Service Type. | `NodePort` |
| `external.distinct` | Distinct DNS entries for each created A record. | `false` |
| `external.annotations` | Additional annotations for the external service. | `{}` |
| `external.loadBalancerIP` | Add Static IP to the type Load Balancer. Depends on the provider if enabled | `[]`
| `external.loadBalancerSourceRanges` | Add IP ranges that are allowed to access the Load Balancer. | `[]`
| `podAnnotations` | Annotation to be added to Kafka pods | `{}` |
| `podLabels` | Labels to be added to Kafka pods | `{}` |
| `podDisruptionBudget` | Define a Disruption Budget for the Kafka Pods | `{}` |
| `envOverrides` | Add additional Environment Variables in the dictionary format | `{ zookeeper.sasl.enabled: "False" }` |
| `configurationOverrides` | `Kafka ` [configuration setting][brokerconfigs] overrides in the dictionary format | `{ "confluent.support.metrics.enable": false }` |
| `secrets` | Pass any secrets to the kafka pods. Each secret will be passed as an environment variable by default. The secret can also be mounted to a specific path if required. Environment variable names are generated as: `<secretName>_<secretKey>` (All upper case) | `{}` |
| `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` |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
| `readinessProbe.failureThreshold` | After the probe fails this many times, pod will be marked Unready. | `3` |
| `terminationGracePeriodSeconds` | Wait up to this many seconds for a broker to shut down gracefully, after which it is killed | `60` |
| `updateStrategy` | StatefulSet update strategy to use. | `{ type: "OnDelete" }` |
| `podManagementPolicy` | Start and stop pods in Parallel or OrderedReady (one-by-one.) Can not change after first release. | `OrderedReady` |
| `persistence.enabled` | Use a PVC to persist data | `true` |
| `persistence.size` | Size of data volume | `1Gi` |
| `persistence.mountPath` | Mount path of data volume | `/opt/kafka/data` |
| `persistence.storageClass` | Storage class of backing PVC | `nil` |
| `jmx.configMap.enabled` | Enable the default ConfigMap for JMX | `true` |
| `jmx.configMap.overrideConfig` | Allows config file to be generated by passing values to ConfigMap | `{}` |
| `jmx.configMap.overrideName` | Allows setting the name of the ConfigMap to be used | `""` |
| `jmx.port` | The jmx port which JMX style metrics are exposed (note: these are not scrapeable by Prometheus) | `5555` |
| `jmx.whitelistObjectNames` | Allows setting which JMX objects you want to expose to via JMX stats to JMX Exporter | (see `values.yaml`) |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `prometheus.jmx.resources` | Allows setting resource limits for jmx sidecar container | `{}` |
| `prometheus.jmx.enabled` | Whether or not to expose JMX metrics to Prometheus | `false` |
| `prometheus.jmx.image` | JMX Exporter container image | `solsson/kafka-prometheus-jmx-exporter@sha256` |
| `prometheus.jmx.imageTag` | JMX Exporter container image tag | `a23062396cd5af1acdf76512632c20ea6be76885dfc20cd9ff40fb23846557e8` |
| `prometheus.jmx.interval` | Interval that Prometheus scrapes JMX metrics when using Prometheus Operator | `10s` |
| `prometheus.jmx.scrapeTimeout` | Timeout that Prometheus scrapes JMX metrics when using Prometheus Operator | `10s` |
| `prometheus.jmx.port` | JMX Exporter Port which exposes metrics in Prometheus format for scraping | `5556` |
| `prometheus.kafka.enabled` | Whether or not to create a separate Kafka exporter | `false` |
| `prometheus.kafka.image` | Kafka Exporter container image | `danielqsj/kafka-exporter` |
| `prometheus.kafka.imageTag` | Kafka Exporter container image tag | `v1.2.0` |
| `prometheus.kafka.interval` | Interval that Prometheus scrapes Kafka metrics when using Prometheus Operator | `10s` |
| `prometheus.kafka.scrapeTimeout` | Timeout that Prometheus scrapes Kafka metrics when using Prometheus Operator | `10s` |
| `prometheus.kafka.port` | Kafka Exporter Port which exposes metrics in Prometheus format for scraping | `9308` |
| `prometheus.kafka.resources` | Allows setting resource limits for kafka-exporter pod | `{}` |
| `prometheus.kafka.affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `prometheus.kafka.tolerations` | List of node tolerations for the pods. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` |
| `prometheus.operator.enabled` | True if using the Prometheus Operator, False if not | `false` |
| `prometheus.operator.serviceMonitor.namespace` | Namespace which Prometheus is running in. Default to kube-prometheus install. | `monitoring` |
| `prometheus.operator.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
| `configJob.backoffLimit` | Number of retries before considering kafka-config job as failed | `6` |
| `topics` | List of topics to create & configure. Can specify name, partitions, replicationFactor, reassignPartitions, config. See values.yaml | `[]` (Empty list) |
| `zookeeper.enabled` | If True, installs Zookeeper Chart | `true` |
| `zookeeper.resources` | Zookeeper resource requests and limits | `{}` |
| `zookeeper.env` | Environmental variables provided to Zookeeper Zookeeper | `{ZK_HEAP_SIZE: "1G"}` |
| `zookeeper.storage` | Zookeeper Persistent volume size | `2Gi` |
| `zookeeper.image.PullPolicy` | Zookeeper Container pull policy | `IfNotPresent` |
| `zookeeper.url` | URL of Zookeeper Cluster (unneeded if installing Zookeeper Chart) | `""` |
| `zookeeper.port` | Port of Zookeeper Cluster | `2181` |
| `zookeeper.affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `zookeeper.nodeSelector` | Node labels for pod assignment | `{}` |
| `image` | Kafka Container image name | `confluentinc/cp-kafka` |
| `imageTag` | Kafka Container image tag | `5.0.1` |
| `imagePullPolicy` | Kafka Container pull policy | `IfNotPresent` |
| `replicas` | Kafka Brokers | `3` |
| `component` | Kafka k8s selector key | `kafka` |
| `resources` | Kafka resource requests and limits | `{}` |
| `securityContext` | Kafka containers security context | `{}` |
| `kafkaHeapOptions` | Kafka broker JVM heap options | `-Xmx1G-Xms1G` |
| `logSubPath` | Subpath under `persistence.mountPath` where kafka logs will be placed. | `logs` |
| `schedulerName` | Name of Kubernetes scheduler (other than the default) | `nil` |
| `serviceAccountName` | Name of Kubernetes serviceAccount. Useful when needing to pull images from custom repositories | `nil` |
| `priorityClassName` | Name of Kubernetes Pod PriorityClass. https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass | `nil` |
| `affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `tolerations` | List of node tolerations for the pods. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` |
| `headless.annotations` | List of annotations for the headless service. https://kubernetes.io/docs/concepts/services-networking/service/#headless-services | `[]` |
| `headless.targetPort` | Target port to be used for the headless service. This is not a required value. | `nil` |
| `headless.port` | Port to be used for the headless service. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `9092` |
| `external.enabled` | If True, exposes Kafka brokers via NodePort (PLAINTEXT by default) | `false` |
| `external.dns.useInternal` | If True, add Annotation for internal DNS service | `false` |
| `external.dns.useExternal` | If True, add Annotation for external DNS service | `true` |
| `external.servicePort` | TCP port configured at external services (one per pod) to relay from NodePort to the external listener port. | '19092' |
| `external.firstListenerPort` | TCP port which is added pod index number to arrive at the port used for NodePort and external listener port. | '31090' |
| `external.domain` | Domain in which to advertise Kafka external listeners. | `cluster.local` |
| `external.type` | Service Type. | `NodePort` |
| `external.distinct` | Distinct DNS entries for each created A record. | `false` |
| `external.annotations` | Additional annotations for the external service. | `{}` |
| `external.loadBalancerIP` | Add Static IP to the type Load Balancer. Depends on the provider if enabled | `[]`
| `external.loadBalancerSourceRanges` | Add IP ranges that are allowed to access the Load Balancer. | `[]`
| `podAnnotations` | Annotation to be added to Kafka pods | `{}` |
| `podLabels` | Labels to be added to Kafka pods | `{}` |
| `podDisruptionBudget` | Define a Disruption Budget for the Kafka Pods | `{}` |
| `envOverrides` | Add additional Environment Variables in the dictionary format | `{ zookeeper.sasl.enabled: "False" }` |
| `configurationOverrides` | `Kafka ` [configuration setting][brokerconfigs] overrides in the dictionary format | `{ "confluent.support.metrics.enable": false }` |
| `secrets` | Pass any secrets to the kafka pods. Each secret will be passed as an environment variable by default. The secret can also be mounted to a specific path if required. Environment variable names are generated as: `<secretName>_<secretKey>` (All upper case) | `{}` |
| `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` |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
| `readinessProbe.failureThreshold` | After the probe fails this many times, pod will be marked Unready. | `3` |
| `terminationGracePeriodSeconds` | Wait up to this many seconds for a broker to shut down gracefully, after which it is killed | `60` |
| `updateStrategy` | StatefulSet update strategy to use. | `{ type: "OnDelete" }` |
| `podManagementPolicy` | Start and stop pods in Parallel or OrderedReady (one-by-one.) Can not change after first release. | `OrderedReady` |
| `persistence.enabled` | Use a PVC to persist data | `true` |
| `persistence.size` | Size of data volume | `1Gi` |
| `persistence.mountPath` | Mount path of data volume | `/opt/kafka/data` |
| `persistence.storageClass` | Storage class of backing PVC | `nil` |
| `jmx.configMap.enabled` | Enable the default ConfigMap for JMX | `true` |
| `jmx.configMap.overrideConfig` | Allows config file to be generated by passing values to ConfigMap | `{}` |
| `jmx.configMap.overrideName` | Allows setting the name of the ConfigMap to be used | `""` |
| `jmx.port` | The jmx port which JMX style metrics are exposed (note: these are not scrapeable by Prometheus) | `5555` |
| `jmx.whitelistObjectNames` | Allows setting which JMX objects you want to expose to via JMX stats to JMX Exporter | (see `values.yaml`) |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `prometheus.jmx.resources` | Allows setting resource limits for jmx sidecar container | `{}` |
| `prometheus.jmx.enabled` | Whether or not to expose JMX metrics to Prometheus | `false` |
| `prometheus.jmx.image` | JMX Exporter container image | `solsson/kafka-prometheus-jmx-exporter@sha256` |
| `prometheus.jmx.imageTag` | JMX Exporter container image tag | `a23062396cd5af1acdf76512632c20ea6be76885dfc20cd9ff40fb23846557e8` |
| `prometheus.jmx.interval` | Interval that Prometheus scrapes JMX metrics when using Prometheus Operator | `10s` |
| `prometheus.jmx.scrapeTimeout` | Timeout that Prometheus scrapes JMX metrics when using Prometheus Operator | `10s` |
| `prometheus.jmx.port` | JMX Exporter Port which exposes metrics in Prometheus format for scraping | `5556` |
| `prometheus.kafka.enabled` | Whether or not to create a separate Kafka exporter | `false` |
| `prometheus.kafka.image` | Kafka Exporter container image | `danielqsj/kafka-exporter` |
| `prometheus.kafka.imageTag` | Kafka Exporter container image tag | `v1.2.0` |
| `prometheus.kafka.interval` | Interval that Prometheus scrapes Kafka metrics when using Prometheus Operator | `10s` |
| `prometheus.kafka.scrapeTimeout` | Timeout that Prometheus scrapes Kafka metrics when using Prometheus Operator | `10s` |
| `prometheus.kafka.port` | Kafka Exporter Port which exposes metrics in Prometheus format for scraping | `9308` |
| `prometheus.kafka.resources` | Allows setting resource limits for kafka-exporter pod | `{}` |
| `prometheus.kafka.affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `prometheus.kafka.tolerations` | List of node tolerations for the pods. https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | `[]` |
| `prometheus.operator.enabled` | True if using the Prometheus Operator, False if not | `false` |
| `prometheus.operator.serviceMonitor.namespace` | Namespace which Prometheus is running in. Default to kube-prometheus install. | `monitoring` |
| `prometheus.operator.serviceMonitor.releaseNamespace` | Set namespace to release namespace. Default false | `false` |
| `prometheus.operator.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
| `configJob.backoffLimit` | Number of retries before considering kafka-config job as failed | `6` |
| `topics` | List of topics to create & configure. Can specify name, partitions, replicationFactor, reassignPartitions, config. See values.yaml | `[]` (Empty list) |
| `zookeeper.enabled` | If True, installs Zookeeper Chart | `true` |
| `zookeeper.resources` | Zookeeper resource requests and limits | `{}` |
| `zookeeper.env` | Environmental variables provided to Zookeeper Zookeeper | `{ZK_HEAP_SIZE: "1G"}` |
| `zookeeper.storage` | Zookeeper Persistent volume size | `2Gi` |
| `zookeeper.image.PullPolicy` | Zookeeper Container pull policy | `IfNotPresent` |
| `zookeeper.url` | URL of Zookeeper Cluster (unneeded if installing Zookeeper Chart) | `""` |
| `zookeeper.port` | Port of Zookeeper Cluster | `2181` |
| `zookeeper.affinity` | Defines affinities and anti-affinities for pods as defined in: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity preferences | `{}` |
| `zookeeper.nodeSelector` | Node labels for pod assignment | `{}` |
Specify parameters using `--set key=value[,key=value]` argument to `helm install`
+8
View File
@@ -110,3 +110,11 @@ app.kubernetes.io/component: kafka-monitor
{{ include "kafka.common.metaLabels" . }}
{{ include "kafka.monitor.matchLabels" . }}
{{- end -}}
{{- define "serviceMonitor.namespace" -}}
{{- if .Values.prometheus.operator.serviceMonitor.releaseNamespace -}}
{{ .Release.Namespace }}
{{- else -}}
{{ .Values.prometheus.operator.serviceMonitor.namespace }}
{{- end -}}
{{- end -}}
@@ -3,7 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "kafka.fullname" . }}
namespace: {{ .Values.prometheus.operator.serviceMonitor.namespace }}
namespace: {{ include "serviceMonitor.namespace" . }}
labels:
{{- include "kafka.monitor.labels" . | nindent 4 }}
{{ toYaml .Values.prometheus.operator.serviceMonitor.selector | indent 4 }}
@@ -27,7 +27,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "kafka.fullname" . }}-exporter
namespace: {{ .Values.prometheus.operator.serviceMonitor.namespace }}
namespace: {{ include "serviceMonitor.namespace" . }}
labels:
{{- include "kafka.monitor.labels" . | nindent 4 }}
{{ toYaml .Values.prometheus.operator.serviceMonitor.selector | indent 4 }}
+2
View File
@@ -370,6 +370,8 @@ prometheus:
serviceMonitor:
# Namespace Prometheus is installed in
namespace: monitoring
# Use release namespace instead
releaseNamespace: false
## Defaults to whats used if you follow CoreOS [Prometheus Install Instructions](https://github.com/coreos/prometheus-operator/tree/master/helm#tldr)
## [Prometheus Selector Label](https://github.com/coreos/prometheus-operator/blob/master/helm/prometheus/templates/prometheus.yaml#L65)