Insert haproxy in front of all the o-api endpoints
The main octavia node will need the OCTAVIA_NODES setting in the following format to setup the octavia API haproxy in front of all of them. OCTAVIA_NODES=main:<ip-address>,second:<ip-address> Change-Id: I4a88dae4aa47c508559fd7464f127a23b089af2a
This commit is contained in:
parent
b47fcb2834
commit
50fd8be1fd
29
devstack/etc/octavia/haproxy.cfg
Normal file
29
devstack/etc/octavia/haproxy.cfg
Normal file
@ -0,0 +1,29 @@
|
||||
global
|
||||
daemon
|
||||
log /dev/log local0
|
||||
log /dev/log local1 notice
|
||||
|
||||
defaults
|
||||
log global
|
||||
retries 3
|
||||
option redispatch
|
||||
timeout connect 5000
|
||||
timeout client 50000
|
||||
timeout server 50000
|
||||
|
||||
|
||||
|
||||
frontend octavia-frontend-api
|
||||
option tcplog
|
||||
bind 0.0.0.0:OCTAVIA_PORT
|
||||
mode http
|
||||
default_backend octavia-backend-api
|
||||
|
||||
backend octavia-backend-api
|
||||
mode http
|
||||
balance roundrobin
|
||||
|
||||
# the devstack plugin will add entries here looking like:
|
||||
# server octavia-main <IP-main>:<PORT> weight 1
|
||||
# server octavia-second <IP-second>:<PORT> weight 1
|
||||
#
|
@ -111,6 +111,7 @@ function octavia_configure {
|
||||
if [[ "$(trueorfalse False OCTAVIA_USE_PREGENERATED_SSH_KEY)" == "True" ]]; then
|
||||
cp -fp ${OCTAVIA_PREGENERATED_SSH_KEY_PATH} ${OCTAVIA_AMP_SSH_KEY_PATH}
|
||||
cp -fp ${OCTAVIA_PREGENERATED_SSH_KEY_PATH}.pub ${OCTAVIA_AMP_SSH_KEY_PATH}.pub
|
||||
chmod 0600 ${OCTAVIA_AMP_SSH_KEY_PATH}
|
||||
else
|
||||
ssh-keygen -b $OCTAVIA_AMP_SSH_KEY_BITS -t $OCTAVIA_AMP_SSH_KEY_TYPE -N "" -f ${OCTAVIA_AMP_SSH_KEY_PATH}
|
||||
fi
|
||||
@ -197,6 +198,25 @@ function create_amphora_flavor {
|
||||
nova flavor-create --is-public False m1.amphora ${OCTAVIA_AMP_FLAVOR_ID} 1024 2 1
|
||||
}
|
||||
|
||||
function configure_octavia_api_haproxy {
|
||||
|
||||
cp ${OCTAVIA_DIR}/devstack/etc/octavia/haproxy.cfg ${OCTAVIA_CONF_DIR}/haproxy.cfg
|
||||
|
||||
sed -i.bak "s/OCTAVIA_PORT/${OCTAVIA_PORT}/" ${OCTAVIA_CONF_DIR}/haproxy.cfg
|
||||
|
||||
iniset $OCTAVIA_CONF DEFAULT bind_port ${OCTAVIA_HA_PORT}
|
||||
|
||||
NODES=(${OCTAVIA_NODES//,/ })
|
||||
|
||||
for NODE in ${NODES[@]}; do
|
||||
DATA=(${NODE//:/ })
|
||||
NAME=$(echo -e "${DATA[0]}" | tr -d '[[:space:]]')
|
||||
IP=$(echo -e "${DATA[1]}" | tr -d '[[:space:]]')
|
||||
echo " server octavia-${NAME} ${IP}:${OCTAVIA_HA_PORT} weight 1" >> ${OCTAVIA_CONF_DIR}/haproxy.cfg
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
function octavia_start {
|
||||
|
||||
# Several steps in this function would more logically be in the configure function, but
|
||||
@ -245,6 +265,10 @@ function octavia_start {
|
||||
|
||||
iniset $OCTAVIA_CONF controller_worker amp_boot_network_list ${OCTAVIA_AMP_NETWORK_ID}
|
||||
|
||||
if [ $OCTAVIA_NODE == 'main' ]; then
|
||||
configure_octavia_api_haproxy
|
||||
run_process $OCTAVIA_API_HAPROXY "/usr/sbin/haproxy -db -V -f ${OCTAVIA_CONF_DIR}/haproxy.cfg"
|
||||
fi
|
||||
|
||||
run_process $OCTAVIA_API "$OCTAVIA_API_BINARY $OCTAVIA_API_ARGS"
|
||||
run_process $OCTAVIA_CONSUMER "$OCTAVIA_CONSUMER_BINARY $OCTAVIA_CONSUMER_ARGS"
|
||||
|
@ -63,11 +63,13 @@ enable_service o-cw
|
||||
enable_service o-hm
|
||||
enable_service o-hk
|
||||
enable_service o-api
|
||||
enable_service o-api-ha
|
||||
|
||||
OCTAVIA_USE_PREGENERATED_CERTS=True
|
||||
OCTAVIA_USE_PREGENERATED_SSH_KEY=True
|
||||
OCTAVIA_CONTROLLER_IP_PORT_LIST=192.168.0.3:5555,192.168.0.4:5555
|
||||
OCTAVIA_NODE=main
|
||||
OCTAVIA_NODES=main:192.168.42.10,second:192.168.42.11
|
||||
|
||||
Q_PLUGIN=ml2
|
||||
Q_ML2_TENANT_NETWORK_TYPE=vxlan
|
||||
|
@ -31,6 +31,7 @@ OCTAVIA_ADMIN_PASSWORD=${OCTAVIA_ADMIN_PASSWORD:-${ADMIN_PASSWORD}}
|
||||
|
||||
OCTAVIA_PROTOCOL=${OCTAVIA_PROTOCOL:-"http"}
|
||||
OCTAVIA_PORT=${OCTAVIA_PORT:-"9876"}
|
||||
OCTAVIA_HA_PORT=${OCTAVIA_HA_PORT:-"9875"}
|
||||
OCTAVIA_HM_LISTEN_PORT=${OCTAVIA_HM_LISTEN_PORT:-"5555"}
|
||||
|
||||
OCTAVIA_MGMT_SUBNET=${OCTAVIA_MGMT_SUBNET:-"192.168.0.0/24"}
|
||||
@ -69,6 +70,8 @@ OCTAVIA_CONSUMER="o-cw"
|
||||
OCTAVIA_HOUSEKEEPER="o-hk"
|
||||
OCTAVIA_HEALTHMANAGER="o-hm"
|
||||
OCTAVIA_SERVICE="octavia"
|
||||
OCTAVIA_API_HAPROXY="o-api-ha"
|
||||
|
||||
NEUTRON_LBAAS_DIR=$DEST/neutron-lbaas
|
||||
NEUTRON_LBAAS_CONF=$NEUTRON_CONF_DIR/neutron_lbaas.conf
|
||||
OCTAVIA_SERVICE_PROVIDER=${OCTAVIA_SERVICE_PROVIDER:-"LOADBALANCERV2:Octavia:neutron_lbaas.drivers.octavia.driver.OctaviaDriver:default"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user