20610: Removes duplication on balancer & backend declarations.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 26 Jul 2023 21:06:41 +0000 (18:06 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 26 Jul 2023 21:06:41 +0000 (18:06 -0300)
Instead of having to explicitly declare those, just use the ROLES map
to get the balancer and controller nodes.
Also, explicitly gives PG access to Keep-Balance instead of assuming it's
installed on the same node as the controller.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

tools/salt-install/config_examples/multi_host/aws/pillars/letsencrypt_balancer_configuration.sls
tools/salt-install/config_examples/multi_host/aws/pillars/nginx_balancer_configuration.sls
tools/salt-install/config_examples/multi_host/aws/pillars/postgresql.sls
tools/salt-install/local.params.example.multiple_hosts
tools/salt-install/provision.sh

index f2d4b647b7e5a9883cc1b2180a10ca473809177f..f2de52d33c1f48590ad7fe9fd323505dd07a5444 100644 (file)
@@ -6,5 +6,5 @@
 ### LETSENCRYPT
 letsencrypt:
   domainsets:
-    __BALANCER_NODENAME__.__DOMAIN__:
+    __BALANCER_NODENAME__:
       - __DOMAIN__
index 25179953051c02ea14681b82cccd1c7da694cc84..92ad3af2e8381de829980eda56789d8331122344 100644 (file)
@@ -5,8 +5,7 @@
 
 {%- import_yaml "ssl_key_encrypted.sls" as ssl_key_encrypted_pillar %}
 {%- set domain = "__DOMAIN__" %}
-{%- set enable_balancer = ("__ENABLE_BALANCER__"|to_bool) %}
-{%- set balancer_backends = "__BALANCER_BACKENDS__".split(",") if enable_balancer else [] %}
+{%- set balancer_backends = "__CONTROLLER_NODES__".split(",") %}
 
 ### NGINX
 nginx:
@@ -21,7 +20,7 @@ nginx:
           '__CLUSTER_INT_CIDR__': 0
         upstream controller_upstream:
         {%- for backend in balancer_backends %}
-          'server {{ backend }}.{{ domain }}:80': ''
+          'server {{ backend }}:80': ''
         {%- endfor %}
 
   ### SNIPPETS
index afe843aa7dd8014c2c8fab0937f0d32b524fb435..cc9d7eedf333b477fb3649fe7f81944f346ffa27 100644 (file)
@@ -4,9 +4,9 @@
 # SPDX-License-Identifier: AGPL-3.0
 
 {%- set domain = "__DOMAIN__" %}
-{%- set enable_balancer = ("__ENABLE_BALANCER__"|to_bool) %}
-{%- set balancer_backends = "__BALANCER_BACKENDS__".split(",") if enable_balancer else [] %}
+{%- set controller_nodes = "__CONTROLLER_NODES__".split(",") %}
 {%- set dispatcher_ip = "__DISPATCHER_INT_IP__" %}
+{%- set keepbalance_ip = "__KEEPBALANCE_INT_IP__" %}
 
 ### POSTGRESQL
 postgres:
@@ -23,14 +23,11 @@ postgres:
     - ['host', 'all', 'all', '::1/128', 'md5']
     - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '127.0.0.1/32']
     - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ dispatcher_ip }}/32']
-    {%- if enable_balancer %}
-    {%- for backend in balancer_backends %}
-    {%- set controller_ip = salt['cmd.run']("getent hosts "+backend+"."+domain+" | awk '{print $1 ; exit}'", python_shell=True) %}
+    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ keepbalance_ip }}/32']
+    {%- for controller_hostname in controller_nodes %}
+    {%- set controller_ip = salt['cmd.run']("getent hosts "+controller_hostname+" | awk '{print $1 ; exit}'", python_shell=True) %}
     - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '{{ controller_ip }}/32']
     {%- endfor %}
-    {%- else %}
-    - ['host', '__CLUSTER___arvados', '__CLUSTER___arvados', '__CONTROLLER_INT_IP__/32']
-    {%- endif %}
   users:
     __CLUSTER___arvados:
       ensure: present
