Skip to content

Commit

Permalink
apps sc: Upgrade prometheus-elasticsearch-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
lunkan93 authored Aug 5, 2024
1 parent a0241c1 commit 696899f
Show file tree
Hide file tree
Showing 27 changed files with 327 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
app: opensearch-dashboards
- podSelector:
matchLabels:
app: prometheus-elasticsearch-exporter
app.kubernetes.io/name: prometheus-elasticsearch-exporter
- podSelector:
matchLabels:
app: configurer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ spec:
- Egress
podSelector:
matchLabels:
app: prometheus-elasticsearch-exporter
app.kubernetes.io/name: prometheus-elasticsearch-exporter

ingress:
- from:
- podSelector:
Expand Down
2 changes: 1 addition & 1 deletion helmfile.d/upstream/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ charts:

prometheus-community/kube-prometheus-stack: 56.6.2
prometheus-community/prometheus-blackbox-exporter: 8.13.0
prometheus-community/prometheus-elasticsearch-exporter: 5.1.1
prometheus-community/prometheus-elasticsearch-exporter: 6.1.0

vmware-tanzu/velero: 6.0.0
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
apiVersion: v1
appVersion: 1.5.0
apiVersion: v2
appVersion: v1.7.0
description: Elasticsearch stats exporter for Prometheus
home: https://github.com/prometheus-community/elasticsearch_exporter
keywords:
- metrics
- elasticsearch
- monitoring
kubeVersion: '>=1.10.0-0'
kubeVersion: '>=1.19.0-0'
maintainers:
- email: [email protected]
name: svenmueller
- email: [email protected]
name: desaintmartin
- email: [email protected]
name: zeritti
name: prometheus-elasticsearch-exporter
sources:
- https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-elasticsearch-exporter
version: 5.1.1
type: application
version: 6.1.0
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
# Elasticsearch Exporter
# Prometheus Elasticsearch Exporter

Prometheus exporter for various metrics about ElasticSearch, written in Go.
Prometheus exporter for various metrics about Elasticsearch, written in Go. For more information, please, see the project's [repository](https://github.com/prometheus-community/elasticsearch_exporter).

Learn more: <https://github.com/prometheus-community/elasticsearch_exporter>

