From b933e7903f8a753633a0931199d143ca41e55a16 Mon Sep 17 00:00:00 2001 From: Shaun Date: Sun, 30 Sep 2018 04:23:06 +1000 Subject: [PATCH] Add support for deployment tolerations and update helpers (#7706) * Add support for deployment tolerations and update helpers Signed-off-by: Shaun Mansell * Bump version for pod tolerations support Signed-off-by: Shaun Mansell --- stable/elasticsearch-exporter/Chart.yaml | 2 +- stable/elasticsearch-exporter/README.md | 6 ++++-- .../templates/_helpers.tpl | 19 ++++++++++++++++++- .../templates/cert-secret.yaml | 2 +- .../templates/deployment.yaml | 6 +++++- .../templates/service.yaml | 2 +- stable/elasticsearch-exporter/values.yaml | 2 ++ 7 files changed, 32 insertions(+), 7 deletions(-) diff --git a/stable/elasticsearch-exporter/Chart.yaml b/stable/elasticsearch-exporter/Chart.yaml index f7f9acdf25..c6caa0e595 100644 --- a/stable/elasticsearch-exporter/Chart.yaml +++ b/stable/elasticsearch-exporter/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Elasticsearch stats exporter for Prometheus name: elasticsearch-exporter -version: 0.3.0 +version: 0.4.0 appVersion: 1.0.2 home: https://github.com/justwatchcom/elasticsearch_exporter sources: diff --git a/stable/elasticsearch-exporter/README.md b/stable/elasticsearch-exporter/README.md index 2f38cc86f4..52a9feb4fb 100644 --- a/stable/elasticsearch-exporter/README.md +++ b/stable/elasticsearch-exporter/README.md @@ -50,11 +50,13 @@ Parameter | Description | Default `image.tag` | container image tag | `1.0.2` `image.pullPolicy` | container image pull policy | `IfNotPresent` `resources` | resource requests & limits | `{}` -`priorityClassName` | priorityClassName | `nil` | -`nodeSelector` | Node labels for pod assignment | `{}` | +`priorityClassName` | priorityClassName | `nil` +`nodeSelector` | Node labels for pod assignment | `{}` +`tolerations` | Node tolerations for pod assignment | `{}` `podAnnotations` | Pod annotations | `{}` | `service.type` | type of service to create | `ClusterIP` `service.httpPort` | port for the http service | `9108` +`service.annotations` | Annotations on the http service | `{}` `es.uri` | address of the Elasticsearch node to connect to | `localhost:9200` `es.all` | if `true`, query stats for all nodes in the cluster, rather than just the node we connect to | `true` `es.indices` | if true, query stats for all indices in the cluster | `true` diff --git a/stable/elasticsearch-exporter/templates/_helpers.tpl b/stable/elasticsearch-exporter/templates/_helpers.tpl index 3f2a72b244..777a5d9846 100644 --- a/stable/elasticsearch-exporter/templates/_helpers.tpl +++ b/stable/elasticsearch-exporter/templates/_helpers.tpl @@ -9,8 +9,25 @@ Expand the name of the chart. {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. */}} {{- define "elasticsearch-exporter.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} {{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" $name .Release.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "elasticsearch-exporter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + diff --git a/stable/elasticsearch-exporter/templates/cert-secret.yaml b/stable/elasticsearch-exporter/templates/cert-secret.yaml index 6af1ba5f2e..6e4ac25769 100644 --- a/stable/elasticsearch-exporter/templates/cert-secret.yaml +++ b/stable/elasticsearch-exporter/templates/cert-secret.yaml @@ -4,7 +4,7 @@ kind: Secret metadata: name: {{ template "elasticsearch-exporter.fullname" . }}-cert labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + chart: {{ template "elasticsearch-exporter.chart" . }} app: {{ template "elasticsearch-exporter.name" . }} release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/elasticsearch-exporter/templates/deployment.yaml b/stable/elasticsearch-exporter/templates/deployment.yaml index 54794918ca..96bff667f1 100644 --- a/stable/elasticsearch-exporter/templates/deployment.yaml +++ b/stable/elasticsearch-exporter/templates/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: {{ template "elasticsearch-exporter.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + chart: {{ template "elasticsearch-exporter.chart" . }} app: {{ template "elasticsearch-exporter.name" . }} release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" @@ -94,6 +94,10 @@ spec: {{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }} +{{- if .Values.tolerations }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} {{- end }} volumes: {{- if .Values.es.ssl.enabled }} diff --git a/stable/elasticsearch-exporter/templates/service.yaml b/stable/elasticsearch-exporter/templates/service.yaml index 0d1b483b13..bf7df3a1ac 100644 --- a/stable/elasticsearch-exporter/templates/service.yaml +++ b/stable/elasticsearch-exporter/templates/service.yaml @@ -3,7 +3,7 @@ apiVersion: v1 metadata: name: {{ template "elasticsearch-exporter.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + chart: {{ template "elasticsearch-exporter.chart" . }} app: {{ template "elasticsearch-exporter.name" . }} release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" diff --git a/stable/elasticsearch-exporter/values.yaml b/stable/elasticsearch-exporter/values.yaml index 949b4415cd..16a74f7d11 100644 --- a/stable/elasticsearch-exporter/values.yaml +++ b/stable/elasticsearch-exporter/values.yaml @@ -23,6 +23,8 @@ priorityClassName: "" nodeSelector: {} +tolerations: {} + podAnnotations: {} service: