[bitnami/kubernetes-event-exporter]: metrics support (#14707)

* feat(kubernetes-event-exporter): metrics support

Signed-off-by: Maxime Leroy <19607336+maxime1907@users.noreply.github.com>

* Update README.md with readme-generator-for-helm

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

---------

Signed-off-by: Maxime Leroy <19607336+maxime1907@users.noreply.github.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Maxime Leroy
2023-02-08 18:49:32 +01:00
committed by GitHub
parent a36d2d9b35
commit d1c69f6720
7 changed files with 290 additions and 57 deletions

View File

@@ -26,4 +26,4 @@ name: kubernetes-event-exporter
sources:
- https://github.com/bitnami/containers/tree/main/bitnami/kubernetes-event-exporter
- https://github.com/resmoio/kubernetes-event-exporter
version: 2.1.7
version: 2.2.0

View File

@@ -76,62 +76,84 @@ The command removes all the Kubernetes components associated with the chart and
### Kubernetes Event Exporter parameters
| Name | Description | Value |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `replicaCount` | Desired number of pod replicas | `1` |
| `image.registry` | Container image registry | `docker.io` |
| `image.repository` | Container image name | `bitnami/kubernetes-event-exporter` |
| `image.tag` | Container image tag | `1.1.0-debian-11-r11` |
| `image.digest` | Container image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
| `hostAliases` | Add deployment host aliases | `[]` |
| `config.logLevel` | Verbosity of the logs (options: `fatal`, `error`, `warn`, `info` or `debug`) | `debug` |
| `config.logFormat` | How the logs are formatted. Allowed values: `pretty` or `json` | `pretty` |
| `config.receivers` | Array containing event receivers | `[]` |
| `config.route.routes` | Array containing event route configuration | `[]` |
| `rbac.create` | Create the RBAC roles for API accessibility | `true` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` |
| `serviceAccount.name` | Name of the service account to use. If not set and create is true, a name is generated using the fullname template. | `""` |
| `serviceAccount.automountServiceAccountToken` | Automount service account token for the server service account | `true` |
| `serviceAccount.annotations` | Annotations for service account. Evaluated as a template. Only used if `create` is `true`. | `{}` |
| `podAnnotations` | Pod annotations | `{}` |
| `podLabels` | Pod labels | `{}` |
| `podSecurityContext.enabled` | Enable security context | `true` |
| `podSecurityContext.fsGroup` | Group ID for the container | `1001` |
| `containerSecurityContext.enabled` | Enable container security context | `true` |
| `containerSecurityContext.capabilities.add` | Add capabilities for the securityContext | `[]` |
| `containerSecurityContext.capabilities.drop` | Drop capabilities for the securityContext | `[]` |
| `containerSecurityContext.readOnlyRootFilesystem` | Allows the pod to mount the RootFS as ReadOnly only | `true` |
| `containerSecurityContext.runAsNonRoot` | If the pod should run as a non root container. | `true` |
| `containerSecurityContext.runAsUser` | Define the uid with which the pod will run | `1001` |
| `command` | Override default container command (useful when using custom images) | `[]` |
| `args` | Override default container args (useful when using custom images) | `[]` |
| `lifecycleHooks` | Lifecycle for the container to automate configuration before or after startup | `{}` |
| `resources.limits` | Specify resource limits which the container is not allowed to succeed. | `{}` |
| `resources.requests` | Specify resource requests which the container needs to spawn. | `{}` |
| `customStartupProbe` | Configure startup probe for Kubernetes event exporter pod | `{}` |
| `customLivenessProbe` | Configure liveness probe for Kubernetes event exporter pod | `{}` |
| `customReadinessProbe` | Configure readiness probe for Kubernetes event exporter pod | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `priorityClassName` | Set Priority Class Name to allow priority control over other pods | `""` |
| `schedulerName` | Name of the k8s scheduler (other than default) | `""` |
| `topologySpreadConstraints` | Topology Spread Constraints for pod assignment | `[]` |
| `tolerations` | Tolerations for pod assignment | `[]` |
| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` |
| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
| `nodeAffinityPreset.key` | Node label key to match. Ignored if `affinity` is set. | `""` |
| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` |
| `affinity` | Affinity for pod assignment | `{}` |
| `updateStrategy.type` | Deployment strategy type. | `RollingUpdate` |
| `extraEnvVars` | Array containing extra env vars to be added to all containers | `[]` |
| `extraEnvVarsCM` | ConfigMap containing extra env vars to be added to all containers | `""` |
| `extraEnvVarsSecret` | Secret containing extra env vars to be added to all containers | `""` |
| `extraVolumeMounts` | Array to add extra mounts (normally used with extraVolumes) | `[]` |
| `extraVolumes` | Array to add extra volumes | `[]` |
| `initContainers` | Attach additional init containers to pods | `[]` |
| `sidecars` | Add additional sidecar containers to pods | `[]` |
| Name | Description | Value |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `replicaCount` | Desired number of pod replicas | `1` |
| `containerPorts.http` | HTTP container port | `2112` |
| `extraContainerPorts` | Optionally specify extra list of additional port-mappings for the container | `[]` |
| `image.registry` | Container image registry | `docker.io` |
| `image.repository` | Container image name | `bitnami/kubernetes-event-exporter` |
| `image.tag` | Container image tag | `1.1.0-debian-11-r11` |
| `image.digest` | Container image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` |
| `hostAliases` | Add deployment host aliases | `[]` |
| `config.logLevel` | Verbosity of the logs (options: `fatal`, `error`, `warn`, `info` or `debug`) | `debug` |
| `config.logFormat` | How the logs are formatted. Allowed values: `pretty` or `json` | `pretty` |
| `config.receivers` | Array containing event receivers | `[]` |
| `config.route.routes` | Array containing event route configuration | `[]` |
| `rbac.create` | Create the RBAC roles for API accessibility | `true` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` |
| `serviceAccount.name` | Name of the service account to use. If not set and create is true, a name is generated using the fullname template. | `""` |
| `serviceAccount.automountServiceAccountToken` | Automount service account token for the server service account | `true` |
| `serviceAccount.annotations` | Annotations for service account. Evaluated as a template. Only used if `create` is `true`. | `{}` |
| `podAnnotations` | Pod annotations | `{}` |
| `podLabels` | Pod labels | `{}` |
| `podSecurityContext.enabled` | Enable security context | `true` |
| `podSecurityContext.fsGroup` | Group ID for the container | `1001` |
| `containerSecurityContext.enabled` | Enable container security context | `true` |
| `containerSecurityContext.capabilities.add` | Add capabilities for the securityContext | `[]` |
| `containerSecurityContext.capabilities.drop` | Drop capabilities for the securityContext | `[]` |
| `containerSecurityContext.readOnlyRootFilesystem` | Allows the pod to mount the RootFS as ReadOnly only | `true` |
| `containerSecurityContext.runAsNonRoot` | If the pod should run as a non root container. | `true` |
| `containerSecurityContext.runAsUser` | Define the uid with which the pod will run | `1001` |
| `command` | Override default container command (useful when using custom images) | `[]` |
| `args` | Override default container args (useful when using custom images) | `[]` |
| `lifecycleHooks` | Lifecycle for the container to automate configuration before or after startup | `{}` |
| `resources.limits` | Specify resource limits which the container is not allowed to succeed. | `{}` |
| `resources.requests` | Specify resource requests which the container needs to spawn. | `{}` |
| `customStartupProbe` | Configure startup probe for Kubernetes event exporter pod | `{}` |
| `customLivenessProbe` | Configure liveness probe for Kubernetes event exporter pod | `{}` |
| `customReadinessProbe` | Configure readiness probe for Kubernetes event exporter pod | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `priorityClassName` | Set Priority Class Name to allow priority control over other pods | `""` |
| `schedulerName` | Name of the k8s scheduler (other than default) | `""` |
| `topologySpreadConstraints` | Topology Spread Constraints for pod assignment | `[]` |
| `tolerations` | Tolerations for pod assignment | `[]` |
| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` |
| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` |
| `nodeAffinityPreset.key` | Node label key to match. Ignored if `affinity` is set. | `""` |
| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` |
| `affinity` | Affinity for pod assignment | `{}` |
| `updateStrategy.type` | Deployment strategy type. | `RollingUpdate` |
| `extraEnvVars` | Array containing extra env vars to be added to all containers | `[]` |
| `extraEnvVarsCM` | ConfigMap containing extra env vars to be added to all containers | `""` |
| `extraEnvVarsSecret` | Secret containing extra env vars to be added to all containers | `""` |
| `extraVolumeMounts` | Array to add extra mounts (normally used with extraVolumes) | `[]` |
| `extraVolumes` | Array to add extra volumes | `[]` |
| `initContainers` | Attach additional init containers to pods | `[]` |
| `sidecars` | Add additional sidecar containers to pods | `[]` |
| `metrics.enabled` | Enable exposing statistics | `false` |
| `metrics.service.ports.http` | Metrics service HTTP port | `2112` |
| `metrics.service.annotations` | Annotations for enabling prometheus to access the metrics endpoints | `{}` |
| `metrics.serviceMonitor.enabled` | Create ServiceMonitor Resource for scraping metrics using PrometheusOperator | `false` |
| `metrics.serviceMonitor.port` | Metrics service HTTP port | `http` |
| `metrics.serviceMonitor.endpoints` | The endpoint configuration of the ServiceMonitor. Path is mandatory. Interval, timeout and labellings can be overwritten. | `[]` |
| `metrics.serviceMonitor.path` | Metrics service HTTP path. Deprecated: Use @param metrics.serviceMonitor.endpoints instead | `""` |
| `metrics.serviceMonitor.namespace` | Namespace which Prometheus is running in | `""` |
| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped | `30s` |
| `metrics.serviceMonitor.scrapeTimeout` | Specify the timeout after which the scrape is ended | `""` |
| `metrics.serviceMonitor.labels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` |
| `metrics.serviceMonitor.selector` | Prometheus instance selector labels | `{}` |
| `metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping | `[]` |
| `metrics.serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion | `[]` |
| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels | `false` |
| `metrics.serviceMonitor.jobLabel` | The name of the label on the target service to use as the job name in prometheus. | `""` |
| `metrics.prometheusRule.enabled` | Create PrometheusRule Resource for scraping metrics using PrometheusOperator | `false` |
| `metrics.prometheusRule.namespace` | Namespace which Prometheus is running in | `""` |
| `metrics.prometheusRule.labels` | Additional labels that can be used so PrometheusRule will be discovered by Prometheus | `{}` |
| `metrics.prometheusRule.groups` | Groups, containing the alert rules. | `[]` |
## Configuration and installation details

View File

@@ -7,6 +7,7 @@ metadata:
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: kubernetes-event-exporter
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
@@ -118,6 +119,13 @@ spec:
{{- end }}
{{- end }}
resources: {{- toYaml .Values.resources | nindent 12 }}
ports:
- name: http
containerPort: {{ .Values.containerPorts.http }}
protocol: TCP
{{- if .Values.extraContainerPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraContainerPorts "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /data
name: cfg

View File

@@ -0,0 +1,30 @@
{{- if .Values.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ printf "%s-metrics" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.metrics.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.metrics.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.service.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: ClusterIP
ports:
- name: http
port: {{ coalesce .Values.metrics.service.ports.http .Values.metrics.service.port }}
protocol: TCP
targetPort: http
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: kubernetes-event-exporter
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled .Values.metrics.prometheusRule.groups}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.prometheusRule.namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: kubernetes-event-exporter
{{- if .Values.metrics.prometheusRule.labels }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.labels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
groups: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.groups "context" .) | nindent 4 }}
{{- end }}

View File

@@ -0,0 +1,54 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ default (include "common.names.namespace" .) .Values.metrics.serviceMonitor.namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: kubernetes-event-exporter
{{- if .Values.metrics.serviceMonitor.labels }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.labels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
{{- end }}
endpoints:
{{- $defaultEndpoint := pick .Values.metrics.serviceMonitor "port" "interval" "scrapeTimeout" "relabelings" "metricRelabelings" "honorLabels" }}
{{- $endpoints := ternary (.Values.metrics.serviceMonitor.endpoints) (list (dict "path" .Values.metrics.serviceMonitor.path)) (empty .Values.metrics.serviceMonitor.path) }}
{{- range $endpoints }}
{{- $endpoint := merge . $defaultEndpoint }}
- port: {{ $endpoint.port }}
path: {{ $endpoint.path }}
{{- if $endpoint.interval }}
interval: {{ $endpoint.interval }}
{{- end }}
{{- if $endpoint.scrapeTimeout }}
scrapeTimeout: {{ $endpoint.scrapeTimeout }}
{{- end }}
{{- if $endpoint.relabelings }}
relabelings: {{- include "common.tplvalues.render" ( dict "value" $endpoint.relabelings "context" $) | nindent 6 }}
{{- end }}
{{- if $endpoint.metricRelabelings }}
metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" $endpoint.metricRelabelings "context" $) | nindent 6 }}
{{- end }}
{{- if $endpoint.honorLabels }}
honorLabels: {{ $endpoint.honorLabels }}
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- {{ include "common.names.namespace" . | quote }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
{{- if .Values.metrics.serviceMonitor.selector }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
{{- end }}
app.kubernetes.io/component: metrics
{{- end }}

View File

@@ -53,6 +53,13 @@ extraDeploy: []
## @param replicaCount Desired number of pod replicas
replicaCount: 1
## @param containerPorts.http HTTP container port
##
containerPorts:
http: 2112
## @param extraContainerPorts Optionally specify extra list of additional port-mappings for the container
##
extraContainerPorts: []
image:
## @param image.registry Container image registry
@@ -302,3 +309,95 @@ initContainers: []
## containerPort: 1234
##
sidecars: []
## Metrics configuration
##
metrics:
## @param metrics.enabled Enable exposing statistics
## ref: https://github.com/resmoio/kubernetes-event-exporter/blob/858089f2dc42243c0939a7f13a76fdd22e70be0f/main.go#L25
##
enabled: false
## metrics service parameters
##
service:
## @param metrics.service.ports.http Metrics service HTTP port
##
ports:
http: 2112
## @param metrics.service.annotations [object] Annotations for enabling prometheus to access the metrics endpoints
##
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "{{ .Values.metrics.service.ports.http }}"
## Prometheus Operator ServiceMonitor configuration
##
serviceMonitor:
## @param metrics.serviceMonitor.enabled Create ServiceMonitor Resource for scraping metrics using PrometheusOperator
##
enabled: false
## @param metrics.serviceMonitor.port Metrics service HTTP port
##
port: http
## @param metrics.serviceMonitor.endpoints [array] The endpoint configuration of the ServiceMonitor. Path is mandatory. Interval, timeout and labellings can be overwritten.
##
endpoints:
- path: /metrics
## @param metrics.serviceMonitor.path Metrics service HTTP path. Deprecated: Use @param metrics.serviceMonitor.endpoints instead
##
path: ""
## @param metrics.serviceMonitor.namespace Namespace which Prometheus is running in
##
namespace: ""
## @param metrics.serviceMonitor.interval Interval at which metrics should be scraped
##
interval: 30s
## @param metrics.serviceMonitor.scrapeTimeout Specify the timeout after which the scrape is ended
## e.g:
## scrapeTimeout: 30s
##
scrapeTimeout: ""
## @param metrics.serviceMonitor.labels Additional labels that can be used so ServiceMonitor will be discovered by Prometheus
##
labels: {}
## @param metrics.serviceMonitor.selector Prometheus instance selector labels
## ref: https://github.com/bitnami/charts/tree/main/bitnami/prometheus-operator#prometheus-configuration
##
selector: {}
## @param metrics.serviceMonitor.relabelings RelabelConfigs to apply to samples before scraping
##
relabelings: []
## @param metrics.serviceMonitor.metricRelabelings MetricRelabelConfigs to apply to samples before ingestion
##
metricRelabelings: []
## @param metrics.serviceMonitor.honorLabels honorLabels chooses the metric's labels on collisions with target labels
##
honorLabels: false
## @param metrics.serviceMonitor.jobLabel The name of the label on the target service to use as the job name in prometheus.
##
jobLabel: ""
## Prometheus Operator alert rules configuration
##
prometheusRule:
## @param metrics.prometheusRule.enabled Create PrometheusRule Resource for scraping metrics using PrometheusOperator
##
enabled: false
## @param metrics.prometheusRule.namespace Namespace which Prometheus is running in
##
namespace: ""
## @param metrics.prometheusRule.labels Additional labels that can be used so PrometheusRule will be discovered by Prometheus
##
labels: {}
## @param metrics.prometheusRule.groups Groups, containing the alert rules.
## Example:
## groups:
## - name: KubernetesEventExporter
## rules:
## - alert: KubernetesEventExporterTooManyWatchErrors
## annotations:
## message: "Kubernetes Event Exporter instance in namespace {{ `{{` }} $labels.namespace {{ `}}` }} has reported too many watch errors in 5 minutes."
## expr: |
## sum(watch_errors{namespace="{{ include "common.names.namespace" . }}"})
## for: 5m
## labels:
## severity: critical
groups: []