From 78317507025b28d0651995f8d091e2213538f782 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 7 Jul 2021 13:27:46 +0200 Subject: [PATCH] [elasticsearch] add value to disable tests (#1116) * [elasticsearch] add value to disable tests Signed-off-by: nflaig * [elasticsearch] add condition to not print test command when the test is disabled Signed-off-by: nflaig Co-authored-by: Julien Mailleret <8582351+jmlrt@users.noreply.github.com> --- elasticsearch/README.md | 1 + elasticsearch/templates/NOTES.txt | 4 +++- elasticsearch/templates/test/test-elasticsearch-health.yaml | 2 ++ elasticsearch/values.yaml | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index f12784fe6..f8385a8de 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -173,6 +173,7 @@ support multiple versions with minimal changes. | `sysctlInitContainer` | Allows you to disable the `sysctlInitContainer` if you are setting [sysctl vm.max_map_count][] with another method | `enabled: true` | | `sysctlVmMaxMapCount` | Sets the [sysctl vm.max_map_count][] needed for Elasticsearch | `262144` | | `terminationGracePeriod` | The [terminationGracePeriod][] in seconds used when trying to stop the pod | `120` | +| `tests.enabled` | Enable creating test related resources when running `helm template` or `helm test` | `true` | | `tolerations` | Configurable [tolerations][] | `[]` | | `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration][] in `extraEnvs` | `9300` | | `updateStrategy` | The [updateStrategy][] for the StatefulSet. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` | diff --git a/elasticsearch/templates/NOTES.txt b/elasticsearch/templates/NOTES.txt index 73edf425a..88b5dd5b1 100755 --- a/elasticsearch/templates/NOTES.txt +++ b/elasticsearch/templates/NOTES.txt @@ -1,4 +1,6 @@ 1. Watch all cluster members come up. $ kubectl get pods --namespace={{ .Release.Namespace }} -l app={{ template "elasticsearch.uname" . }} -w +{{- if .Values.tests.enabled -}} 2. Test cluster health using Helm test. - $ helm test {{ .Release.Name }} + $ helm --namespace={{ .Release.Namespace }} test {{ .Release.Name }} +{{- end -}} diff --git a/elasticsearch/templates/test/test-elasticsearch-health.yaml b/elasticsearch/templates/test/test-elasticsearch-health.yaml index 18e10a884..704cd3d59 100644 --- a/elasticsearch/templates/test/test-elasticsearch-health.yaml +++ b/elasticsearch/templates/test/test-elasticsearch-health.yaml @@ -1,4 +1,5 @@ --- +{{- if .Values.tests.enabled -}} apiVersion: v1 kind: Pod metadata: @@ -32,3 +33,4 @@ spec: {{ toYaml .Values.imagePullSecrets | indent 4 }} {{- end }} restartPolicy: Never +{{- end -}} diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 77a87932a..1361322af 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -335,6 +335,9 @@ networkPolicy: # values: # - frontend +tests: + enabled: true + # Deprecated # please use the above podSecurityContext.fsGroup instead fsGroup: ""