This chart creates an Elasticsearch-Exporter deployment on a [Kubernetes](http://kubernetes.io)
This chart creates an Elasticsearch exporter deployment on a [Kubernetes](http://kubernetes.io)
cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.10+
- Helm 3.7+
- Kubernetes 1.19+

## Get Helm Repository Info

<!-- textlint-disable terminology -->
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
<!-- textlint-enable -->
## Install Helm Chart

```console
# Helm 3
$ helm install [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter

# Helm 2
$ helm install --name [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter
helm install [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter
```

The command deploys Elasticsearch Exporter on the Kubernetes cluster using the default configuration.
Expand All @@ -39,11 +34,7 @@ _See [helm install](https://helm.sh/docs/helm/helm_install/) for command documen
## Uninstall Helm Chart

```console
# Helm 3
$ helm uninstall [RELEASE_NAME]

# Helm 2
# helm delete --purge [RELEASE_NAME]
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.
Expand All @@ -53,12 +44,39 @@ _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command doc
## Upgrading Helm Chart

```console
# Helm 3 or 2
$ helm upgrade [RELEASE_NAME] [CHART] --install
helm upgrade [RELEASE_NAME] prometheus-community/prometheus-elasticsearch-exporter --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._

## To 6.0.0

In release 6.0, the chart API version has been increased to v2. From now on, the chart supports Helm 3 only.

The minimum Kubernetes version supported by the chart has been raised to 1.19.

Labels and selectors have been replaced following [Helm 3 label and annotation best practices](https://helmsh/docs/chart_best_practices/labels/):

| Previous | Current |
|---------------------|------------------------------|
| app | app.kubernetes.io/name |
| chart | helm.sh/chart |
| [none] | app.kubernetes.io/version |
| heritage | app.kubernetes.io/managed-by |
| release | app.kubernetes.io/instance |

As the change is affecting immutable selector labels, the deployment must be deleted before upgrading the release, e.g.:

```console
kubectl delete deploy -l app=prometheus-elasticsearch-exporter
```

Once the resources have been deleted, you can upgrade the release:

```console
helm upgrade -i RELEASE_NAME prometheus-community/prometheus-elasticsearch-exporter
```

### To 5.0.0

`securityContext` has been renamed to `podSecurityContext` and `securityContext.enabled` has no effect anymore. To mirror the behaviour of `securityContext.enabled=false` of 4.x unset `podSecurityContext`.
Expand Down Expand Up @@ -100,11 +118,7 @@ See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_h
To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:

```console
# Helm 2
$ helm inspect values prometheus-community/prometheus-elasticsearch-exporter

# Helm 3
$ helm show values prometheus-community/prometheus-elasticsearch-exporter
helm show values prometheus-community/prometheus-elasticsearch-exporter
```

> **Tip**: You can use the default [values.yaml](values.yaml)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# Create extra manifests

extraManifests:
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-elasticsearch-exporter-extra
data:
extra-data: "value"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
# Unset pod level securityContext

podSecurityContext: null
podSecurityContext: null
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "elasticsearch-exporter.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.httpPort }}{{ .Values.web.path }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "elasticsearch-exporter.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:{{ .Values.service.httpPort }}{{ .Values.web.path }} to use your application"
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template
"elasticsearch-exporter.name" . }}" -o jsonpath="{.items[0].metadata.name}")

kubectl port-forward $POD_NAME {{ .Values.service.httpPort }}:{{ .Values.service.httpPort }} --namespace {{ .Release.Namespace }}
echo "Visit http://127.0.0.1:{{ .Values.service.httpPort }}{{ .Values.web.path }} to use your application"
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,64 @@ Usage:


{{/*
Return the proper Docker Image Registry Secret Names evaluating values as templates
{{ include "elasticsearch-exporter.image.pullSecret.name" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
*/}}
{{- define "elasticsearch-exporter.image.pullSecret.name" -}}
{{- $pullSecrets := list }}
{{- $context := .context }}
To help compatibility with other charts which use global.imagePullSecrets.
Allow either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style).
global:
imagePullSecrets:
- name: pullSecret1
- name: pullSecret2

{{- if $context.Values.global }}
{{- range $context.Values.global.imagePullSecrets -}}
{{/* Is plain array of strings, compatible with all bitnami charts */}}
{{- $pullSecrets = append $pullSecrets (include "elasticsearch-exporter.tplvalue.render" (dict "value" . "context" $context)) -}}
{{- end -}}
{{- end -}}
{{- range .images -}}
{{- if .pullSecret -}}
{{- $pullSecrets = append $pullSecrets (include "elasticsearch-exporter.tplvalue.render" (dict "value" .pullSecret "context" $context)) -}}
{{- end -}}
{{- end -}}
or

{{- if (not (empty $pullSecrets)) }}
imagePullSecrets:
{{- range $pullSecrets | uniq }}
- name: {{ . }}
{{- end }}
global:
imagePullSecrets:
- pullSecret1
- pullSecret2
*/}}
{{- define "elasticsearch-exporter.imagePullSecrets" -}}
{{- range .Values.global.imagePullSecrets }}
{{- if eq (typeOf .) "map[string]interface {}" }}
- {{ tpl (toYaml .) $ | trim }}
{{- else }}
- name: {{ tpl . $ }}
{{- end }}
{{- end }}
{{- end -}}

{{/*
Return the correct (overridden global) image registry.
*/}}
{{- define "elasticsearch-exporter.image.repository" -}}
{{- $registry := .Values.image.registry -}}
{{- if .Values.global.imageRegistry }}
{{- $registry = .Values.global.imageRegistry -}}
{{- end }}
{{- if $registry -}}
{{- printf "%s/%s" $registry .Values.image.repository -}}
{{- else -}}
{{- printf "%s" .Values.image.repository -}}
{{- end }}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "elasticsearch-exporter.labels" -}}
helm.sh/chart: {{ include "elasticsearch-exporter.chart" . }}
{{ include "elasticsearch-exporter.selectorLabels" . }}
{{- with .Chart.AppVersion }}
app.kubernetes.io/version: {{ . | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.commonLabels }}
{{ toYaml .Values.commonLabels }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "elasticsearch-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "elasticsearch-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ kind: Secret
metadata:
name: {{ template "elasticsearch-exporter.fullname" . }}-cert
labels:
chart: {{ template "elasticsearch-exporter.chart" . }}
app: {{ template "elasticsearch-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- include "elasticsearch-exporter.labels" . | nindent 4 }}
type: Opaque
data:
ca.pem: {{ .Values.es.ssl.ca.pem | b64enc }}
Expand Down
Loading

0 comments on commit 696899f

Please sign in to comment.