Mobrovac has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377997 )

Change subject: WIP: Cassandra: Include only instance DNS' in the list of seeds
......................................................................

WIP: Cassandra: Include only instance DNS' in the list of seeds

Change-Id: I0a00f1d8efb143edfe18a8749dfbda3ba32753e3
---
M modules/cassandra/templates/cassandra.yaml-2.1.erb
M modules/cassandra/templates/cassandra.yaml-2.2.erb
M modules/cassandra/templates/cassandra.yaml-3.x.erb
M modules/profile/manifests/cassandra.pp
M modules/profile/templates/cassandra/seeds.erb
5 files changed, 14 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/97/377997/1

diff --git a/modules/cassandra/templates/cassandra.yaml-2.1.erb 
b/modules/cassandra/templates/cassandra.yaml-2.1.erb
index 63775da..12f9d80 100644
--- a/modules/cassandra/templates/cassandra.yaml-2.1.erb
+++ b/modules/cassandra/templates/cassandra.yaml-2.1.erb
@@ -273,10 +273,7 @@
                                                       x != @hostname \
                                                       && ! (x.start_with? 
"#{@hostname}-") \
                                                       && x != @ipaddress \
-                                                      && x != @fqdn \
-                                                      && 
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
-                                                        || @instance_count == 
1 \
-                                                        || 
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
+                                                      && x != @fqdn)
                                                   }.join(',') : 
@seeds.join(',') %>
          - seeds: <%= clean_seeds %>
 # For workloads with more data than can fit in memory, Cassandra's
diff --git a/modules/cassandra/templates/cassandra.yaml-2.2.erb 
b/modules/cassandra/templates/cassandra.yaml-2.2.erb
index cdf6404..c0ff8d3 100644
--- a/modules/cassandra/templates/cassandra.yaml-2.2.erb
+++ b/modules/cassandra/templates/cassandra.yaml-2.2.erb
@@ -318,10 +318,7 @@
                                                       x != @hostname \
                                                       && ! (x.start_with? 
"#{@hostname}-") \
                                                       && x != @ipaddress \
-                                                      && x != @fqdn \
-                                                      && 
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
-                                                        || @instance_count == 
1 \
-                                                        || 
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
+                                                      && x != @fqdn)
                                                   }.join(',') : 
@seeds.join(',') %>
          - seeds: <%= clean_seeds %>
 # For workloads with more data than can fit in memory, Cassandra's
diff --git a/modules/cassandra/templates/cassandra.yaml-3.x.erb 
b/modules/cassandra/templates/cassandra.yaml-3.x.erb
index 46edbb3..95281db 100644
--- a/modules/cassandra/templates/cassandra.yaml-3.x.erb
+++ b/modules/cassandra/templates/cassandra.yaml-3.x.erb
@@ -404,10 +404,7 @@
                                                       x != @hostname \
                                                       && ! (x.start_with? 
"#{@hostname}-") \
                                                       && x != @ipaddress \
-                                                      && x != @fqdn \
-                                                      && 
(/^.+-[a-z]\.(?:eqiad|codfw)\.wmnet$/ =~ x \
-                                                        || @instance_count == 
1 \
-                                                        || 
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ =~ x)
+                                                      && x != @fqdn)
                                                   }.join(',') : 
@seeds.join(',') %>
          - seeds: <%= clean_seeds %>
 # For workloads with more data than can fit in memory, Cassandra's
diff --git a/modules/profile/manifests/cassandra.pp 
b/modules/profile/manifests/cassandra.pp
index 629b0f4..217724d 100644
--- a/modules/profile/manifests/cassandra.pp
+++ b/modules/profile/manifests/cassandra.pp
@@ -14,7 +14,9 @@
     $instances = $all_instances[$::fqdn]
     # We get the cassandra seeds from $all_instances, with a template hack
     # This is preferred over a very specialized parser function.
-    $seeds = split(template('profile/cassandra/seeds.erb'), '\|')
+    $all_seeds = split(template('profile/cassandra/seeds.erb'), '\|')
+    $seeds = split($all_seeds[0], ',')
+    $ferm_seeds = split($all_seeds[1], ',')
 
     $base_settings = {
         'instances' => $instances,
@@ -70,7 +72,7 @@
         description => 'Cassandra server',
     }
 
-    $cassandra_hosts_ferm = join($seeds, ' ')
+    $cassandra_hosts_ferm = join($ferm_seeds, ' ')
     $prometheus_nodes_ferm = join($prometheus_nodes, ' ')
 
     # Cassandra intra-node messaging
diff --git a/modules/profile/templates/cassandra/seeds.erb 
b/modules/profile/templates/cassandra/seeds.erb
index 2ab00ec..da0ab36 100644
--- a/modules/profile/templates/cassandra/seeds.erb
+++ b/modules/profile/templates/cassandra/seeds.erb
@@ -1,9 +1,13 @@
 <%-
 seeds = []
+ferm_seeds = []
 @all_instances.each do |host, instances|
-  seeds << host
+  ferm_seeds << host
+  seeds << host if instances.empty?
   hostname = host.split(".").shift()
   instances.each do |instance, _|
-    seeds << host.gsub(hostname, "#{hostname}-#{instance}")
+    instance_host = host.gsub(hostname, "#{hostname}-#{instance}")
+    seeds << instance_host
+    ferm_seeds << instance_host
   end
-end -%><%= seeds.join "|" -%>
+end -%><%= "#{seeds.join ","}|#{ferm_seeds.join ","} -%>

-- 
To view, visit https://gerrit.wikimedia.org/r/377997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a00f1d8efb143edfe18a8749dfbda3ba32753e3
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <mobro...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to