This adds a load balancer for zuul-web and fingergw. Change-Id: Id5aa01151f64f3c85e1532ad66999ef9471c5896changes/73/828773/2
parent
2c5bc279d6
commit
2a9553ef25
@ -0,0 +1,23 @@
|
||||
zuul_lb_listeners:
|
||||
- name: balance_zuul_http
|
||||
bind:
|
||||
- ':::80'
|
||||
servers:
|
||||
- name: 'zuul02.opendev.org'
|
||||
address: '104.130.246.31:80'
|
||||
- name: balance_zuul_https
|
||||
bind:
|
||||
- ':::443'
|
||||
servers:
|
||||
- name: 'zuul02.opendev.org'
|
||||
address: '104.130.246.31:443'
|
||||
- name: balance_zuul_finger
|
||||
bind:
|
||||
- ':::79'
|
||||
servers:
|
||||
- name: 'zuul02.opendev.org'
|
||||
address: '104.130.246.31:79'
|
||||
iptables_extra_public_tcp_ports:
|
||||
- 443
|
||||
- 80
|
||||
- 79
|
@ -0,0 +1,9 @@
|
||||
Install the zuul-lb services
|
||||
|
||||
This configures haproxy
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: zuul_lb_listeners
|
||||
|
||||
The backends to configure
|
@ -0,0 +1,5 @@
|
||||
- name: Install haproxy with zuul config
|
||||
include_role:
|
||||
name: haproxy
|
||||
vars:
|
||||
haproxy_config_template: zuul-haproxy.cfg.j2
|
@ -0,0 +1,36 @@
|
||||
global
|
||||
uid 1000
|
||||
gid 1000
|
||||
log /dev/log local0
|
||||
maxconn 4000
|
||||
pidfile /var/haproxy/run/haproxy.pid
|
||||
stats socket /var/haproxy/run/stats uid 1000 gid 1000 mode 0600 level admin
|
||||
|
||||
defaults
|
||||
log-format "%ci:%cp [%t] %ft [%bi]:%bp %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq"
|
||||
log global
|
||||
maxconn 8000
|
||||
option redispatch
|
||||
retries 3
|
||||
stats enable
|
||||
timeout http-request 10s
|
||||
timeout queue 1m
|
||||
timeout connect 10s
|
||||
timeout client 2m
|
||||
timeout server 2m
|
||||
timeout check 10s
|
||||
|
||||
{% for listener in zuul_lb_listeners %}
|
||||
listen {{ listener.name }}
|
||||
{% for bind in listener.bind %}
|
||||
bind {{ bind }}
|
||||
{% endfor %}
|
||||
mode tcp
|
||||
balance source
|
||||
option tcp-check
|
||||
|
||||
{% for server in listener.servers %}
|
||||
server {{ server.name }} {{ server.address }} check
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
@ -0,0 +1,6 @@
|
||||
- hosts: "zuul-lb:!disabled"
|
||||
name: "Base: configure zuul load balancer"
|
||||
roles:
|
||||
- iptables
|
||||
- install-docker
|
||||
- zuul-lb
|
@ -0,0 +1,19 @@
|
||||
zuul_lb_listeners:
|
||||
- name: balance_zuul_http
|
||||
bind:
|
||||
- ":::80"
|
||||
servers:
|
||||
- name: "zuul02.opendev.org"
|
||||
address: "{{ (hostvars['zuul02.opendev.org'] | default({})).get('nodepool', {}).get('public_ipv4', '') }}:80"
|
||||
- name: balance_zuul_https
|
||||
bind:
|
||||
- ":::443"
|
||||
servers:
|
||||
- name: "zuul02.opendev.org"
|
||||
address: "{{ (hostvars['zuul02.opendev.org'] | default({})).get('nodepool', {}).get('public_ipv4', '') }}:443"
|
||||
- name: balance_zuul_finger
|
||||
bind:
|
||||
- ":::79"
|
||||
servers:
|
||||
- name: "zuul02.opendev.org"
|
||||
address: "{{ (hostvars['zuul02.opendev.org'] | default({})).get('nodepool', {}).get('public_ipv4', '') }}:79"
|
@ -0,0 +1,34 @@
|
||||
# Copyright 2018 Red Hat, Inc.
|
||||
# Copyright 2022 Acme Gating, LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
|
||||
|
||||
testinfra_hosts = ['zuul-lb01.opendev.org']
|
||||
|
||||
|
||||
def test_zuul_listening(host):
|
||||
zuul_https = host.socket("tcp://0.0.0.0:443")
|
||||
assert zuul_https.is_listening
|
||||
zuul_http = host.socket("tcp://0.0.0.0:80")
|
||||
assert zuul_http.is_listening
|
||||
zuul_finger = host.socket("tcp://0.0.0.0:79")
|
||||
assert zuul_finger.is_listening
|
||||
|
||||
def test_haproxy_statsd_running(host):
|
||||
cmd = host.run("docker inspect haproxy-docker_haproxy-statsd_1")
|
||||
out = json.loads(cmd.stdout)
|
||||
assert out[0]["State"]["Status"] == "running"
|
||||
assert out[0]["RestartCount"] == 0
|
Loading…
Reference in new issue