Skip to content

Commit

Permalink
e2e: Add options to configure Octavia provider (#2359)
Browse files Browse the repository at this point in the history
We want to test with ovn-octavia-provider too, this commit makes sure
it's possible.
  • Loading branch information
dulek authored Sep 22, 2023
1 parent f8fceaf commit 5b36a53
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/ci-occm-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ PR_BRANCH="${PULL_BASE_REF:-master}"
CONFIG_ANSIBLE="${CONFIG_ANSIBLE:-"true"}"
RESOURCE_TYPE="${RESOURCE_TYPE:-"gce-project"}"
ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
OCTAVIA_PROVIDER="${OCTAVIA_PROVIDER:-""}"
mkdir -p "${ARTIFACTS}/logs"

cleanup() {
Expand Down Expand Up @@ -106,7 +107,8 @@ ansible-playbook -v \
--ssh-common-args "-o StrictHostKeyChecking=no" \
tests/playbooks/test-occm-e2e.yaml \
-e github_pr=${PR_NUMBER} \
-e github_pr_branch=${PR_BRANCH}
-e github_pr_branch=${PR_BRANCH} \
-e octavia_provider=${OCTAVIA_PROVIDER}
exit_code=$?

# Fetch devstack logs for debugging purpose
Expand Down
12 changes: 11 additions & 1 deletion tests/e2e/cloudprovider/test-lb-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CLUSTER_TENANT=${CLUSTER_TENANT:-"demo"}
CLUSTER_USER=${CLUSTER_USER:-"demo"}
LB_SUBNET_NAME=${LB_SUBNET_NAME:-"private-subnet"}
AUTO_CLEAN_UP=${AUTO_CLEAN_UP:-"true"}
OCTAVIA_PROVIDER=${OCTAVIA_PROVIDER:-""}

function delete_resources() {
ERROR_CODE="$?"
Expand Down Expand Up @@ -290,6 +291,11 @@ function test_forwarded {
local public_ip=$(curl -sS ifconfig.me)
local local_ip=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')

if [[ ${OCTAVIA_PROVIDER} == "ovn" ]]; then
printf "\n>>>>>>> Skipping Service ${service} test for OVN provider\n"
return 0
fi

printf "\n>>>>>>> Create the Service ${service}\n"
cat <<EOF | kubectl apply -f -
kind: Service
Expand Down Expand Up @@ -714,7 +720,11 @@ function test_shared_user_lb {
fi

printf "\n>>>>>>> Creating openstack load balancer: --vip-subnet-id $subid \n"
lbID=$(openstack loadbalancer create --vip-subnet-id $subid --name test_shared_user_lb -f value -c id)
provider_option=""
if [[ ${OCTAVIA_PROVIDER} != "" ]]; then
provider_option="--provider=${OCTAVIA_PROVIDER}"
fi
lbID=$(openstack loadbalancer create --vip-subnet-id $subid --name test_shared_user_lb -f value -c id ${provider_option})
if [ $? -ne 0 ]; then
printf "\n>>>>>>> FAIL: failed to create load balancer\n"
exit 1
Expand Down
3 changes: 3 additions & 0 deletions tests/playbooks/roles/install-cpo-occm/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ image_registry_host: localhost
run_e2e: false
# Used for access the private registry image from k8s
remote_registry_host: "{{ ansible_default_ipv4.address }}"

# Octavia provider to configure OCCM with. Empty means we'll use a default
octavia_provider: ""
13 changes: 13 additions & 0 deletions tests/playbooks/roles/install-cpo-occm/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@
floating-network-id=$external_network_id
EOF
if [[ "{{ octavia_provider }}" != "" ]]; then
cat <<EOF >> {{ ansible_user_dir }}/cloud.conf
lb-provider={{ octavia_provider }}
EOF
fi
if [[ "{{ octavia_provider }}" == "ovn" ]]; then
cat <<EOF >> {{ ansible_user_dir }}/cloud.conf
lb-method=SOURCE_IP_PORT
EOF
fi
kubectl create secret -n kube-system generic cloud-config --from-file={{ ansible_user_dir }}/cloud.conf
- name: Replace manifests
Expand Down Expand Up @@ -125,6 +137,7 @@
# GATEWAY_IP is the default value in devstack
GATEWAY_IP=172.24.5.1 \
DEVSTACK_OS_RC={{ devstack_workdir }}/openrc \
OCTAVIA_PROVIDER={{ octavia_provider }} \
bash tests/e2e/cloudprovider/test-lb-service.sh
timeout: 3600
ignore_errors: true
Expand Down
2 changes: 2 additions & 0 deletions tests/playbooks/test-occm-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
github_pr: 123
global_env: {}
devstack_workdir: /home/{{ user }}/devstack
octavia_provider: ""

roles:
- role: install-golang
Expand All @@ -28,4 +29,5 @@
cert_hosts: ' ["{{ ansible_default_ipv4.address }}"]'
- role: install-cpo-occm
run_e2e: true
octavia_provider: "{{ octavia_provider }}"
environment: "{{ global_env }}"

0 comments on commit 5b36a53

Please sign in to comment.