[CI] Add Venus scenario

Venus is a new service for log processing.
This patch adds a CI scenario which tests Venus deployment.

Depends-On: https://review.opendev.org/c/openstack/kolla/+/793795
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/793897
Co-Authored-By: jinyuanliu <liujinyuan@inspur.com>
Change-Id: I0c7ba9e1ae23623b690a213c91ab3a12524d73f8
This commit is contained in:
Radosław Piliszek 2022-01-01 10:44:48 +00:00
parent 0950b464f0
commit 74ec1fab2a
7 changed files with 140 additions and 1 deletions

View File

@ -10,7 +10,7 @@
- name: set facts for commonly used variables - name: set facts for commonly used variables
vars: vars:
# NOTE(yoctozepto): needed here to use in other facts too # NOTE(yoctozepto): needed here to use in other facts too
openstack_core_enabled: "{{ scenario not in ['bifrost', 'mariadb', 'prometheus-efk', 'monasca'] }}" openstack_core_enabled: "{{ scenario not in ['bifrost', 'mariadb', 'prometheus-efk', 'monasca', 'venus'] }}"
set_fact: set_fact:
kolla_inventory_path: "/etc/kolla/inventory" kolla_inventory_path: "/etc/kolla/inventory"
logs_dir: "/tmp/logs" logs_dir: "/tmp/logs"
@ -469,6 +469,13 @@
chdir: "{{ kolla_ansible_src_dir }}" chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "prometheus-efk" when: scenario == "prometheus-efk"
- name: Run test-venus.sh script
script:
cmd: test-venus.sh
executable: /bin/bash
chdir: "{{ kolla_ansible_src_dir }}"
when: scenario == "venus"
when: scenario != "bifrost" when: scenario != "bifrost"
# NOTE(yoctozepto): each host checks itself # NOTE(yoctozepto): each host checks itself

View File

@ -101,6 +101,11 @@ function prepare_images {
# FIXME(mgoddard): No need for OpenStack core images. # FIXME(mgoddard): No need for OpenStack core images.
GATE_IMAGES+=",^elasticsearch,^grafana,^influxdb,^kafka,^kibana,^logstash,^monasca,^storm,^zookeeper" GATE_IMAGES+=",^elasticsearch,^grafana,^influxdb,^kafka,^kibana,^logstash,^monasca,^storm,^zookeeper"
fi fi
if [[ $SCENARIO == "venus" ]]; then
GATE_IMAGES="^cron,^elasticsearch,^fluentd,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^rabbitmq,^venus"
fi
sudo tee -a /etc/kolla/kolla-build.conf <<EOF sudo tee -a /etc/kolla/kolla-build.conf <<EOF
[profiles] [profiles]
gate = ${GATE_IMAGES} gate = ${GATE_IMAGES}

View File

@ -193,3 +193,8 @@ octavia_amp_flavor:
octavia_network_type: "tenant" octavia_network_type: "tenant"
{% endif %} {% endif %}
{% if scenario == "venus" %}
enable_elasticsearch: "yes"
enable_keystone: "yes"
enable_venus: "yes"
{% endif %}

94
tests/test-venus.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
set -o xtrace
set -o errexit
set -o pipefail
# Enable unbuffered output
export PYTHONUNBUFFERED=1
# TODO(yoctozepto): Avoid duplicating this from prometheus-efk
function check_elasticsearch {
# Verify that we see a healthy index created due to Fluentd forwarding logs
local es_url=${OS_AUTH_URL%:*}:9200/_cluster/health
output_path=$1
args=(
--include
--location
--fail
)
if ! curl "${args[@]}" $es_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_venus {
local venus_url=${OS_AUTH_URL%:*}:10010/custom_config
output_path=$1
if ! curl --include --fail $venus_url > $output_path; then
return 1
fi
if ! grep -E '"status": "SUPPORTED"' $output_path >/dev/null; then
return 1
fi
}
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_venus {
echo "TESTING: Venus"
output_path=$(mktemp)
attempt=1
while ! check_venus $output_path; do
echo "Venus not accessible yet"
attempt=$((attempt+1))
if [[ $attempt -eq 12 ]]; then
echo "FAILED: Venus did not become accessible. Response:"
cat $output_path
return 1
fi
sleep 10
done
echo "SUCCESS: Venus"
}
function test_venus_scenario_logged {
. /etc/kolla/admin-openrc.sh
test_elasticsearch
test_venus
}
function test_venus_scenario {
echo "Testing Venus and EFK"
test_venus_scenario_logged > /tmp/logs/ansible/test-venus-scenario 2>&1
result=$?
if [[ $result != 0 ]]; then
echo "Testing Venus scenario failed. See ansible/test-venus-scenario for details"
else
echo "Successfully tested Venus scenario. See ansible/test-venus-scenario for details"
fi
return $result
}
test_venus_scenario

View File

@ -228,6 +228,16 @@
vars: vars:
scenario: prometheus-efk scenario: prometheus-efk
- job:
name: kolla-ansible-venus-base
parent: kolla-ansible-base
voting: false
files:
- ^ansible/roles/(common|elasticsearch|venus)/
- ^tests/test-venus.sh
vars:
scenario: venus
- job: - job:
name: kolla-ansible-hashi-vault-base name: kolla-ansible-hashi-vault-base
run: tests/run-hashi-vault.yml run: tests/run-hashi-vault.yml

View File

@ -397,6 +397,22 @@
base_distro: ubuntu base_distro: ubuntu
install_type: source install_type: source
- job:
name: kolla-ansible-centos8s-source-venus
parent: kolla-ansible-venus-base
nodeset: kolla-ansible-centos8s
vars:
base_distro: centos
install_type: source
- job:
name: kolla-ansible-ubuntu-source-venus
parent: kolla-ansible-venus-base
nodeset: kolla-ansible-focal
vars:
base_distro: ubuntu
install_type: source
- job: - job:
name: kolla-ansible-centos8s-hashi-vault name: kolla-ansible-centos8s-hashi-vault
parent: kolla-ansible-hashi-vault-base parent: kolla-ansible-hashi-vault-base

View File

@ -47,6 +47,8 @@
- kolla-ansible-ubuntu-source-ovn - kolla-ansible-ubuntu-source-ovn
- kolla-ansible-centos8s-source-prometheus-efk - kolla-ansible-centos8s-source-prometheus-efk
- kolla-ansible-ubuntu-source-prometheus-efk - kolla-ansible-ubuntu-source-prometheus-efk
- kolla-ansible-centos8s-source-venus
- kolla-ansible-ubuntu-source-venus
- kolla-ansible-centos8s-source-monasca - kolla-ansible-centos8s-source-monasca
- kolla-ansible-centos8s-source-cephadm - kolla-ansible-centos8s-source-cephadm
- kolla-ansible-ubuntu-source-cephadm - kolla-ansible-ubuntu-source-cephadm