Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge haproxy.router.server.(z1 & z2) into haproxy.router.servers pro…
Browse files Browse the repository at this point in the history
…perty

[#114950551]

Signed-off-by: Shash Reddy <sreddy@pivotal.io>
  • Loading branch information
fordaz authored and pivotal committed Apr 29, 2016
1 parent a82ec24 commit 6528dbd
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 37 deletions.
7 changes: 2 additions & 5 deletions jobs/haproxy/spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ properties:
request_timeout_in_seconds:
description: "Server and client timeouts in seconds"
default: 900
router.servers.z1:
description: "Array of the router IPs acting as the first group of HTTP/TCP backends"
default: []
router.servers.z2:
description: "Array of the router IPs acting as the second group of HTTP/TCP backends"
router.servers:
description: "Array of router IPs"
default: []
router.port:
description: "Listening port for Router"
Expand Down
12 changes: 2 additions & 10 deletions jobs/haproxy/templates/haproxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,15 @@ frontend ssl-in
backend http-routers
mode http
balance roundrobin
<% size = p("router.servers.z1").size %>

<% p("router.servers.z1").each_with_index do |ip, index| %>
<% p("router.servers").each_with_index do |ip, index| %>
server node<%= index %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
<% p("router.servers.z2").each_with_index do |ip, index| %>
server node<%= index + size %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>

backend tcp-routers
mode tcp
balance roundrobin
<% size = p("router.servers.z1").size %>

<% p("router.servers.z1").each_with_index do |ip, index| %>
<% p("router.servers").each_with_index do |ip, index| %>
server node<%= index %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
<% p("router.servers.z2").each_with_index do |ip, index| %>
server node<%= index + size %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
12 changes: 2 additions & 10 deletions jobs/haproxy/templates/haproxy.ctmpl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,18 @@ frontend ssl-in
backend http-routers
mode http
balance roundrobin
<% size = p("router.servers.z1").size %>

<% p("router.servers.z1").each_with_index do |ip, index| %>
<% p("router.servers").each_with_index do |ip, index| %>
server node<%= index %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
<% p("router.servers.z2").each_with_index do |ip, index| %>
server node<%= index + size %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>

backend tcp-routers
mode tcp
balance roundrobin
<% size = p("router.servers.z1").size %>

<% p("router.servers.z1").each_with_index do |ip, index| %>
<% p("router.servers").each_with_index do |ip, index| %>
server node<%= index %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
<% p("router.servers.z2").each_with_index do |ip, index| %>
server node<%= index + size %> <%= ip %>:<%= p("router.port") %> check inter 1000
<% end %>
<% if p("cc.allow_app_ssh_access") %>
{{$services := service "ssh-proxy" "passing"}}
Expand Down
4 changes: 1 addition & 3 deletions spec/fixtures/aws/cf-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ jobs:
metron_agent:
zone: z1
router:
servers:
z1: null
z2: null
servers: null
resource_pool: router_z1
templates:
- name: haproxy
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/bosh-lite/cf-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ jobs:
zone: z1
router:
servers:
z1:
- 10.244.0.22
z2: []
resource_pool: router_z1
templates:
- name: haproxy
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/openstack/cf-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ jobs:
zone: z1
router:
servers:
z1:
- 10.10.0.130
z2: []
resource_pool: router_z1
templates:
- name: haproxy
Expand Down
2 changes: 0 additions & 2 deletions spec/fixtures/vsphere/cf-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ jobs:
zone: z1
router:
servers:
z1:
- 10.85.9.235
z2:
- 10.85.10.235
resource_pool: router_z1
templates:
Expand Down
4 changes: 1 addition & 3 deletions templates/cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ jobs:
properties:
ha_proxy:
router:
servers:
z1: (( merge || jobs.router_z1.networks.cf1.static_ips || nil ))
z2: (( merge || jobs.router_z2.networks.cf2.static_ips || nil ))
servers: (( merge || jobs.router_z1.networks.cf1.static_ips jobs.router_z2.networks.cf2.static_ips || nil ))
metron_agent:
zone: z1
update: (( merge || empty_hash ))
Expand Down

0 comments on commit 6528dbd

Please sign in to comment.