From ee658f454941b67d1ae077fcf7cf6094b7b0bb20 Mon Sep 17 00:00:00 2001 From: Bartosz Bezak Date: Fri, 27 Jan 2023 15:11:34 +0100 Subject: [PATCH] remove elasticsearch remnants in antelope cycle Change-Id: I115b491eca413437926f5bcaf53336151f9a7c0b --- ansible/inventory/all-in-one | 4 - ansible/inventory/multinode | 4 - ansible/roles/opensearch/tasks/precheck.yml | 2 - ansible/roles/opensearch/tasks/upgrade.yml | 53 ------ tests/run.yml | 12 -- tests/templates/inventory.j2 | 14 -- tests/test-prometheus-efk.sh | 189 -------------------- tools/cleanup-host | 5 - 8 files changed, 283 deletions(-) delete mode 100644 tests/test-prometheus-efk.sh diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index a720a7d069..005054d813 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -230,10 +230,6 @@ common [opensearch:children] control -# TODO: This is used for cleanup and can be removed in the Antelope cycle. -[elasticsearch-curator:children] -opensearch - # Opensearch dashboards [opensearch-dashboards:children] opensearch diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index b8479c6ae7..4ca2274285 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -248,10 +248,6 @@ common [opensearch:children] control -# TODO: This is used for cleanup and can be removed in the Antelope cycle. -[elasticsearch-curator:children] -opensearch - # Opensearch dashboards [opensearch-dashboards:children] opensearch diff --git a/ansible/roles/opensearch/tasks/precheck.yml b/ansible/roles/opensearch/tasks/precheck.yml index 997c030dda..835316f09e 100644 --- a/ansible/roles/opensearch/tasks/precheck.yml +++ b/ansible/roles/opensearch/tasks/precheck.yml @@ -11,7 +11,6 @@ container_engine: "{{ kolla_container_engine }}" name: - opensearch - - elasticsearch check_mode: false register: container_facts @@ -23,6 +22,5 @@ timeout: 1 state: stopped when: - - container_facts['elasticsearch'] is not defined - container_facts['opensearch'] is not defined - inventory_hostname in groups['opensearch'] diff --git a/ansible/roles/opensearch/tasks/upgrade.yml b/ansible/roles/opensearch/tasks/upgrade.yml index f0b8f78cf0..2891b64e08 100644 --- a/ansible/roles/opensearch/tasks/upgrade.yml +++ b/ansible/roles/opensearch/tasks/upgrade.yml @@ -1,8 +1,4 @@ --- -# NOTE: The following tasks assume that the same hosts are used for -# OpenSearch as were for ElasticSearch / Kibana, and that the -# OpenSearch endpoint remains the same as ElasticSearch. - - name: Disable shard allocation become: true vars: @@ -38,55 +34,6 @@ register: result until: ('status' in result) and result.status == 200 -- name: Stop and remove ElasticSearch - become: true - kolla_docker: - action: "stop_and_remove_container" - name: "elasticsearch" - when: - - inventory_hostname in groups['opensearch'] - -- name: Stop and remove ElasticSearch Curator - become: true - kolla_docker: - action: "stop_and_remove_container" - name: "elasticsearch_curator" - when: - - inventory_hostname in groups['elasticsearch-curator'] - -- name: Stop and remove Kibana - become: true - kolla_docker: - action: "stop_and_remove_container" - name: "kibana" - when: - - inventory_hostname in groups['opensearch-dashboards'] - -- name: Delete ElasticSearch load-balancer config - file: - path: "{{ node_config_directory }}/haproxy/services.d/elasticsearch.cfg" - state: "absent" - become: true - when: - - inventory_hostname in groups['loadbalancer'] - -- name: Delete Kibana load-balancer config - file: - path: "{{ node_config_directory }}/haproxy/services.d/kibana.cfg" - state: "absent" - become: true - when: - - inventory_hostname in groups['loadbalancer'] - -# TODO: Use the volume name from defaults.yml -- name: Create OpenSearch Docker volume - become: true - command: "docker volume create opensearch" - -- name: Migrate ElasticSearch data to OpenSearch - become: true - command: "mv /var/lib/docker/volumes/elasticsearch/_data/nodes /var/lib/docker/volumes/opensearch/_data/" - - import_tasks: config-host.yml - import_tasks: config.yml diff --git a/tests/run.yml b/tests/run.yml index b30d13a414..fb9b83042c 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -509,17 +509,6 @@ environment: KOLLA_ANSIBLE_VENV_PATH: "{{ kolla_ansible_venv_path }}" - - name: Run test-prometheus-efk.sh script - script: - cmd: test-prometheus-efk.sh - executable: /bin/bash - chdir: "{{ kolla_ansible_src_dir }}" - environment: - TLS_ENABLED: "{{ tls_enabled }}" - when: - - is_upgrade - - scenario == "prometheus-opensearch" - - name: Run test-prometheus-opensearch.sh script script: cmd: test-prometheus-opensearch.sh @@ -528,7 +517,6 @@ environment: TLS_ENABLED: "{{ tls_enabled }}" when: - - not is_upgrade - scenario == "prometheus-opensearch" - name: Run test-venus.sh script diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2 index bd12a267af..ae8c54993d 100644 --- a/tests/templates/inventory.j2 +++ b/tests/templates/inventory.j2 @@ -116,11 +116,6 @@ monitoring network storage -{% if is_upgrade %} -[elasticsearch:children] -control -{% endif %} - # NOTE(yoctozepto): Until we are able to isolate network namespaces in k-a, # we are forced to separate Pacemaker remotes from full members. # This is not as bad as it sounds, because it would be enforced in @@ -286,11 +281,6 @@ common [kolla-toolbox:children] common -{% if is_upgrade %} -[elasticsearch-curator:children] -elasticsearch -{% endif %} - [opensearch:children] control @@ -704,11 +694,7 @@ monitoring monitoring [prometheus-elasticsearch-exporter:children] -{% if is_upgrade %} -elasticsearch -{% else %} opensearch -{% endif %} [prometheus-blackbox-exporter:children] monitoring diff --git a/tests/test-prometheus-efk.sh b/tests/test-prometheus-efk.sh deleted file mode 100644 index 436b2b8d5a..0000000000 --- a/tests/test-prometheus-efk.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash - -set -o xtrace -set -o errexit -set -o pipefail - -# Enable unbuffered output -export PYTHONUNBUFFERED=1 - -function check_kibana { - # Perform and validate a basic status page check - KIBANA_URL=${OS_AUTH_URL%:*}:5601/api/status - output_path=$1 - kibana_password=$(awk '$1 == "kibana_password:" { print $2 }' /etc/kolla/passwords.yml) - args=( - --include - --location - --fail - --user - kibana:$kibana_password - ) - if [[ "$TLS_ENABLED" = "True" ]]; then - args+=(--cacert $OS_CACERT) - fi - if ! curl "${args[@]}" $KIBANA_URL > $output_path; then - return 1 - fi - if ! grep 'Looking good' $output_path >/dev/null; then - return 1 - fi -} - -function check_elasticsearch { - # Verify that we see a healthy index created due to Fluentd forwarding logs - ELASTICSEARCH_URL=${OS_AUTH_URL%:*}:9200/_cluster/health - output_path=$1 - args=( - --include - --location - --fail - ) - if [[ "$TLS_ENABLED" = "True" ]]; then - args+=(--cacert $OS_CACERT) - fi - if ! curl "${args[@]}" $ELASTICSEARCH_URL > $output_path; then - return 1 - fi - # NOTE(mgoddard): Status may be yellow because no indices have been - # created. - if ! grep -E '"status":"(green|yellow)"' $output_path >/dev/null; then - return 1 - fi -} - -function check_grafana { - # Query grafana, and check that the returned page looks like a grafana page. - GRAFANA_URL=${OS_AUTH_URL%:*}:3000 - output_path=$1 - grafana_password=$(awk '$1 == "grafana_admin_password:" { print $2 }' /etc/kolla/passwords.yml) - args=( - --include - --location - --fail - --user - admin:$grafana_password - ) - if [[ "$TLS_ENABLED" = "True" ]]; then - args+=(--cacert $OS_CACERT) - fi - if ! curl "${args[@]}" $GRAFANA_URL > $output_path; then - return 1 - fi - if ! grep 'Grafana' $output_path >/dev/null; then - return 1 - fi -} - -function check_prometheus { - # Query prometheus graph, and check that the returned page looks like a - # prometheus page. - PROMETHEUS_URL=${OS_AUTH_URL%:*}:9091/graph - output_path=$1 - args=( - --include - --location - --fail - ) - if [[ "$TLS_ENABLED" = "True" ]]; then - args+=(--cacert $OS_CACERT) - fi - if ! curl "${args[@]}" $PROMETHEUS_URL > $output_path; then - return 1 - fi - if ! grep 'Prometheus' $output_path >/dev/null; then - return 1 - fi -} - -function test_kibana { - echo "TESTING: Kibana" - output_path=$(mktemp) - attempt=1 - while ! check_kibana $output_path; do - echo "Kibana not accessible yet" - attempt=$((attempt+1)) - if [[ $attempt -eq 12 ]]; then - echo "FAILED: Kibana did not become accessible. Response:" - cat $output_path - return 1 - fi - sleep 10 - done - echo "SUCCESS: Kibana" -} - -function test_elasticsearch { - echo "TESTING: Elasticsearch" - output_path=$(mktemp) - attempt=1 - while ! check_elasticsearch $output_path; do - echo "Elasticsearch not accessible yet" - attempt=$((attempt+1)) - if [[ $attempt -eq 12 ]]; then - echo "FAILED: Elasticsearch did not become accessible. Response:" - cat $output_path - return 1 - fi - sleep 10 - done - echo "SUCCESS: Elasticsearch" -} - -function test_grafana { - echo "TESTING: Grafana" - output_path=$(mktemp) - attempt=1 - while ! check_grafana $output_path; do - echo "Grafana not accessible yet" - attempt=$((attempt+1)) - if [[ $attempt -eq 12 ]]; then - echo "FAILED: Grafana did not become accessible. Response:" - cat $output_path - return 1 - fi - sleep 10 - done - echo "SUCCESS: Grafana" -} - -function test_prometheus { - # TODO(mgoddard): Query metrics. - echo "TESTING: Prometheus" - output_path=$(mktemp) - attempt=1 - while ! check_prometheus $output_path; do - echo "Prometheus not accessible yet" - attempt=$((attempt+1)) - if [[ $attempt -eq 12 ]]; then - echo "FAILED: Prometheus did not become accessible. Response:" - cat $output_path - return 1 - fi - sleep 10 - done - echo "SUCCESS: Prometheus" -} - -function test_prometheus_efk_logged { - . /etc/kolla/admin-openrc.sh - - test_kibana - test_elasticsearch - test_grafana - test_prometheus -} - -function test_prometheus_efk { - echo "Testing prometheus and EFK" - test_prometheus_efk_logged > /tmp/logs/ansible/test-prometheus-efk 2>&1 - result=$? - if [[ $result != 0 ]]; then - echo "Testing prometheus and EFK failed. See ansible/test-prometheus-efk for details" - else - echo "Successfully tested prometheus and EFK. See ansible/test-prometheus-efk for details" - fi - return $result -} - -test_prometheus_efk diff --git a/tools/cleanup-host b/tools/cleanup-host index 750fbfffdd..f6361d8559 100755 --- a/tools/cleanup-host +++ b/tools/cleanup-host @@ -53,11 +53,6 @@ if [[ "$nova_instance_datadir_volume" != "nova_compute" && -d "$nova_instance_da rm -rfv $nova_instance_datadir_volume fi -if [[ "$elasticsearch_datadir_volume" != "elasticsearch" && -d "$elasticsearch_datadir_volume" ]]; then - echo "Removing elasticsearch volume if it is customzied" - rm -rfv $elasticsearch_datadir_volume -fi - if [[ "$gnocchi_metric_datadir_volume" != "gnocchi" && -d "$gnocchi_metric_datadir_volume" ]]; then echo "Removing gnocchi volume if it is customzied" rm -rfv $gnocchi_metric_datadir_volume