From d3bf5e0ad50cbce109315cf03d8b00db647c5ca5 Mon Sep 17 00:00:00 2001 From: Julien Mailleret <8582351+jmlrt@users.noreply.github.com> Date: Wed, 25 Nov 2020 17:46:34 +0100 Subject: [PATCH] [meta] stabilize CI tests (#935) This PR add some improvements to stabilize CI tests which are flaking at this time: - watch resources rollout after upgrade to ensure that goss tests when rollout is done - use newest running pod for goss tests to ensure that it is not using a pod from previous release or a pod which is terminating - remove mention of hostname in goss tests to ensure that test can run in every pods of the Statefulsets, DaemonSets or Deployments - increase some more timeouts for Elasticsearch tests - standardize examples to simplify maintenance and diff --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- apm-server/examples/default/Makefile | 2 +- apm-server/examples/oss/Makefile | 2 +- apm-server/examples/security/Makefile | 2 +- apm-server/examples/upgrade/Makefile | 1 + elasticsearch/examples/config/Makefile | 4 +- elasticsearch/examples/config/test/goss.yaml | 5 +-- elasticsearch/examples/default/Makefile | 6 +-- elasticsearch/examples/default/test/goss.yaml | 7 ++-- .../examples/docker-for-mac/Makefile | 3 +- .../examples/kubernetes-kind/Makefile | 5 ++- elasticsearch/examples/microk8s/Makefile | 3 +- elasticsearch/examples/migration/Makefile | 6 +-- elasticsearch/examples/migration/README.md | 14 +++---- .../migration/{client.yml => client.yaml} | 0 .../migration/{data.yml => data.yaml} | 0 .../migration/{master.yml => master.yaml} | 0 elasticsearch/examples/minikube/Makefile | 3 +- elasticsearch/examples/multi/Makefile | 7 ++-- elasticsearch/examples/multi/README.md | 6 +-- .../multi/{client.yml => client.yaml} | 0 .../examples/multi/{data.yml => data.yaml} | 0 .../multi/{master.yml => master.yaml} | 0 elasticsearch/examples/openshift/Makefile | 6 +-- .../examples/openshift/test/goss.yaml | 5 +-- elasticsearch/examples/oss/Makefile | 4 +- elasticsearch/examples/oss/test/goss.yaml | 1 - elasticsearch/examples/security/Makefile | 9 +++-- .../examples/security/test/goss.yaml | 37 +++++++++---------- .../security/{security.yml => values.yaml} | 0 elasticsearch/examples/upgrade/Makefile | 1 + elasticsearch/examples/upgrade/test/goss.yaml | 1 - filebeat/examples/default/Makefile | 2 +- filebeat/examples/oss/Makefile | 2 +- filebeat/examples/security/Makefile | 2 +- filebeat/examples/upgrade/Makefile | 1 + helpers/examples.mk | 3 +- kibana/examples/default/Makefile | 4 +- kibana/examples/openshift/Makefile | 4 +- kibana/examples/oss/Makefile | 3 +- .../examples/oss/{values.yml => values.yaml} | 0 kibana/examples/security/Makefile | 3 +- kibana/examples/security/README.md | 2 +- .../security/{security.yml => values.yaml} | 0 kibana/examples/upgrade/Makefile | 1 + logstash/examples/default/Makefile | 6 +-- logstash/examples/default/test/goss.yaml | 14 +++---- logstash/examples/elasticsearch/Makefile | 6 +-- .../examples/elasticsearch/test/goss.yaml | 8 ++-- logstash/examples/oss/Makefile | 6 +-- logstash/examples/oss/test/goss.yaml | 14 +++---- logstash/examples/security/Makefile | 3 +- logstash/examples/security/test/goss.yaml | 16 ++++---- logstash/examples/upgrade/Makefile | 1 + logstash/examples/upgrade/test/goss.yaml | 2 - metricbeat/examples/default/Makefile | 2 +- metricbeat/examples/oss/Makefile | 8 ++-- metricbeat/examples/security/Makefile | 8 ++-- metricbeat/examples/upgrade/Makefile | 3 ++ 59 files changed, 131 insertions(+), 135 deletions(-) rename elasticsearch/examples/migration/{client.yml => client.yaml} (100%) rename elasticsearch/examples/migration/{data.yml => data.yaml} (100%) rename elasticsearch/examples/migration/{master.yml => master.yaml} (100%) rename elasticsearch/examples/multi/{client.yml => client.yaml} (100%) rename elasticsearch/examples/multi/{data.yml => data.yaml} (100%) rename elasticsearch/examples/multi/{master.yml => master.yaml} (100%) rename elasticsearch/examples/security/{security.yml => values.yaml} (100%) rename kibana/examples/oss/{values.yml => values.yaml} (100%) rename kibana/examples/security/{security.yml => values.yaml} (100%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 61de9e089..46fd7c261 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,7 @@ e.g. `helm get elasticsearch` (replace `elasticsearch` with the name of your hel *Be careful to obfuscate every secrets (credentials, token, public IP, ...) that could be visible in the output before copy-pasting.* -*If you find some secrets in plain text in `helm get release` output you should use [Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to managed them is a secure way (see [Security Example](https://github.com/elastic/helm-charts/blob/master/elasticsearch/examples/security/security.yml#L23-L38)).* +*If you find some secrets in plain text in `helm get release` output you should use [Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to managed them is a secure way (see [Security Example](https://github.com/elastic/helm-charts/blob/master/elasticsearch/examples/security/values.yaml#L23-L38)).*
Output of helm get release diff --git a/apm-server/examples/default/Makefile b/apm-server/examples/default/Makefile index 57c4116d2..5658ff024 100644 --- a/apm-server/examples/default/Makefile +++ b/apm-server/examples/default/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-apm-server-default install: - helm upgrade --wait --timeout=900s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test: install goss diff --git a/apm-server/examples/oss/Makefile b/apm-server/examples/oss/Makefile index 61ad62b28..686864878 100644 --- a/apm-server/examples/oss/Makefile +++ b/apm-server/examples/oss/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-apm-server-oss install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/apm-server/examples/security/Makefile b/apm-server/examples/security/Makefile index de704f595..47cd9dd3b 100644 --- a/apm-server/examples/security/Makefile +++ b/apm-server/examples/security/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-apm-server-security install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/apm-server/examples/upgrade/Makefile b/apm-server/examples/upgrade/Makefile index 02ea4dbcb..fa16a4d48 100644 --- a/apm-server/examples/upgrade/Makefile +++ b/apm-server/examples/upgrade/Makefile @@ -8,6 +8,7 @@ FROM := 7.6.0 # 7.6.0 is the first release for apm-server install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) + kubectl rollout status deployment $(RELEASE)-apm-server test: install goss diff --git a/elasticsearch/examples/config/Makefile b/elasticsearch/examples/config/Makefile index 9eee45df2..9ae9c3788 100644 --- a/elasticsearch/examples/config/Makefile +++ b/elasticsearch/examples/config/Makefile @@ -1,10 +1,12 @@ default: test + include ../../../helpers/examples.mk RELEASE := helm-es-config +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ secrets: kubectl delete secret elastic-config-credentials elastic-config-secret elastic-config-slack elastic-config-custom-path || true diff --git a/elasticsearch/examples/config/test/goss.yaml b/elasticsearch/examples/config/test/goss.yaml index 848701370..51c4907f5 100644 --- a/elasticsearch/examples/config/test/goss.yaml +++ b/elasticsearch/examples/config/test/goss.yaml @@ -3,7 +3,7 @@ http: status: 200 timeout: 2000 body: - - 'green' + - "green" - '"number_of_nodes":1' - '"number_of_data_nodes":1' @@ -12,8 +12,7 @@ http: timeout: 2000 body: - '"cluster_name" : "config"' - - '"name" : "config-master-0"' - - 'You Know, for Search' + - "You Know, for Search" command: "elasticsearch-keystore list": diff --git a/elasticsearch/examples/default/Makefile b/elasticsearch/examples/default/Makefile index beb90461d..389bf99e3 100644 --- a/elasticsearch/examples/default/Makefile +++ b/elasticsearch/examples/default/Makefile @@ -3,12 +3,10 @@ default: test include ../../../helpers/examples.mk RELEASE := helm-es-default +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=900s --install $(RELEASE) ../../ - -restart: - helm upgrade --set terminationGracePeriod=121 --wait --timeout=900s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test: install goss diff --git a/elasticsearch/examples/default/test/goss.yaml b/elasticsearch/examples/default/test/goss.yaml index f589ead2e..8baca46d3 100644 --- a/elasticsearch/examples/default/test/goss.yaml +++ b/elasticsearch/examples/default/test/goss.yaml @@ -1,13 +1,13 @@ kernel-param: vm.max_map_count: - value: '262144' + value: "262144" http: http://elasticsearch-master:9200/_cluster/health: status: 200 timeout: 2000 body: - - 'green' + - "green" - '"number_of_nodes":3' - '"number_of_data_nodes":3' @@ -17,8 +17,7 @@ http: body: - '"number" : "7.10.0"' - '"cluster_name" : "elasticsearch"' - - '"name" : "elasticsearch-master-0"' - - 'You Know, for Search' + - "You Know, for Search" file: /usr/share/elasticsearch/data: diff --git a/elasticsearch/examples/docker-for-mac/Makefile b/elasticsearch/examples/docker-for-mac/Makefile index 705b08f0b..18fd053d8 100644 --- a/elasticsearch/examples/docker-for-mac/Makefile +++ b/elasticsearch/examples/docker-for-mac/Makefile @@ -1,9 +1,10 @@ default: test RELEASE := helm-es-docker-for-mac +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install helm test $(RELEASE) diff --git a/elasticsearch/examples/kubernetes-kind/Makefile b/elasticsearch/examples/kubernetes-kind/Makefile index 3f6bdead9..9e5602d49 100644 --- a/elasticsearch/examples/kubernetes-kind/Makefile +++ b/elasticsearch/examples/kubernetes-kind/Makefile @@ -1,13 +1,14 @@ default: test RELEASE := helm-es-kind +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ install-local-path: kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml - helm upgrade --wait --timeout=1200s --install --values values-local-path.yaml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values-local-path.yaml $(RELEASE) ../../ test: install helm test $(RELEASE) diff --git a/elasticsearch/examples/microk8s/Makefile b/elasticsearch/examples/microk8s/Makefile index 3ce3ebdef..2d0012d8a 100644 --- a/elasticsearch/examples/microk8s/Makefile +++ b/elasticsearch/examples/microk8s/Makefile @@ -1,9 +1,10 @@ default: test RELEASE := helm-es-microk8s +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install helm test $(RELEASE) diff --git a/elasticsearch/examples/migration/Makefile b/elasticsearch/examples/migration/Makefile index efd4abfc5..020906f92 100644 --- a/elasticsearch/examples/migration/Makefile +++ b/elasticsearch/examples/migration/Makefile @@ -1,10 +1,10 @@ PREFIX := helm-es-migration data: - helm upgrade --wait --timeout=900s --install --values ./data.yml $(PREFIX)-data ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values data.yaml $(PREFIX)-data ../../ master: - helm upgrade --wait --timeout=900s --install --values ./master.yml $(PREFIX)-master ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values master.yaml $(PREFIX)-master ../../ client: - helm upgrade --wait --timeout=900s --install --values ./client.yml $(PREFIX)-client ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values client.yaml $(PREFIX)-client ../../ diff --git a/elasticsearch/examples/migration/README.md b/elasticsearch/examples/migration/README.md index ad02c1ac2..ee7707904 100644 --- a/elasticsearch/examples/migration/README.md +++ b/elasticsearch/examples/migration/README.md @@ -56,7 +56,7 @@ cluster is healthy before continuing: ``` * Deploy new data nodes which will join the existing cluster. Take a look at the -configuration in [data.yml][]: +configuration in [data.yaml][]: ``` make data @@ -102,7 +102,7 @@ nodes as to not lose quorum: ``` * Now deploy a single new master so that we have 3 masters again. See -[master.yml][] for the configuration: +[master.yaml][] for the configuration: ``` make master @@ -114,7 +114,7 @@ nodes as to not lose quorum: kubectl scale statefulsets my-release-elasticsearch-master --replicas=1 ``` -* Edit the masters in [masters.yml][] to 2 and redeploy: +* Edit the masters in [masters.yaml][] to 2 and redeploy: ``` make master @@ -126,7 +126,7 @@ nodes as to not lose quorum: kubectl scale statefulsets my-release-elasticsearch-master --replicas=0 ``` -* Edit the [masters.yml][] to have 3 replicas and remove the +* Edit the [masters.yaml][] to have 3 replicas and remove the `discovery.zen.ping.unicast.hosts` entry from `extraEnvs` then redeploy the masters. This will make sure all 3 masters are running in the new cluster and are pointing at each other for discovery: @@ -160,8 +160,8 @@ client nodes: working correctly you can cleanup leftover resources from your old cluster. [basic license]: https://www.elastic.co/subscriptions -[data.yml]: https://github.com/elastic/helm-charts/blob/7.10/elasticsearch/examples/migration/data.yml -[helm/charts]: https://github.com/helm/charts/tree/master/stable/elasticsearch -[master.yml]: https://github.com/elastic/helm-charts/blob/7.10/elasticsearch/examples/migration/master.yml +[data.yaml]: https://github.com/elastic/helm-charts/blob/7.10/elasticsearch/examples/migration/data.yaml +[helm/charts]: https://github.com/helm/charts/tree/7.10/stable/elasticsearch +[master.yaml]: https://github.com/elastic/helm-charts/blob/7.10/elasticsearch/examples/migration/master.yaml [restoring to a different cluster guide]: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/modules-snapshots.html#_restoring_to_a_different_cluster [rolling upgrades guide]: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/rolling-upgrades.html diff --git a/elasticsearch/examples/migration/client.yml b/elasticsearch/examples/migration/client.yaml similarity index 100% rename from elasticsearch/examples/migration/client.yml rename to elasticsearch/examples/migration/client.yaml diff --git a/elasticsearch/examples/migration/data.yml b/elasticsearch/examples/migration/data.yaml similarity index 100% rename from elasticsearch/examples/migration/data.yml rename to elasticsearch/examples/migration/data.yaml diff --git a/elasticsearch/examples/migration/master.yml b/elasticsearch/examples/migration/master.yaml similarity index 100% rename from elasticsearch/examples/migration/master.yml rename to elasticsearch/examples/migration/master.yaml diff --git a/elasticsearch/examples/minikube/Makefile b/elasticsearch/examples/minikube/Makefile index 09b61f81d..1021d9867 100644 --- a/elasticsearch/examples/minikube/Makefile +++ b/elasticsearch/examples/minikube/Makefile @@ -1,9 +1,10 @@ default: test RELEASE := helm-es-minikube +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install --values values.yaml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install helm test $(RELEASE) diff --git a/elasticsearch/examples/multi/Makefile b/elasticsearch/examples/multi/Makefile index bb3da7267..243e50435 100644 --- a/elasticsearch/examples/multi/Makefile +++ b/elasticsearch/examples/multi/Makefile @@ -4,11 +4,12 @@ include ../../../helpers/examples.mk PREFIX := helm-es-multi RELEASE := helm-es-multi-master +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=900s --install --values ./master.yml $(PREFIX)-master ../../ - helm upgrade --wait --timeout=900s --install --values ./data.yml $(PREFIX)-data ../../ - helm upgrade --wait --timeout=900s --install --values ./client.yml $(PREFIX)-client ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values master.yaml $(PREFIX)-master ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values data.yaml $(PREFIX)-data ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values client.yaml $(PREFIX)-client ../../ test: install goss diff --git a/elasticsearch/examples/multi/README.md b/elasticsearch/examples/multi/README.md index 039d9633f..3cd3c8773 100644 --- a/elasticsearch/examples/multi/README.md +++ b/elasticsearch/examples/multi/README.md @@ -23,7 +23,7 @@ releases: You can also run [goss integration tests][] using `make test` -[client values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/client.yml -[data values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/data.yml +[client values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/client.yaml +[data values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/data.yaml [goss integration tests]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/test/goss.yaml -[master values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/master.yml +[master values]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/multi/master.yaml diff --git a/elasticsearch/examples/multi/client.yml b/elasticsearch/examples/multi/client.yaml similarity index 100% rename from elasticsearch/examples/multi/client.yml rename to elasticsearch/examples/multi/client.yaml diff --git a/elasticsearch/examples/multi/data.yml b/elasticsearch/examples/multi/data.yaml similarity index 100% rename from elasticsearch/examples/multi/data.yml rename to elasticsearch/examples/multi/data.yaml diff --git a/elasticsearch/examples/multi/master.yml b/elasticsearch/examples/multi/master.yaml similarity index 100% rename from elasticsearch/examples/multi/master.yml rename to elasticsearch/examples/multi/master.yaml diff --git a/elasticsearch/examples/openshift/Makefile b/elasticsearch/examples/openshift/Makefile index 653288854..078c33c9d 100644 --- a/elasticsearch/examples/openshift/Makefile +++ b/elasticsearch/examples/openshift/Makefile @@ -1,13 +1,11 @@ default: test + include ../../../helpers/examples.mk RELEASE := elasticsearch -template: - helm template --values ./values.yaml ../../ - install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/elasticsearch/examples/openshift/test/goss.yaml b/elasticsearch/examples/openshift/test/goss.yaml index aec60565f..79e4328e4 100644 --- a/elasticsearch/examples/openshift/test/goss.yaml +++ b/elasticsearch/examples/openshift/test/goss.yaml @@ -3,7 +3,7 @@ http: status: 200 timeout: 2000 body: - - 'green' + - "green" - '"number_of_nodes":3' - '"number_of_data_nodes":3' @@ -13,5 +13,4 @@ http: body: - '"number" : "7.10.0"' - '"cluster_name" : "elasticsearch"' - - '"name" : "elasticsearch-master-0"' - - 'You Know, for Search' + - "You Know, for Search" diff --git a/elasticsearch/examples/oss/Makefile b/elasticsearch/examples/oss/Makefile index e57284176..e7425e74a 100644 --- a/elasticsearch/examples/oss/Makefile +++ b/elasticsearch/examples/oss/Makefile @@ -1,10 +1,12 @@ default: test + include ../../../helpers/examples.mk RELEASE := helm-es-oss +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values ./values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/elasticsearch/examples/oss/test/goss.yaml b/elasticsearch/examples/oss/test/goss.yaml index e4f419f67..26c06dcc6 100644 --- a/elasticsearch/examples/oss/test/goss.yaml +++ b/elasticsearch/examples/oss/test/goss.yaml @@ -13,5 +13,4 @@ http: body: - '"number" : "7.10.0"' - '"cluster_name" : "oss"' - - '"name" : "oss-master-0"' - 'You Know, for Search' diff --git a/elasticsearch/examples/security/Makefile b/elasticsearch/examples/security/Makefile index c92916085..beddbefd5 100644 --- a/elasticsearch/examples/security/Makefile +++ b/elasticsearch/examples/security/Makefile @@ -4,16 +4,17 @@ include ../../../helpers/examples.mk RELEASE := helm-es-security ELASTICSEARCH_IMAGE := docker.elastic.co/elasticsearch/elasticsearch:$(STACK_VERSION) +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=900s --install --values ./security.yml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ + +test: secrets install goss purge: kubectl delete secrets elastic-credentials elastic-certificates elastic-certificate-pem elastic-certificate-crt|| true helm del $(RELEASE) -test: secrets install goss - pull-elasticsearch-image: docker pull $(ELASTICSEARCH_IMAGE) @@ -33,5 +34,5 @@ secrets: kubectl create secret generic elastic-certificates --from-file=elastic-certificates.p12 && \ kubectl create secret generic elastic-certificate-pem --from-file=elastic-certificate.pem && \ kubectl create secret generic elastic-certificate-crt --from-file=elastic-certificate.crt && \ - kubectl create secret generic elastic-credentials --from-literal=password=$$password --from-literal=username=elastic && \ + kubectl create secret generic elastic-credentials --from-literal=password=$$password --from-literal=username=elastic && \ rm -f elastic-certificates.p12 elastic-certificate.pem elastic-certificate.crt elastic-stack-ca.p12 diff --git a/elasticsearch/examples/security/test/goss.yaml b/elasticsearch/examples/security/test/goss.yaml index c6d4b987b..6bb224324 100644 --- a/elasticsearch/examples/security/test/goss.yaml +++ b/elasticsearch/examples/security/test/goss.yaml @@ -3,10 +3,10 @@ http: status: 200 timeout: 2000 allow-insecure: true - username: '{{ .Env.ELASTIC_USERNAME }}' - password: '{{ .Env.ELASTIC_PASSWORD }}' + username: "{{ .Env.ELASTIC_USERNAME }}" + password: "{{ .Env.ELASTIC_PASSWORD }}" body: - - 'green' + - "green" - '"number_of_nodes":3' - '"number_of_data_nodes":3' @@ -14,32 +14,31 @@ http: status: 200 timeout: 2000 allow-insecure: true - username: '{{ .Env.ELASTIC_USERNAME }}' - password: '{{ .Env.ELASTIC_PASSWORD }}' + username: "{{ .Env.ELASTIC_USERNAME }}" + password: "{{ .Env.ELASTIC_PASSWORD }}" body: - '"cluster_name" : "security"' - - '"name" : "security-master-0"' - - 'You Know, for Search' + - "You Know, for Search" https://localhost:9200/_xpack/license: status: 200 timeout: 2000 allow-insecure: true - username: '{{ .Env.ELASTIC_USERNAME }}' - password: '{{ .Env.ELASTIC_PASSWORD }}' + username: "{{ .Env.ELASTIC_USERNAME }}" + password: "{{ .Env.ELASTIC_PASSWORD }}" body: - - 'active' - - 'basic' + - "active" + - "basic" file: /usr/share/elasticsearch/config/elasticsearch.yml: exists: true contains: - - 'xpack.security.enabled: true' - - 'xpack.security.transport.ssl.enabled: true' - - 'xpack.security.transport.ssl.verification_mode: certificate' - - 'xpack.security.transport.ssl.keystore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12' - - 'xpack.security.transport.ssl.truststore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12' - - 'xpack.security.http.ssl.enabled: true' - - 'xpack.security.http.ssl.truststore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12' - - 'xpack.security.http.ssl.keystore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12' + - "xpack.security.enabled: true" + - "xpack.security.transport.ssl.enabled: true" + - "xpack.security.transport.ssl.verification_mode: certificate" + - "xpack.security.transport.ssl.keystore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12" + - "xpack.security.transport.ssl.truststore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12" + - "xpack.security.http.ssl.enabled: true" + - "xpack.security.http.ssl.truststore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12" + - "xpack.security.http.ssl.keystore.path: /usr/share/elasticsearch/config/certs/elastic-certificates.p12" diff --git a/elasticsearch/examples/security/security.yml b/elasticsearch/examples/security/values.yaml similarity index 100% rename from elasticsearch/examples/security/security.yml rename to elasticsearch/examples/security/values.yaml diff --git a/elasticsearch/examples/upgrade/Makefile b/elasticsearch/examples/upgrade/Makefile index da2cd541a..813e050e1 100644 --- a/elasticsearch/examples/upgrade/Makefile +++ b/elasticsearch/examples/upgrade/Makefile @@ -8,6 +8,7 @@ FROM := 7.4.0 # versions before 7.4.O aren't compatible with Kubernetes >= 1.16. install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) + kubectl rollout status statefulset elasticsearch-master test: install goss diff --git a/elasticsearch/examples/upgrade/test/goss.yaml b/elasticsearch/examples/upgrade/test/goss.yaml index fbb261f42..5887b5f43 100644 --- a/elasticsearch/examples/upgrade/test/goss.yaml +++ b/elasticsearch/examples/upgrade/test/goss.yaml @@ -13,5 +13,4 @@ http: body: - '"number" : "7.10.0"' - '"cluster_name" : "upgrade"' - - '"name" : "upgrade-master-0"' - "You Know, for Search" diff --git a/filebeat/examples/default/Makefile b/filebeat/examples/default/Makefile index e27affffc..b39ece967 100644 --- a/filebeat/examples/default/Makefile +++ b/filebeat/examples/default/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-filebeat-default install: - helm upgrade --wait --timeout=900s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test: install goss diff --git a/filebeat/examples/oss/Makefile b/filebeat/examples/oss/Makefile index 455c2e63a..3caa17af1 100644 --- a/filebeat/examples/oss/Makefile +++ b/filebeat/examples/oss/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-filebeat-oss install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/filebeat/examples/security/Makefile b/filebeat/examples/security/Makefile index 50c0b5bed..7bec9abec 100644 --- a/filebeat/examples/security/Makefile +++ b/filebeat/examples/security/Makefile @@ -5,7 +5,7 @@ include ../../../helpers/examples.mk RELEASE := helm-filebeat-security install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/filebeat/examples/upgrade/Makefile b/filebeat/examples/upgrade/Makefile index 252b39250..054b53c23 100644 --- a/filebeat/examples/upgrade/Makefile +++ b/filebeat/examples/upgrade/Makefile @@ -8,6 +8,7 @@ FROM := 7.9.0 # registry file version 1 not supported error with previous versio install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) + kubectl rollout status daemonset $(RELEASE)-filebeat test: install goss diff --git a/helpers/examples.mk b/helpers/examples.mk index d54688ab8..dce0ce489 100644 --- a/helpers/examples.mk +++ b/helpers/examples.mk @@ -2,6 +2,7 @@ GOSS_VERSION := v0.3.6 GOSS_FILE ?= goss.yaml GOSS_SELECTOR ?= release=$(RELEASE) STACK_VERSION := 7.10.0 +TIMEOUT := 900s .PHONY: help help: ## Display this help @@ -9,7 +10,7 @@ help: ## Display this help .PHONY: goss goss: ## Run goss tests - GOSS_CONTAINER=$$(kubectl get --no-headers=true pods -l $(GOSS_SELECTOR) -o custom-columns=:metadata.name | sed -n 1p ) && \ + GOSS_CONTAINER=$$(kubectl get --no-headers=true pods -l $(GOSS_SELECTOR) -o custom-columns=:metadata.name --field-selector=status.phase=Running --sort-by=.metadata.creationTimestamp | tail -1 ) && \ echo Testing with pod: $$GOSS_CONTAINER && \ kubectl cp test/$(GOSS_FILE) $$GOSS_CONTAINER:/tmp/$(GOSS_FILE) && \ kubectl exec $$GOSS_CONTAINER -- sh -c "cd /tmp/ && curl -s -L https://github.com/aelsabbahy/goss/releases/download/$(GOSS_VERSION)/goss-linux-amd64 -o goss && chmod +rx ./goss && ./goss --gossfile $(GOSS_FILE) validate --retry-timeout 300s --sleep 5s --color --format documentation" diff --git a/kibana/examples/default/Makefile b/kibana/examples/default/Makefile index 4c6a6e6d8..d181571fa 100644 --- a/kibana/examples/default/Makefile +++ b/kibana/examples/default/Makefile @@ -1,11 +1,11 @@ default: test + include ../../../helpers/examples.mk RELEASE := helm-kibana-default install: - echo "Goss container: $(GOSS_CONTAINER)" - helm upgrade --wait --timeout=900s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test: install goss diff --git a/kibana/examples/openshift/Makefile b/kibana/examples/openshift/Makefile index 8435ba2fe..35b66d02b 100644 --- a/kibana/examples/openshift/Makefile +++ b/kibana/examples/openshift/Makefile @@ -4,10 +4,10 @@ include ../../../helpers/examples.mk RELEASE := kibana template: - helm template --values ./values.yml ../../ + helm template --values values.yaml ../../ install: - helm upgrade --wait --timeout=900s --install --values ./values.yml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/kibana/examples/oss/Makefile b/kibana/examples/oss/Makefile index cbda8764d..c4804946a 100644 --- a/kibana/examples/oss/Makefile +++ b/kibana/examples/oss/Makefile @@ -1,10 +1,11 @@ default: test + include ../../../helpers/examples.mk RELEASE := helm-kibana-oss install: - helm upgrade --wait --timeout=900s --install --values ./values.yml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/kibana/examples/oss/values.yml b/kibana/examples/oss/values.yaml similarity index 100% rename from kibana/examples/oss/values.yml rename to kibana/examples/oss/values.yaml diff --git a/kibana/examples/security/Makefile b/kibana/examples/security/Makefile index 2fa8607e6..034c8c5cc 100644 --- a/kibana/examples/security/Makefile +++ b/kibana/examples/security/Makefile @@ -1,10 +1,11 @@ default: test + include ../../../helpers/examples.mk RELEASE := helm-kibana-security install: - helm upgrade --wait --timeout=900s --install --values ./security.yml $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: secrets install goss diff --git a/kibana/examples/security/README.md b/kibana/examples/security/README.md index 2655c93f3..239a1e530 100644 --- a/kibana/examples/security/README.md +++ b/kibana/examples/security/README.md @@ -25,4 +25,4 @@ You can also run [goss integration tests][] using `make test` [elasticsearch helm chart]: https://github.com/elastic/helm-charts/tree/7.10/elasticsearch/examples/security/ [goss integration tests]: https://github.com/elastic/helm-charts/tree/7.10/kibana/examples/security/test/goss.yaml -[values]: https://github.com/elastic/helm-charts/tree/7.10/kibana/examples/security/security.yml +[values]: https://github.com/elastic/helm-charts/tree/7.10/kibana/examples/security/values.yaml diff --git a/kibana/examples/security/security.yml b/kibana/examples/security/values.yaml similarity index 100% rename from kibana/examples/security/security.yml rename to kibana/examples/security/values.yaml diff --git a/kibana/examples/upgrade/Makefile b/kibana/examples/upgrade/Makefile index 6fcb2103e..988c56c00 100644 --- a/kibana/examples/upgrade/Makefile +++ b/kibana/examples/upgrade/Makefile @@ -9,6 +9,7 @@ TO := 7.10.0 # required to use with Elasticsearch 7.10.0 install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) --to $(TO) + kubectl rollout status deployment $(RELEASE)-kibana test: install goss diff --git a/logstash/examples/default/Makefile b/logstash/examples/default/Makefile index 4c5920df5..03d77f816 100644 --- a/logstash/examples/default/Makefile +++ b/logstash/examples/default/Makefile @@ -3,12 +3,10 @@ default: test include ../../../helpers/examples.mk RELEASE := helm-logstash-default +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install $(RELEASE) ../../ - -restart: - helm upgrade --set terminationGracePeriod=121 --wait --timeout=1200s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test: install goss diff --git a/logstash/examples/default/test/goss.yaml b/logstash/examples/default/test/goss.yaml index 79118426c..dfd3b2b5e 100644 --- a/logstash/examples/default/test/goss.yaml +++ b/logstash/examples/default/test/goss.yaml @@ -9,10 +9,8 @@ http: status: 200 timeout: 2000 body: - - '"host" : "helm-logstash-default-logstash-0"' - '"version" : "7.10.0"' - '"http_address" : "0.0.0.0:9600"' - - '"name" : "helm-logstash-default-logstash-0"' - '"status" : "green"' - '"workers" : 1' - '"batch_size" : 125' @@ -35,9 +33,9 @@ file: group: root filetype: file contains: - - 'input {' - - 'beats {' - - 'port => 5044' - - 'output {' - - 'stdout {' - - 'codec => rubydebug' + - "input {" + - "beats {" + - "port => 5044" + - "output {" + - "stdout {" + - "codec => rubydebug" diff --git a/logstash/examples/elasticsearch/Makefile b/logstash/examples/elasticsearch/Makefile index b11f714e3..6b914df90 100644 --- a/logstash/examples/elasticsearch/Makefile +++ b/logstash/examples/elasticsearch/Makefile @@ -3,12 +3,10 @@ default: test include ../../../helpers/examples.mk RELEASE := helm-logstash-elasticsearch +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install $(RELEASE) --values ./values.yaml ../../ - -restart: - helm upgrade --set terminationGracePeriod=121 --wait --timeout=1200s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/logstash/examples/elasticsearch/test/goss.yaml b/logstash/examples/elasticsearch/test/goss.yaml index 3cbef9c83..254fb2d4d 100644 --- a/logstash/examples/elasticsearch/test/goss.yaml +++ b/logstash/examples/elasticsearch/test/goss.yaml @@ -21,10 +21,8 @@ http: status: 200 timeout: 2000 body: - - '"host" : "helm-logstash-elasticsearch-logstash-0"' - '"version" : "7.10.0"' - '"http_address" : "0.0.0.0:9600"' - - '"name" : "helm-logstash-elasticsearch-logstash-0"' - '"status" : "green"' - '"workers" : 1' - '"batch_size" : 125' @@ -33,7 +31,7 @@ http: status: 200 timeout: 2000 body: - - 'logstash' + - "logstash" file: /usr/share/logstash/config/logstash.yml: @@ -43,8 +41,8 @@ file: group: logstash filetype: file contains: - - 'http.host: 0.0.0.0' - - 'xpack.monitoring.enabled: false' + - "http.host: 0.0.0.0" + - "xpack.monitoring.enabled: false" /usr/share/logstash/pipeline/uptime.conf: exists: true mode: "0644" diff --git a/logstash/examples/oss/Makefile b/logstash/examples/oss/Makefile index 81c83f702..8f96d8286 100644 --- a/logstash/examples/oss/Makefile +++ b/logstash/examples/oss/Makefile @@ -3,12 +3,10 @@ default: test include ../../../helpers/examples.mk RELEASE := helm-logstash-oss +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install $(RELEASE) --values ./values.yaml ../../ - -restart: - helm upgrade --set terminationGracePeriod=121 --wait --timeout=1200s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/logstash/examples/oss/test/goss.yaml b/logstash/examples/oss/test/goss.yaml index b80245b8a..a0403fd4f 100644 --- a/logstash/examples/oss/test/goss.yaml +++ b/logstash/examples/oss/test/goss.yaml @@ -9,10 +9,8 @@ http: status: 200 timeout: 2000 body: - - '"host" : "helm-logstash-oss-logstash-0"' - '"version" : "7.10.0"' - '"http_address" : "0.0.0.0:9600"' - - '"name" : "helm-logstash-oss-logstash-0"' - '"status" : "green"' - '"workers" : 1' - '"batch_size" : 125' @@ -34,9 +32,9 @@ file: group: root filetype: file contains: - - 'input {' - - 'beats {' - - 'port => 5044' - - 'output {' - - 'stdout {' - - 'codec => rubydebug' + - "input {" + - "beats {" + - "port => 5044" + - "output {" + - "stdout {" + - "codec => rubydebug" diff --git a/logstash/examples/security/Makefile b/logstash/examples/security/Makefile index ef8ebf13e..d5bfcb2f8 100644 --- a/logstash/examples/security/Makefile +++ b/logstash/examples/security/Makefile @@ -3,9 +3,10 @@ default: test include ../../../helpers/examples.mk RELEASE := helm-logstash-security +TIMEOUT := 1200s install: - helm upgrade --wait --timeout=1200s --install $(RELEASE) --values values.yaml ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test: install goss diff --git a/logstash/examples/security/test/goss.yaml b/logstash/examples/security/test/goss.yaml index ea89b1b22..997236406 100644 --- a/logstash/examples/security/test/goss.yaml +++ b/logstash/examples/security/test/goss.yaml @@ -21,10 +21,8 @@ http: status: 200 timeout: 2000 body: - - '"host" : "helm-logstash-security-logstash-0"' - '"version" : "7.10.0"' - '"http_address" : "0.0.0.0:9600"' - - '"name" : "helm-logstash-security-logstash-0"' - '"status" : "green"' - '"workers" : 1' - '"batch_size" : 125' @@ -33,10 +31,10 @@ http: status: 200 timeout: 2000 body: - - 'logstash' + - "logstash" allow-insecure: true - username: '{{ .Env.ELASTICSEARCH_USERNAME }}' - password: '{{ .Env.ELASTICSEARCH_PASSWORD }}' + username: "{{ .Env.ELASTICSEARCH_USERNAME }}" + password: "{{ .Env.ELASTICSEARCH_PASSWORD }}" file: /usr/share/logstash/config/logstash.yml: @@ -46,10 +44,10 @@ file: group: logstash filetype: file contains: - - 'http.host: 0.0.0.0' - - 'xpack.monitoring.enabled: true' + - "http.host: 0.0.0.0" + - "xpack.monitoring.enabled: true" - 'xpack.monitoring.elasticsearch.hosts: ["https://security-master:9200"]' - - 'xpack.monitoring.elasticsearch.ssl.certificate_authority: /usr/share/logstash/config/certs/elastic-certificate.crt' + - "xpack.monitoring.elasticsearch.ssl.certificate_authority: /usr/share/logstash/config/certs/elastic-certificate.crt" /usr/share/logstash/pipeline/uptime.conf: exists: true mode: "0644" @@ -58,7 +56,7 @@ file: filetype: file contains: - 'input { exec { command => "uptime" interval => 30 } }' - - 'output { elasticsearch {' + - "output { elasticsearch {" - 'hosts => ["https://security-master:9200"]' - 'cacert => "/usr/share/logstash/config/certs/elastic-certificate.crt"' - 'index => "logstash"' diff --git a/logstash/examples/upgrade/Makefile b/logstash/examples/upgrade/Makefile index db739a141..e5ee63671 100644 --- a/logstash/examples/upgrade/Makefile +++ b/logstash/examples/upgrade/Makefile @@ -8,6 +8,7 @@ FROM := 7.9.0 # upgrade from version < 7.9.0 is failing due to headless service install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) + kubectl rollout status statefulset $(RELEASE)-logstash test: install goss diff --git a/logstash/examples/upgrade/test/goss.yaml b/logstash/examples/upgrade/test/goss.yaml index 71e7b508a..dfd3b2b5e 100644 --- a/logstash/examples/upgrade/test/goss.yaml +++ b/logstash/examples/upgrade/test/goss.yaml @@ -9,10 +9,8 @@ http: status: 200 timeout: 2000 body: - - '"host" : "helm-logstash-upgrade-logstash-0"' - '"version" : "7.10.0"' - '"http_address" : "0.0.0.0:9600"' - - '"name" : "helm-logstash-upgrade-logstash-0"' - '"status" : "green"' - '"workers" : 1' - '"batch_size" : 125' diff --git a/metricbeat/examples/default/Makefile b/metricbeat/examples/default/Makefile index 6ff5a30e7..bcd4fb77b 100644 --- a/metricbeat/examples/default/Makefile +++ b/metricbeat/examples/default/Makefile @@ -6,7 +6,7 @@ RELEASE = helm-metricbeat-default GOSS_SELECTOR = release=$(RELEASE),app=helm-metricbeat-default-metricbeat install: - helm upgrade --wait --timeout=900s --install $(RELEASE) ../../ + helm upgrade --wait --timeout=$(TIMEOUT) --install $(RELEASE) ../../ test-metrics: GOSS_FILE=goss-metrics.yaml make goss GOSS_SELECTOR=release=$(RELEASE),app=helm-metricbeat-default-metricbeat-metrics diff --git a/metricbeat/examples/oss/Makefile b/metricbeat/examples/oss/Makefile index acb1124bc..534201044 100644 --- a/metricbeat/examples/oss/Makefile +++ b/metricbeat/examples/oss/Makefile @@ -6,12 +6,12 @@ RELEASE := helm-metricbeat-oss GOSS_SELECTOR = release=$(RELEASE),app=helm-metricbeat-oss-metricbeat install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ - -purge: - helm del $(RELEASE) + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test-metrics: GOSS_FILE=goss-metrics.yaml make goss GOSS_SELECTOR=release=$(RELEASE),app=helm-metricbeat-oss-metricbeat-metrics test: install goss test-metrics + +purge: + helm del $(RELEASE) diff --git a/metricbeat/examples/security/Makefile b/metricbeat/examples/security/Makefile index d57cb05be..2433d8e95 100644 --- a/metricbeat/examples/security/Makefile +++ b/metricbeat/examples/security/Makefile @@ -6,12 +6,12 @@ RELEASE := helm-metricbeat-security GOSS_SELECTOR = release=$(RELEASE),app=helm-metricbeat-security-metricbeat install: - helm upgrade --wait --timeout=900s --install $(RELEASE) --values values.yaml ../../ - -purge: - helm del $(RELEASE) + helm upgrade --wait --timeout=$(TIMEOUT) --install --values values.yaml $(RELEASE) ../../ test-metrics: GOSS_FILE=goss-metrics.yaml make goss GOSS_SELECTOR=release=$(RELEASE),app=helm-metricbeat-security-metricbeat-metrics test: install goss test-metrics + +purge: + helm del $(RELEASE) diff --git a/metricbeat/examples/upgrade/Makefile b/metricbeat/examples/upgrade/Makefile index d2d8d8509..7d32e41dc 100644 --- a/metricbeat/examples/upgrade/Makefile +++ b/metricbeat/examples/upgrade/Makefile @@ -9,6 +9,9 @@ RELEASE := helm-metricbeat-upgrade install: ../../../helpers/upgrade.sh --chart $(CHART) --release $(RELEASE) --from $(FROM) + kubectl rollout status daemonset $(RELEASE)-metricbeat + kubectl rollout status deployment $(RELEASE)-metricbeat-metrics + kubectl rollout status deployment $(RELEASE)-kube-state-metrics #TODO: uncomment after 7.10.0 release test: #install goss