From 5271d246fe506995e20b2353494b3fe12653bc03 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Fri, 13 Jul 2018 09:31:46 -0500 Subject: [PATCH] Fluent-logging: Update tests and template job This updates the helm tests and the elasticsearch template job. This changes the tests to conditionally check whether the template job is enabled and the templates key is not empty, and uses the result to determine whether to test for the existence of those templates (to account for situations where the job is disabled). This updates the job to also check whether there are templates defined in additional to checking whether the job itself is enabled. Change-Id: I14cedeb8d8a4444a73ea974426c3b0f136d1b698 --- fluent-logging/templates/bin/_helm-tests.sh.tpl | 4 ++++ fluent-logging/templates/job-elasticsearch-template.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fluent-logging/templates/bin/_helm-tests.sh.tpl b/fluent-logging/templates/bin/_helm-tests.sh.tpl index e9875b5a1..e345ad411 100644 --- a/fluent-logging/templates/bin/_helm-tests.sh.tpl +++ b/fluent-logging/templates/bin/_helm-tests.sh.tpl @@ -46,6 +46,7 @@ function check_kubernetes_tag () { fi } +{{ if and (.Values.manifests.job_elasticsearch_template) (not (empty .Values.conf.templates)) }} # Tests whether fluent-logging has successfully generated the elasticsearch index mapping # templates defined by values.yaml function check_templates () { @@ -61,9 +62,12 @@ function check_templates () { fi {{ end }} } +{{ end }} # Sleep for at least the buffer flush time to allow for indices to be populated sleep 30 +{{ if and (.Values.manifests.job_elasticsearch_template) (not (empty .Values.conf.templates)) }} check_templates +{{ end }} check_logstash_index check_kubernetes_tag diff --git a/fluent-logging/templates/job-elasticsearch-template.yaml b/fluent-logging/templates/job-elasticsearch-template.yaml index e766163be..21c71919e 100644 --- a/fluent-logging/templates/job-elasticsearch-template.yaml +++ b/fluent-logging/templates/job-elasticsearch-template.yaml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */}} -{{- if .Values.manifests.job_elasticsearch_template }} +{{- if and (.Values.manifests.job_elasticsearch_template) (not (empty .Values.conf.templates)) }} {{- $envAll := . }} {{- $esUserSecret := .Values.secrets.elasticsearch.user }} {{- $mounts_elasticsearch_template := .Values.pod.mounts.elasticsearch_template.elasticsearch_template }}