diff options
| author | Sam Yaple <sam@yaple.net> | 2015-05-13 06:46:24 -0500 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-05-15 01:32:22 -0500 |
| commit | 13062e23e86b5d86020949754540460cb5b0b4fe (patch) | |
| tree | e0b3c8411418949a3d8df221da7c8cb2831b6d5d /docker/hautoproxy | |
| parent | 354ba01c8f5c7e1695cbea3bfc07aee5b75e76d9 (diff) | |
| download | kolla-13062e23e86b5d86020949754540460cb5b0b4fe.tar.gz kolla-13062e23e86b5d86020949754540460cb5b0b4fe.zip | |
Restructure builds to allow more flexibility
As a restructure, nothing is changed from the original behaviour and
naming despite the file structure changing. The symlinks to build had
to be updated generating lots of "deleted" and "new_file".
The new structure is:
docker/${base_distro}/${type}/${container}
base_distro == centos, ubuntu, fedora, etc
type == source, binary, rdo
type rdo is a symlink to binary for backwards compatibility
Two new flags are added to the build-all script to support the ability
to support different base distros and a flag to support binary or source
containers.
There are several added folders that are empty to hold the directory
structure for future containers of these types.
To use a prefix other than centos-rdo- you can set PREFIX in the toplevel
directory .buildconf file
Change-Id: Ifc7bac0d827470f506c8b5c004a833da9ce13b90
Diffstat (limited to 'docker/hautoproxy')
| -rw-r--r-- | docker/hautoproxy/Dockerfile | 9 | ||||
| l--------- | docker/hautoproxy/build | 1 | ||||
| -rw-r--r-- | docker/hautoproxy/haproxy.cfg.tmpl | 26 | ||||
| -rwxr-xr-x | docker/hautoproxy/start.py | 65 |
4 files changed, 0 insertions, 101 deletions
diff --git a/docker/hautoproxy/Dockerfile b/docker/hautoproxy/Dockerfile deleted file mode 100644 index 82b31eca3..000000000 --- a/docker/hautoproxy/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM fedora:20 -MAINTAINER Kolla Project (https://launchpad.net/kolla) - -RUN yum -y install haproxy python-jinja2 && yum clean all -RUN mkdir -p /etc/haproxy/templates -ADD haproxy.cfg.tmpl /etc/haproxy/templates/haproxy.cfg.tmpl -ADD start.py /start.py -CMD ["/start.py"] - diff --git a/docker/hautoproxy/build b/docker/hautoproxy/build deleted file mode 120000 index d2accf7d3..000000000 --- a/docker/hautoproxy/build +++ /dev/null @@ -1 +0,0 @@ -../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/hautoproxy/haproxy.cfg.tmpl b/docker/hautoproxy/haproxy.cfg.tmpl deleted file mode 100644 index cd1174b21..000000000 --- a/docker/hautoproxy/haproxy.cfg.tmpl +++ /dev/null @@ -1,26 +0,0 @@ -global - daemon - maxconn 4096 - pidfile /var/run/haproxy.pid - -defaults - mode tcp - timeout connect 5s - timeout client 1m - timeout server 1m - option redispatch - balance roundrobin - -listen stats :1936 - mode http - stats enable - stats hide-version - #stats realm Haproxy\ Statistics - stats uri / - #stats auth Username:Password - -{% for service in services %} -listen {{ service.service_name }} - bind 127.0.0.1:{{service.local_port}} - server {{ service.remote_name }} {{ service.remote_addr }}:{{ service.remote_port}} check inter 2s rise 3 fall 2 -{% endfor %} diff --git a/docker/hautoproxy/start.py b/docker/hautoproxy/start.py deleted file mode 100755 index 877b22157..000000000 --- a/docker/hautoproxy/start.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python - -'''This script configures and starts a local haproxy instances, bound to -127.0.0.1, that forwards connections all of the discovered -docker/kubernetes environment variables.''' - -import argparse -import os -import sys -from jinja2 import Environment, FileSystemLoader -import re -import urlparse - -re_url = re.compile( - '^(?P<name>.*)_PORT_(?P<port>\d+)_(?P<proto>(UDP|TCP))$') - -def parse_args(): - p = argparse.ArgumentParser() - p.add_argument('--output', '-o', - default='/etc/haproxy/haproxy.cfg') - p.add_argument('--no-start', '-n', - action='store_true') - p.add_argument('--template-dir', '-t', - default='/etc/haproxy/templates') - return p.parse_args() - -def discover_services(): - services = [] - for k in os.environ: - mo = re_url.match(k) - - if mo: - parts = urlparse.urlparse(os.environ[k]) - remote_host,remote_port = parts.netloc.split(':') - service_name = '%(name)s-%(port)s' % mo.groupdict() - - services.append({ - 'remote_name': mo.group('name'), - 'remote_addr': remote_host, - 'remote_port': remote_port, - 'remote_proto': parts.scheme, - 'local_port': mo.group('port'), - 'service_name': service_name, - }) - - return services - -def main(): - args = parse_args() - services = discover_services() - - env = Environment(loader=FileSystemLoader(['.', - args.template_dir])) - template = env.get_template('haproxy.cfg.tmpl') - with open(args.output, 'w') as fd: - fd.write(template.render(services=services)) - - if args.no_start: - return - - os.execlp('haproxy', 'haproxy', '-f', args.output, '-db') - -if __name__ == '__main__': - main() - |
