Use load-balancer service ports from HAProxy

HAProxy should use the generic load-balancer ports
(8080 for HTTP, 29418 for SSH) instead of the service-specific ones
which may not be the same or not available from time to time,
based on the service availability.

Change-Id: Ia1f8eaaa114f9c68e7c4542e71f4ddb7cb362b77
diff --git a/dual-master/Makefile b/dual-master/Makefile
index 84127d0..038eb70 100644
--- a/dual-master/Makefile
+++ b/dual-master/Makefile
@@ -93,10 +93,6 @@
 		ParameterKey=GerritKeyPrefix,ParameterValue=$(GERRIT_KEY_PREFIX)\
 		ParameterKey=CertificateArn,ParameterValue=$(SSL_CERTIFICATE_ARN) \
 		ParameterKey=Subdomain,ParameterValue=$(LB_SUBDOMAIN) \
-		ParameterKey=HTTPGerritMaster1Port,ParameterValue=$(HTTP_HOST_PORT_MASTER1) \
-		ParameterKey=HTTPGerritMaster2Port,ParameterValue=$(HTTP_HOST_PORT_MASTER2) \
-		ParameterKey=SSHGerritMaster1Port,ParameterValue=$(SSH_HOST_PORT_MASTER1) \
-		ParameterKey=SSHGerritMaster2Port,ParameterValue=$(SSH_HOST_PORT_MASTER2) \
 		ParameterKey=HAProxyDockerImage,ParameterValue=aws-gerrit/haproxy:$(HAPROXY_HEAD_SHA1) \
 		ParameterKey=SidecarDockerImage,ParameterValue=aws-gerrit/syslog-sidecar:$(SYSLOG_HEAD_SHA1)
 
diff --git a/dual-master/cf-service-lb.yml b/dual-master/cf-service-lb.yml
index 1897158..16c0b81 100644
--- a/dual-master/cf-service-lb.yml
+++ b/dual-master/cf-service-lb.yml
@@ -27,22 +27,6 @@
         Description: How many instances of this task should we run across our cluster?
         Type: Number
         Default: 1
-  HTTPGerritMaster1Port:
-        Description: Gerrit HTTP port
-        Type: Number
-        Default: 8080
-  SSHGerritMaster1Port:
-        Description: Gerrit SSH port
-        Type: Number
-        Default: 29418
-  HTTPGerritMaster2Port:
-        Description: Gerrit HTTP port
-        Type: Number
-        Default: 8081
-  SSHGerritMaster2Port:
-        Description: Gerrit SSH port
-        Type: Number
-        Default: 29419
   HTTPGerritPort:
         Description: Gerrit HTTP port
         Type: Number
@@ -123,14 +107,6 @@
                     - Name: GERRIT_MASTER_2_URL
                       Value:
                         Fn::ImportValue: !Join [':', [!Ref 'Master2ServiceStackName', 'PublicLoadBalancerDNSName']]
-                    - Name: GERRIT_MASTER_1_HTTP_PORT
-                      Value: !Ref HTTPGerritMaster1Port
-                    - Name: GERRIT_MASTER_2_HTTP_PORT
-                      Value: !Ref HTTPGerritMaster2Port
-                    - Name: GERRIT_MASTER_1_SSH_PORT
-                      Value: !Ref SSHGerritMaster1Port
-                    - Name: GERRIT_MASTER_2_SSH_PORT
-                      Value: !Ref SSHGerritMaster2Port
                     - Name: SYSLOG_SIDECAR
                       Value: !Ref SyslogSidecarServiceName
                   Cpu: 1024
diff --git a/dual-master/haproxy/haproxy.cfg.template b/dual-master/haproxy/haproxy.cfg.template
index ba04013..08536ac 100644
--- a/dual-master/haproxy/haproxy.cfg.template
+++ b/dual-master/haproxy/haproxy.cfg.template
@@ -41,18 +41,18 @@
     default-server inter 10s fall 3 rise 2
     option httpchk GET /config/server/healthcheck~status HTTP/1.0
     http-check expect status 200
-    server gerrit-1 $GERRIT_MASTER_1_URL:$GERRIT_MASTER_1_HTTP_PORT check inter 10s
-    server gerrit-2 $GERRIT_MASTER_2_URL:$GERRIT_MASTER_2_HTTP_PORT check inter 10s backup
+    server gerrit-1 $GERRIT_MASTER_1_URL:8080 check inter 10s
+    server gerrit-2 $GERRIT_MASTER_2_URL:8080 check inter 10s backup
 
 backend gerrit-1
     mode http
     option forwardfor
-    server gerrit-1 $GERRIT_MASTER_1_URL:$GERRIT_MASTER_1_HTTP_PORT
+    server gerrit-1 $GERRIT_MASTER_1_URL:8080
 
 backend gerrit-2
     mode http
     option forwardfor
-    server gerrit-2 $GERRIT_MASTER_2_URL:$GERRIT_MASTER_2_HTTP_PORT
+    server gerrit-2 $GERRIT_MASTER_2_URL:8080
 
 backend ssh
     mode tcp
@@ -62,15 +62,15 @@
     balance source
     timeout connect 10s
     timeout server 5m
-    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:$GERRIT_MASTER_1_SSH_PORT check port $GERRIT_MASTER_1_HTTP_PORT inter 10s
-    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:$GERRIT_MASTER_2_SSH_PORT check port $GERRIT_MASTER_2_HTTP_PORT inter 10s backup
+    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:29418 check port 8080 inter 10s
+    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:29418 check port 8080 inter 10s backup
 
 backend gerrit-ssh-1
     mode http
     option forwardfor
-    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:$GERRIT_MASTER_1_SSH_PORT
+    server gerrit-ssh-1 $GERRIT_MASTER_1_URL:29418
 
 backend gerrit-ssh-2
     mode http
     option forwardfor
-    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:$GERRIT_MASTER_2_SSH_PORT
+    server gerrit-ssh-2 $GERRIT_MASTER_2_URL:29418