Skip to content

Commit c059186

Browse files
authored
[occm] Use CI job cloud-provider-openstack-test-occm (kubernetes#1558)
1 parent 2adf3ac commit c059186

File tree

2 files changed

+17
-58
lines changed

2 files changed

+17
-58
lines changed

.zuul.yaml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
- ^SECURITY_CONTACTS$
1010
- ^.gitignore$
1111
- ^.*\.sh$
12-
cloud-provider-openstack-acceptance-test-lb-octavia:
12+
cloud-provider-openstack-test-occm-1.20:
1313
jobs:
14-
- cloud-provider-openstack-acceptance-test-lb-octavia:
14+
- cloud-provider-openstack-test-occm-1.20:
1515
files:
1616
- cmd/openstack-cloud-controller-manager/.*
1717
- pkg/cloudprovider/.*
1818
- pkg/util/.*
1919
- tests/e2e/cloudprovider/.*
20-
- go.mod$
21-
- go.sum$
2220
- Makefile$
2321
irrelevant-files:
2422
- docs/.*$
@@ -61,11 +59,10 @@
6159
- pkg/csi/cinder/.*
6260
- pkg/util/.*
6361
- pkg/cloudprovider/providers/openstack/.*
64-
- test/.*
62+
- tests/e2e/csi/cinder/.*
6563
- cmd/tests/.*
6664
- go.mod$
6765
- go.sum$
68-
- Makefile$
6966
irrelevant-files:
7067
- ^docs/.*$
7168
- ^.*\.md$
@@ -77,14 +74,13 @@
7774
- cloud-provider-openstack-e2e-test-csi-cinder:
7875
files:
7976
- cmd/cinder-csi-plugin/.*
80-
- manifests/cinder-csi-plugin/.*
77+
- manifests/cinder-csi-plugin/.*
8178
- pkg/csi/cinder/.*
8279
- pkg/util/.*
8380
- tests/e2e/csi/cinder/.*
8481
- cmd/tests/.*
8582
- go.mod$
8683
- go.sum$
87-
- Makefile$
8884
irrelevant-files:
8985
- docs/.*$
9086
- ^.*\.md$
@@ -117,7 +113,6 @@
117113
- go.mod$
118114
- go.sum$
119115
- Makefile$
120-
- .zuul.yaml$
121116
cloud-provider-openstack-acceptance-test-csi-manila:
122117
jobs:
123118
- cloud-provider-openstack-acceptance-test-csi-manila:
@@ -144,7 +139,6 @@
144139
- cmd/openstack-cloud-controller-manager/.*
145140
- pkg/cloudprovider/.*
146141
- pkg/util/.*
147-
- tests/e2e/cloudprovider/.*
148142
- go.mod$
149143
- go.sum$
150144
- Makefile$
@@ -161,7 +155,6 @@
161155
- cmd/openstack-cloud-controller-manager/.*
162156
- pkg/cloudprovider/.*
163157
- pkg/util/.*
164-
- tests/e2e/cloudprovider/.*
165158
- go.mod$
166159
- go.sum$
167160
- Makefile$
@@ -178,7 +171,6 @@
178171
- cmd/openstack-cloud-controller-manager/.*
179172
- pkg/cloudprovider/.*
180173
- pkg/util/.*
181-
- tests/e2e/cloudprovider/.*
182174
- go.mod$
183175
- go.sum$
184176
- Makefile$
@@ -195,7 +187,6 @@
195187
- cmd/openstack-cloud-controller-manager/.*
196188
- pkg/cloudprovider/.*
197189
- pkg/util/.*
198-
- tests/e2e/cloudprovider/.*
199190
- go.mod$
200191
- go.sum$
201192
- Makefile$

tests/e2e/cloudprovider/test-lb-service.sh

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#!/usr/bin/env bash
22

3-
# This script is used for the openlab CI job cloud-provider-openstack-acceptance-test-lb-octavia.
4-
# See https://github.com/theopenlab/openlab-zuul-jobs/blob/master/playbooks/cloud-provider-openstack-acceptance-test-lb-octavia/run.yaml#L104
3+
# This script is used for the openlab CI job cloud-provider-openstack-test-occm.
54
#
65
# Prerequisites:
7-
# - This script is supposed to be running on a host has access to kubernetes cluster.
6+
# - This script is supposed to be running on the CI host which is running devstack.
87
# - kubectl is ready to talk with the kubernetes cluster.
9-
# - It's recommended to run the script on a host with as less proxies to the public as possible, otherwise the
10-
# x-forwarded-for test will probably fail.
118
# - This script is not responsible for resource clean up if there is test case fails.
129

1310
TIMEOUT=${TIMEOUT:-300}
1411
FLOATING_IP=${FLOATING_IP:-""}
1512
NAMESPACE="octavia-lb-test"
13+
GATEWAY_IP=${GATEWAY_IP:-""}
14+
OS_RC=${OS_RC:-"/home/zuul/devstack/openrc"}
1615

1716
delete_resources() {
1817
ERROR_CODE="$?"
@@ -62,7 +61,7 @@ function wait_for_loadbalancer {
6261

6362
end=$(($(date +%s) + ${TIMEOUT}))
6463
while true; do
65-
status=$(kubectl -n $NAMESPACE exec openstackcli -- openstack loadbalancer show $lbid -f value -c provisioning_status)
64+
status=$(openstack loadbalancer show $lbid -f value -c provisioning_status)
6665
if [[ $status == "ACTIVE" ]]; then
6766
if [[ $i == 2 ]]; then
6867
printf "\n>>>>>>> Load balancer ${lbid} is ACTIVE\n"
@@ -151,37 +150,6 @@ spec:
151150
EOF
152151
}
153152

154-
########################################################################
155-
## Name: create_openstackcli_pod
156-
## Desc: Makes sure the openstackcli pod is running.
157-
## Params: None
158-
########################################################################
159-
function create_openstackcli_pod {
160-
kubectl -n $NAMESPACE get pod | grep openstackcli | grep Running > /dev/null
161-
if [[ $? -eq 1 ]]; then
162-
printf "\n>>>>>>> Creating openstackcli pod\n"
163-
cat <<EOF | kubectl apply -f -
164-
apiVersion: v1
165-
kind: Pod
166-
metadata:
167-
name: openstackcli
168-
namespace: $NAMESPACE
169-
spec:
170-
containers:
171-
- name: openstackcli
172-
image: lingxiankong/openstack-cli:1.0.0
173-
envFrom:
174-
- secretRef:
175-
name: openrc
176-
command:
177-
- sleep
178-
- "3600"
179-
EOF
180-
kubectl -n $NAMESPACE wait --for=condition=Ready pod/openstackcli
181-
printf "\n>>>>>>> Pod openstackcli created.\n"
182-
fi
183-
}
184-
185153
########################################################################
186154
## Name: test_basic
187155
## Desc: Create a k8s service and send request to the service external
@@ -259,9 +227,9 @@ EOF
259227
wait_for_service ${service}
260228

261229
printf "\n>>>>>>> Sending request to the Service ${service}\n"
262-
orig_ip=$(curl -s http://${ipaddr} | grep x-forwarded-for | awk -F'=' '{print $2}')
263-
if [[ "${orig_ip}" != "${local_ip}" && "${orig_ip}" != "${public_ip}" ]]; then
264-
printf "\n>>>>>>> FAIL: Get incorrect response from Service ${service}, orig_ip: ${local_ip}, public_ip: ${public_ip}\n"
230+
ip_in_header=$(curl -s http://${ipaddr} | grep x-forwarded-for | awk -F'=' '{print $2}')
231+
if [[ "${ip_in_header}" != "${local_ip}" && "${ip_in_header}" != "${public_ip}" && "${ip_in_header}" != "${GATEWAY_IP}" ]]; then
232+
printf "\n>>>>>>> FAIL: Get incorrect response from Service ${service}, ip_in_header: ${ip_in_header}, local_ip: ${local_ip}, gateway_ip: ${GATEWAY_IP}, public_ip: ${public_ip}\n"
265233
exit -1
266234
else
267235
printf "\n>>>>>>> Expected: Get correct response from Service ${service}\n"
@@ -307,12 +275,12 @@ EOF
307275
wait_for_service ${service}
308276

309277
printf "\n>>>>>>> Validating openstack load balancer\n"
310-
create_openstackcli_pod
311-
lbid=$(kubectl -n $NAMESPACE exec openstackcli -- openstack loadbalancer list -c id -c name | grep "octavia-lb-test_${service}" | awk '{print $2}')
312-
lb_info=$(kubectl -n $NAMESPACE exec openstackcli -- openstack loadbalancer status show $lbid)
278+
set +x; source $OS_RC demo demo; set -x
279+
lbid=$(openstack loadbalancer list -c id -c name | grep "octavia-lb-test_${service}" | awk '{print $2}')
280+
lb_info=$(openstack loadbalancer status show $lbid)
313281
listener_count=$(echo $lb_info | jq '.loadbalancer.listeners | length')
314282
member_ports=$(echo $lb_info | jq '.loadbalancer.listeners | .[].pools | .[].members | .[].protocol_port' | uniq)
315-
service_nodeports=$(kubectl -n $NAMESPACE get svc $service -o json | jq '.spec.ports | .[].nodePort')
283+
service_nodeports=$(kubectl -n $NAMESPACE get svc $service -o json | jq '.spec.ports | .[].nodePort')
316284

317285
if [[ ${listener_count} != 2 ]]; then
318286
printf "\n>>>>>>> FAIL: Unexpected number of listeners(${listener_count}) created for service ${service}\n"
@@ -333,7 +301,7 @@ EOF
333301

334302
printf "\n>>>>>>> Validating openstack load balancer after updating the service.\n"
335303
create_openstackcli_pod
336-
lb_info=$(kubectl -n $NAMESPACE exec openstackcli -- openstack loadbalancer status show $lbid)
304+
lb_info=$(openstack loadbalancer status show $lbid)
337305
listener_count=$(echo $lb_info | jq '.loadbalancer.listeners | length')
338306
member_port=$(echo $lb_info | jq '.loadbalancer.listeners | .[].pools | .[].members | .[].protocol_port' | uniq)
339307
service_nodeport=$(kubectl -n $NAMESPACE get svc $service -o json | jq '.spec.ports | .[].nodePort')

0 commit comments

Comments
 (0)