|
|
@ -30,38 +30,16 @@ export ANSIBLE_BECOME_USER=root |
|
|
|
if [[ "${TESTCASE}" =~ "collection" ]]; then |
|
|
|
# Build and install collection |
|
|
|
ansible-galaxy collection build |
|
|
|
ansible-galaxy collection install kubernetes_sigs-kubespray-$(grep "^version:" galaxy.yml | awk '{print $2}').tar.gz |
|
|
|
|
|
|
|
# Simply remove all of our files and directories except for our tests directory |
|
|
|
# to be absolutely certain that none of our playbooks or roles |
|
|
|
# are interfering with our collection |
|
|
|
find -mindepth 1 -maxdepth 1 ! -regex './\(tests\|inventory\)' -exec rm -rfv {} + |
|
|
|
|
|
|
|
cat > cluster.yml <<EOF |
|
|
|
- name: Install Kubernetes |
|
|
|
ansible.builtin.import_playbook: kubernetes_sigs.kubespray.cluster |
|
|
|
EOF |
|
|
|
|
|
|
|
cat > upgrade-cluster.yml <<EOF |
|
|
|
- name: Install Kubernetes |
|
|
|
ansible.builtin.import_playbook: kubernetes_sigs.kubespray.upgrade-cluster |
|
|
|
EOF |
|
|
|
|
|
|
|
cat > reset.yml <<EOF |
|
|
|
- name: Remove Kubernetes |
|
|
|
ansible.builtin.import_playbook: kubernetes_sigs.kubespray.reset |
|
|
|
EOF |
|
|
|
|
|
|
|
cat > remove-node.yml <<EOF |
|
|
|
- name: Remove node from Kubernetes |
|
|
|
ansible.builtin.import_playbook: kubernetes_sigs.kubespray.remove_node |
|
|
|
EOF |
|
|
|
|
|
|
|
ansible-galaxy collection install kubernetes_sigs-kubespray-*.tar.gz |
|
|
|
fi |
|
|
|
|
|
|
|
run_playbook () { |
|
|
|
playbook=$1 |
|
|
|
if [[ "${TESTCASE}" =~ "collection" ]]; then |
|
|
|
playbook=kubernetes_sigs.kubespray.$1 |
|
|
|
else |
|
|
|
playbook=$1.yml |
|
|
|
fi |
|
|
|
shift |
|
|
|
|
|
|
|
ansible-playbook \ |
|
|
|
-e @tests/common_vars.yml \ |
|
|
|
-e @tests/${TESTCASE_FILE} \ |
|
|
@ -71,11 +49,10 @@ ansible-playbook \ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## START KUBESPRAY |
|
|
|
|
|
|
|
# Create cluster |
|
|
|
run_playbook cluster.yml |
|
|
|
run_playbook cluster |
|
|
|
|
|
|
|
# Repeat deployment if testing upgrade |
|
|
|
if [ "${UPGRADE_TEST}" != "false" ]; then |
|
|
@ -85,10 +62,10 @@ if [ "${UPGRADE_TEST}" != "false" ]; then |
|
|
|
|
|
|
|
case "${UPGRADE_TEST}" in |
|
|
|
"basic") |
|
|
|
run_playbook cluster.yml |
|
|
|
run_playbook cluster |
|
|
|
;; |
|
|
|
"graceful") |
|
|
|
run_playbook upgrade-cluster.yml |
|
|
|
run_playbook upgrade-cluster |
|
|
|
;; |
|
|
|
*) |
|
|
|
;; |
|
|
@ -97,8 +74,8 @@ fi |
|
|
|
|
|
|
|
# Test control plane recovery |
|
|
|
if [ "${RECOVER_CONTROL_PLANE_TEST}" != "false" ]; then |
|
|
|
run_playbook reset.yml --limit "${RECOVER_CONTROL_PLANE_TEST_GROUPS}" -e reset_confirmation=yes |
|
|
|
run_playbook recover-control-plane.yml -e etcd_retries=10 --limit "etcd:kube_control_plane" |
|
|
|
run_playbook reset --limit "${RECOVER_CONTROL_PLANE_TEST_GROUPS}" -e reset_confirmation=yes |
|
|
|
run_playbook recover-control-plane -e etcd_retries=10 --limit "etcd:kube_control_plane" |
|
|
|
fi |
|
|
|
|
|
|
|
# Tests Cases |
|
|
@ -123,10 +100,10 @@ run_playbook tests/testcases/100_check-k8s-conformance.yml |
|
|
|
|
|
|
|
# Test node removal procedure |
|
|
|
if [ "${REMOVE_NODE_CHECK}" = "true" ]; then |
|
|
|
run_playbook remove-node.yml -e skip_confirmation=yes -e node=${REMOVE_NODE_NAME} |
|
|
|
run_playbook remove-node -e skip_confirmation=yes -e node=${REMOVE_NODE_NAME} |
|
|
|
fi |
|
|
|
|
|
|
|
# Clean up at the end, this is to allow stage1 tests to include cleanup test |
|
|
|
if [ "${RESET_CHECK}" = "true" ]; then |
|
|
|
run_playbook reset.yml -e reset_confirmation=yes |
|
|
|
run_playbook reset -e reset_confirmation=yes |
|
|
|
fi |