Skip to content

Commit f41cace

Browse files
committed
rename zuul jobs
1 parent d78bcf2 commit f41cace

File tree

7 files changed

+255
-256
lines changed

7 files changed

+255
-256
lines changed

hack/run-integration-tests.sh

Lines changed: 106 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -xe
22

3-
# Copyright (c) 2023 VEXXHOST, Inc.
3+
# Copyright (c) 2024 VEXXHOST, Inc.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License"); you may
66
# not use this file except in compliance with the License. You may obtain
@@ -14,18 +14,11 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
# This script will run the full functional tests for a given `KUBE_TAG`. It
18-
# will download the image, create a cluster, wait for it to hit `CREATE_COMPLETE`
19-
# and then run `sonobuoy` against it.
20-
21-
source /opt/stack/openrc
17+
source /opt/stack/openrc admin admin
2218

2319
OS_DISTRO=${OS_DISTRO:-ubuntu}
2420
IMAGE_OS=${IMAGE_OS:-ubuntu-2204}
25-
NODE_COUNT=${NODE_COUNT:-2}
2621
NETWORK_DRIVER=${NETWORK_DRIVER:-calico}
27-
SONOBUOY_VERSION=${SONOBUOY_VERSION:-0.56.16}
28-
SONOBUOY_ARCH=${SONOBUOY_ARCH:-amd64}
2922
DNS_NAMESERVER=${DNS_NAMESERVER:-1.1.1.1}
3023
UPGRADE_KUBE_TAG=${UPGRADE_KUBE_TAG:-KUBE_TAG}
3124
IMAGE_NAME="${IMAGE_OS}-kube-${KUBE_TAG}"
@@ -42,6 +35,7 @@ fi
4235
# Upload image to Glance
4336
openstack image create \
4437
--disk-format=qcow2 \
38+
--public \
4539
--container-format=bare \
4640
--property os_distro=${OS_DISTRO} \
4741
--file=${IMAGE_NAME}.qcow2 \
@@ -56,12 +50,50 @@ if [[ ${UPGRADE_KUBE_TAG} != ${KUBE_TAG} ]]; then
5650
# Upload Upgrade image to Glance
5751
openstack image create \
5852
--disk-format=qcow2 \
53+
--public \
5954
--container-format=bare \
6055
--property os_distro=${OS_DISTRO} \
6156
--file=${UPGRADE_IMAGE_NAME}.qcow2 \
6257
${UPGRADE_IMAGE_NAME}
6358
fi
6459

60+
mkdir /tmp/magnum-nodes
61+
62+
pushd /opt/stack/tempest
63+
echo "Tempest configs:"
64+
65+
cat <<EOF >> /opt/stack/tempest/etc/tempest.conf
66+
67+
[magnum]
68+
flavor_id = m1.large
69+
master_flavor_id = m1.large
70+
copy_logs = true
71+
network_driver = ${NETWORK_DRIVER}
72+
image_id = ${IMAGE_OS}-kube-${KUBE_TAG}
73+
coe = kubernetes
74+
labels = '{"kube_tag": "${KUBE_TAG}", "fixed_subnet_cidr": "10.0.0.0/26"}'
75+
docker_storage_driver = overlay
76+
77+
EOF
78+
79+
if [ ! -d /opt/stack/magnum-tempest-plugin ]; then
80+
git clone https://github.com/openstack/magnum-tempest-plugin /opt/stack/magnum-tempest-plugin
81+
fi
82+
83+
# install magnum-tempest-plugin
84+
pushd /opt/stack/magnum-tempest-plugin
85+
$HOME/.local/bin/pip3 install -e .
86+
popd
87+
88+
echo "Run Tempest against configs:"
89+
cat /opt/stack/tempest/etc/tempest.conf
90+
91+
echo "Run Tempest tests:"
92+
/opt/stack/data/venv/bin/tempest run -r '(^magnum_tempest_plugin)' \
93+
--exclude-regex '^magnum_tempest_plugin.tests.api.v1.test_cluster.ClusterTest\.(test_create_cluster_with_zero_nodes|test_create_list_sign_delete_clusters)'
94+
popd
95+
96+
6597
# Create cluster template
6698
openstack coe cluster template create \
6799
--image $(openstack image show ${IMAGE_NAME} -c id -f value) \
@@ -77,156 +109,121 @@ openstack coe cluster template create \
77109
--label fixed_subnet_cidr=192.168.24.0/24 \
78110
k8s-${KUBE_TAG};
79111