index c16b9cc27ba4b61045f69f11da73e308b5365034..4234a965d5ebd8cc113e4e2971bf8a69789a22b7 100644 (file)
@@ -165,8 +165,6 @@ SHELL_INT_IP=10.1.2.17
 
 # Load balancing settings
 ENABLE_BALANCER="no"
-BALANCER_BACKENDS="controller1,controller2"
-BALANCER_NODENAME="controller"
 
 # Performance tuning parameters
 #CONTROLLER_NGINX_WORKERS=
index c79d16dec85737d4bce7134ef08a52ac96da254e..78bd976e6b28e77b4b0f3c05bb703bb3a0786dae 100755 (executable)
@@ -466,8 +466,8 @@ for f in $(ls "${SOURCE_PILLARS_DIR}"/*); do
        s#__MONITORING_PASSWORD__#${MONITORING_PASSWORD}#g;
        s#__DISPATCHER_SSH_PRIVKEY__#${DISPATCHER_SSH_PRIVKEY//$'\n'/\\n}#g;
        s#__ENABLE_BALANCER__#${ENABLE_BALANCER}#g;
-       s#__BALANCER_NODENAME__#${BALANCER_NODENAME}#g;
-       s#__BALANCER_BACKENDS__#${BALANCER_BACKENDS}#g;
+       s#__BALANCER_NODENAME__#${ROLES['balancer']}#g;
+       s#__CONTROLLER_NODES__#${ROLES['controller']}#g;
        s#__NODELIST__#${NODELIST}#g;
        s#__DISPATCHER_INT_IP__#${DISPATCHER_INT_IP}#g;
        s#__KEEPBALANCE_INT_IP__#${KEEPBALANCE_INT_IP}#g;
@@ -558,8 +558,8 @@ if [ -d "${SOURCE_STATES_DIR}" ]; then
          s#__MONITORING_PASSWORD__#${MONITORING_PASSWORD}#g;
          s#__DISPATCHER_SSH_PRIVKEY__#${DISPATCHER_SSH_PRIVKEY//$'\n'/\\n}#g;
          s#__ENABLE_BALANCER__#${ENABLE_BALANCER}#g;
-         s#__BALANCER_NODENAME__#${BALANCER_NODENAME}#g;
-         s#__BALANCER_BACKENDS__#${BALANCER_BACKENDS}#g;
+         s#__BALANCER_NODENAME__#${ROLES['balancer']}#g;
+         s#__CONTROLLER_NODES__#${ROLES['controller']}#g;
          s#__NODELIST__#${NODELIST}#g;
          s#__DISPATCHER_INT_IP__#${DISPATCHER_INT_IP}#g;
          s#__KEEPBALANCE_INT_IP__#${KEEPBALANCE_INT_IP}#g;
@@ -877,9 +877,9 @@ else
           grep -q "letsencrypt"     ${P_DIR}/top.sls || echo "    - letsencrypt" >> ${P_DIR}/top.sls
 
           grep -q "letsencrypt_${R}_configuration" ${P_DIR}/top.sls || echo "    - letsencrypt_${R}_configuration" >> ${P_DIR}/top.sls
-          sed -i "s/__CERT_REQUIRES__/cmd: create-initial-cert-${BALANCER_NODENAME}.${DOMAIN}*/g;
-                  s#__CERT_PEM__#/etc/letsencrypt/live/${BALANCER_NODENAME}.${DOMAIN}/fullchain.pem#g;
-                  s#__CERT_KEY__#/etc/letsencrypt/live/${BALANCER_NODENAME}.${DOMAIN}/privkey.pem#g" \
+          sed -i "s/__CERT_REQUIRES__/cmd: create-initial-cert-${ROLES["balancer"]}*/g;
+                  s#__CERT_PEM__#/etc/letsencrypt/live/${ROLES["balancer"]}/fullchain.pem#g;
+                  s#__CERT_KEY__#/etc/letsencrypt/live/${ROLES["balancer"]}/privkey.pem#g" \
           ${P_DIR}/nginx_${R}_configuration.sls
 
           if [ "${USE_LETSENCRYPT_ROUTE53}" = "yes" ]; then