add diag_status to ha_proxy 15/76115/1
authorSam Hague <shague@redhat.com>
Sun, 16 Sep 2018 12:38:40 +0000 (08:38 -0400)
committerSam Hague <shague@redhat.com>
Sun, 16 Sep 2018 12:38:40 +0000 (08:38 -0400)
Change-Id: Iab58c4457cf730ff4f711321b61f5ae71076a56b
Signed-off-by: Sam Hague <shague@redhat.com>
jjb/integration/common-functions.sh
jjb/integration/integration-deploy-openstack-run-test.sh

index 48280d1cd994eadf9bc5ec47882d36e4c676cc70..e3499828b727d2529474efdb9f8cb55fa7c74627 100644 (file)
@@ -419,6 +419,7 @@ EOF
 
     mv /tmp/changes.txt ${WORKSPACE}/archives
     mv ${WORKSPACE}/rabbit.txt ${WORKSPACE}/archives
+    mv ${WORKSPACE}/haproxy.cfg ${WORKSPACE}/archives
 
     sleep 5
     # FIXME: Do not create .tar and gzip before copying.
index 7b7c12360c9e1e15c036ce824d650b6df42a02bb..07d0d61a708f9519db6eff64036f4b2ca5c03918 100644 (file)
@@ -450,16 +450,16 @@ EOF
 } # create_compute_node_local_conf()
 
 function configure_haproxy_for_neutron_requests() {
-    MGRIP=$1
+    local -r haproxy_ip=$1
     # shellcheck disable=SC2206
-    ODL_IPS=(${2//,/ })
+    local -r odl_ips=(${2//,/ })
 
     cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
 sudo systemctl stop firewalld
 sudo yum -y install policycoreutils-python haproxy
 EOF
 
-cat > ${WORKSPACE}/haproxy.cfg << EOF
+    cat > ${WORKSPACE}/haproxy.cfg << EOF
 global
   daemon
   group  haproxy
@@ -481,28 +481,39 @@ defaults
   timeout  check 10s
 
 listen opendaylight
-  bind ${MGRIP}:8080
+  bind ${haproxy_ip}:8181 transparent
+  mode http
+  http-request set-header X-Forwarded-Proto https if { ssl_fc }
+  http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
+  option httpchk GET /diagstatus
+  option httplog
   balance source
+EOF
 
-listen opendaylight_rest
-  bind ${MGRIP}:8181
-  balance source
+    odlindex=1
+    for odlip in ${odl_ips[*]}; do
+        echo "  server opendaylight-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2" >> ${WORKSPACE}/haproxy.cfg
+        odlindex=$((odlindex+1))
+    done
 
-listen opendaylight_websocket
-  bind ${MGRIP}:8185
-  balance source
+    cat >> ${WORKSPACE}/haproxy.cfg << EOF
 
+listen opendaylight_ws
+  bind ${haproxy_ip}:8185 transparent
+  mode http
+  timeout connect 5s
+  timeout client 25s
+  timeout server 25s
+  timeout tunnel 3600s
+  balance source
 EOF
 
     odlindex=1
-    for odlip in ${ODL_IPS[*]}; do
-        sed -i "/listen opendaylight$/a server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
-        sed -i "/listen opendaylight_rest$/a server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
-        sed -i "/listen opendaylight_websocket$/a server controller-websocket-${odlindex} ${odlip}:8185 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
+    for odlip in ${odl_ips[*]}; do
+        echo "  server opendaylight-ws-${odlindex} ${odlip}:8185 check fall 5 inter 2000 rise 2" >> ${WORKSPACE}/haproxy.cfg
         odlindex=$((odlindex+1))
     done
 
-
     echo "Dump haproxy.cfg"
     cat ${WORKSPACE}/haproxy.cfg
 
@@ -517,11 +528,11 @@ sudo systemctl status haproxy
 true
 EOF
 
-    scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
-    ${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
-    scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
-    scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
-    ${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
+    scp ${WORKSPACE}/install_ha_proxy.sh ${haproxy_ip}:/tmp
+    ${SSH} ${haproxy_ip} "sudo bash /tmp/install_ha_proxy.sh"
+    scp ${WORKSPACE}/haproxy.cfg ${haproxy_ip}:/tmp
+    scp ${WORKSPACE}/deploy_ha_proxy.sh ${haproxy_ip}:/tmp
+    ${SSH} ${haproxy_ip} "sudo bash /tmp/deploy_ha_proxy.sh"
 } # configure_haproxy_for_neutron_requests()
 
 # Following three functions are debugging helpers when debugging devstack changes.