80-
if [[ ${UPGRADE_KUBE_TAG} != ${KUBE_TAG} ]]; then
81-
# Create cluster template for upgrade
82-
openstack coe cluster template create \
83-
--image $(openstack image show ${UPGRADE_IMAGE_NAME} -c id -f value) \
84-
--external-network public \
85-
--dns-nameserver ${DNS_NAMESERVER} \
86-
--master-lb-enabled \
87-
--master-flavor m1.large \
88-
--flavor m1.large \
89-
--network-driver ${NETWORK_DRIVER} \
90-
--docker-storage-driver overlay2 \
91-
--coe kubernetes \
92-
--label kube_tag=${UPGRADE_KUBE_TAG} \
93-
--label fixed_subnet_cidr=192.168.24.0/24 \
94-
k8s-${UPGRADE_KUBE_TAG};
95-
fi
96-
97112
# Create cluster
98113
openstack coe cluster create \
99114
--cluster-template k8s-${KUBE_TAG} \
100115
--master-count 1 \
101-
--node-count ${NODE_COUNT} \
116+
--node-count 1 \
102117
--merge-labels \
103118
--label audit_log_enabled=true \
104-
k8s-cluster
119+
k8s-cluster-test
105120

106121
# Wait for cluster creation to be queued
107122
set +e
108123
for i in {1..5}; do
109-
openstack coe cluster show k8s-cluster 2>&1
124+
openstack coe cluster show k8s-cluster-test 2>&1
110125
exit_status=$?
111126
if [ $exit_status -eq 0 ]; then
112127
break
113128
else
114-
echo "Error: Cluster k8s-cluster could not be found."
129+
echo "Error: Cluster k8s-cluster-test could not be found."
115130
sleep 1
116131
fi
117132
done
118133
set -e
119134

120135
# Wait for cluster to be "CREATE_COMPLETE".
121136
for i in {1..240}; do
122-
CLUSTER_STATUS=$(openstack coe cluster show k8s-cluster -c status -f value)
137+
CLUSTER_STATUS=$(openstack coe cluster show k8s-cluster-test -c status -f value)
123138
if [[ ${CLUSTER_STATUS} == *"FAILED"* ]]; then
124139
echo "Cluster failed to create"
125140
exit 1
126141
elif [[ ${CLUSTER_STATUS} == *"CREATE_COMPLETE"* ]]; then
127142
echo "Cluster created"
128143
break
129144
else
130-
echo "Currtny retry count: $i"
145+
echo "Current retry count: $i"
131146
echo "Cluster status: ${CLUSTER_STATUS}"
132147
sleep 5
133148
fi
134149
done
135150

136-
# Get the cluster configuration file
137-
eval $(openstack coe cluster config k8s-cluster)
138-
139-
# Download sonobuoy
140-
curl -LO https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_${SONOBUOY_ARCH}.tar.gz
141-
tar -xzf sonobuoy_${SONOBUOY_VERSION}_linux_${SONOBUOY_ARCH}.tar.gz
142-
143-
# Run sonobuoy
144-
./sonobuoy run --wait --mode certified-conformance --plugin-env=e2e.E2E_PARALLEL=true
145-
146-
# Retrieve results
147-
RESULTS_FILE=$(./sonobuoy retrieve --filename sonobuoy-results.tar.gz)
148-
149-
# Print results
150-
./sonobuoy results ${RESULTS_FILE}
151-
152-
153-
# Fail if the Sonobuoy tests failed
154-
if ! ./sonobuoy results --plugin e2e ${RESULTS_FILE} | grep -q "Status: passed"; then
155-
echo "Sonobuoy tests failed"
156-
exit 1
157-
fi
151+
# Wait for kubernetes accessible and Ready.
152+
for i in {1..30}; do
153+
# Get the cluster configuration file
154+
eval $(openstack coe cluster config k8s-cluster-test)
155+
Node=$(kubectl get node -o wide)
156+
ready_count=$(echo $Node | grep -o " Ready " | wc -l)
157+
tag_count=$(echo $Node | grep -o $KUBE_TAG | wc -l)
158+
if [[ $ready_count -eq 2 && $tag_count -eq 2 ]]; then
159+
echo "Kubernetes accessible with Ready node."
160+
echo "Node status: ${Node}"
161+
break
162+
elif [[ $i -eq 30 ]]; then
163+
echo "Failed: Unable to reach ready status for nodes..."
164+
echo "Node status: ${Node}"
165+
exit 1
166+
else
167+
echo "Current retry count: $i"
168+
# echo "Node status: ${Node}"
169+
sleep 5
170+
fi
171+
done
158172

159173

160174
if [[ ${UPGRADE_KUBE_TAG} != ${KUBE_TAG} ]]; then
161175

