Merge branch 'main' into 21357-favorites-names
[arvados.git] / tools / salt-install / common.sh
index d406f2ff60ab70522fc8f101d4c76f30ea17c15a..5392da71be938c372cfdee0493a864596cb19d29 100644 (file)
@@ -16,6 +16,10 @@ else
   exit 1
 fi
 
+USE_SSH_JUMPHOST=${USE_SSH_JUMPHOST:-}
+DISABLED_CONTROLLER=""
+DATABASE_POSTGRESQL_DEFAULT_VERSION=15
+
 # Comma-separated list of nodes. This is used to dynamically adjust
 # salt pillars.
 NODELIST=""
@@ -29,7 +33,6 @@ done
 
 # The mapping of roles to nodes. This is used to dynamically adjust
 # salt pillars.
-declare -A ROLE2NODES
 for node in "${!NODES[@]}"; do
   roles="${NODES[$node]}"
 
@@ -45,9 +48,22 @@ for node in "${!NODES[@]}"; do
   done
 done
 
+# Sets TLS certificate expiration thresholds
+TLS_EXPIRATION_YELLOW=5184000 # > 2 months
+TLS_EXPIRATION_GREEN=15552000 # > 6 months
+if [[ "${SSL_MODE}" == "lets-encrypt" ]]; then
+  TLS_EXPIRATION_YELLOW=1900800 # > 22 days
+  TLS_EXPIRATION_GREEN=2505600 # > 29 days
+fi
+
 # Auto-detects load-balancing mode
 if [ -z "${ROLE2NODES['balancer']:-}" ]; then
   ENABLE_BALANCER="no"
 else
   ENABLE_BALANCER="yes"
 fi
+
+# Auto-sets PG version if needed
+if [[ -n "${ROLE2NODES['database']:-}" || "${NODELIST}" == "localhost" ]]; then
+  DATABASE_POSTGRESQL_VERSION="${DATABASE_POSTGRESQL_VERSION:-${DATABASE_POSTGRESQL_DEFAULT_VERSION}}"
+fi
\ No newline at end of file