162-
openstack coe cluster delete k8s-cluster
163-
# Wait for cluster to be deleted
164-
set +e
165-
for i in {1..60}; do
166-
openstack coe cluster show k8s-cluster 2>&1
167-
exit_status=$?
168-
if [ $exit_status -eq 0 ]; then
169-
sleep 2
170-
else
171-
echo "Cluster k8s-cluster deleted."
172-
break
173-
fi
174-
done
175-
set -e
176-
# Create cluster
177-
openstack coe cluster create \
178-
--cluster-template k8s-${KUBE_TAG} \
179-
--master-count 1 \
180-
--node-count 1 \
181-
--merge-labels \
182-
--label audit_log_enabled=true \
183-
k8s-cluster-upgrade
184-
185-
# Wait for cluster creation to be queued
186-
set +e
187-
for i in {1..5}; do
188-
openstack coe cluster show k8s-cluster-upgrade 2>&1
189-
exit_status=$?
190-
if [ $exit_status -eq 0 ]; then
191-
break
192-
else
193-
echo "Error: Cluster k8s-cluster-upgrade could not be found."
194-
sleep 1
195-
fi
196-
done
197-
set -e
176+
# Create cluster template for upgrade
177+
openstack coe cluster template create \
178+
--image $(openstack image show ${UPGRADE_IMAGE_NAME} -c id -f value) \
179+
--external-network public \
180+
--dns-nameserver ${DNS_NAMESERVER} \
181+
--master-lb-enabled \
182+
--master-flavor m1.large \
183+
--flavor m1.large \
184+
--network-driver ${NETWORK_DRIVER} \
185+
--docker-storage-driver overlay2 \
186+
--coe kubernetes \
187+
--label kube_tag=${UPGRADE_KUBE_TAG} \
188+
--label fixed_subnet_cidr=192.168.24.0/24 \
189+
k8s-${UPGRADE_KUBE_TAG};
198190

199-
# Wait for cluster to be "CREATE_COMPLETE".
191+
# Upgrade cluster
192+
openstack coe cluster upgrade k8s-cluster-test k8s-${UPGRADE_KUBE_TAG}
193+
# Wait for cluster to be "UPDATE_COMPLETE".
200194
for i in {1..240}; do
201-
CLUSTER_STATUS=$(openstack coe cluster show k8s-cluster-upgrade -c status -f value)
195+
CLUSTER_STATUS=$(openstack coe cluster show k8s-cluster-test -c status -f value)
202196
if [[ ${CLUSTER_STATUS} == *"FAILED"* ]]; then
203-
echo "Cluster failed to create"
197+
echo "Cluster failed to upgrade"
204198
exit 1
205-
elif [[ ${CLUSTER_STATUS} == *"CREATE_COMPLETE"* ]]; then
206-
echo "Cluster created"
199+
elif [[ ${CLUSTER_STATUS} == *"UPDATE_COMPLETE"* ]]; then
200+
echo "Cluster upgraded"
207201
break
208202
else
209-
echo "Currtny retry count: $i"
203+
echo "Current retry count: $i"
210204
echo "Cluster status: ${CLUSTER_STATUS}"
211205
sleep 5
212206
fi
213207
done
214208

215-
# Upgrade cluster
216-
openstack coe cluster upgrade k8s-cluster-upgrade k8s-${UPGRADE_KUBE_TAG}
217-
# Wait for cluster to be "UPDATE_COMPLETE".
218-
for i in {1..240}; do
219-
CLUSTER_STATUS=$(openstack coe cluster show k8s-cluster-upgrade -c status -f value)
220-
if [[ ${CLUSTER_STATUS} == *"FAILED"* ]]; then
221-
echo "Cluster failed to upgrade"
222-
exit 1
223-
elif [[ ${CLUSTER_STATUS} == *"UPDATE_COMPLETE"* ]]; then
224-
echo "Cluster upgraded"
209+
# Wait for kubernetes accessible and Ready.
210+
for i in {1..30}; do
211+
# Get the cluster configuration file
212+
eval $(openstack coe cluster config k8s-cluster-test)
213+
Node=$(kubectl get node -o wide)
214+
ready_count=$(echo $Node | grep -o " Ready " | wc -l)
215+
tag_count=$(echo $Node | grep -o $UPGRADE_KUBE_TAG | wc -l)
216+
if [[ $ready_count -eq 2 && $tag_count -eq 2 ]]; then
217+
echo "Kubernetes accessible with Ready node."
218+
echo "Node status: ${Node}"
225219
exit 0
226-
break
220+
elif [[ $i -eq 30 ]]; then
221+
echo "Failed: Unable to reach ready status for nodes..."
222+
echo "Node status: ${Node}"
223+
exit 1
227224
else
228-
echo "Currtny retry count: $i"
229-
echo "Cluster status: ${CLUSTER_STATUS}"
225+
echo "Current retry count: $i"
226+
# echo "Node status: ${Node}"
230227
sleep 5
231228
fi
232229
done

0 commit comments

Comments
 (0)