BBlack has submitted this change and it was merged.

Change subject: remove role::cache::2layer
......................................................................


remove role::cache::2layer

For a long time now, all concrete cache roles have been inherting
r::c::2layer which inherits r::c::base.  The distinction is
historical; there used to be a 1layer class as well, but there is
no more and we don't expect to add one anytime soon.  This
collapses the 2layer bits into the base class for simplification.

Change-Id: I538f5838d42d1e1d4f2a030f6f803dbf7252a519
---
D hieradata/common/role/cache/2layer.yaml
M hieradata/labs.yaml
D modules/role/manifests/cache/2layer.pp
M modules/role/manifests/cache/base.pp
M modules/role/manifests/cache/instances.pp
M modules/role/manifests/cache/maps.pp
M modules/role/manifests/cache/misc.pp
M modules/role/manifests/cache/text.pp
M modules/role/manifests/cache/upload.pp
M modules/varnish/manifests/htcppurger.pp
10 files changed, 111 insertions(+), 107 deletions(-)

Approvals:
  BBlack: Verified; Looks good to me, approved



diff --git a/hieradata/common/role/cache/2layer.yaml 
b/hieradata/common/role/cache/2layer.yaml
deleted file mode 100644
index 45c2ece..0000000
--- a/hieradata/common/role/cache/2layer.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-role::cache::2layer::storage_parts:
-  - sda3
-  - sdb3
diff --git a/hieradata/labs.yaml b/hieradata/labs.yaml
index e70bc12..41553b4 100644
--- a/hieradata/labs.yaml
+++ b/hieradata/labs.yaml
@@ -101,7 +101,7 @@
 role::cache::text::static_host: 'deployment.wikimedia.beta.wmflabs.org'
 role::cache::text::shortener_domain: 'w-beta.wmflabs.org'
 role::cache::text::top_domain: 'beta.wmflabs.org'
-role::cache::2layer::storage_parts:
+role::cache::base::storage_parts:
   - vdb
   - vdb
 varnish::dynamic_directors: false
diff --git a/modules/role/manifests/cache/2layer.pp 
b/modules/role/manifests/cache/2layer.pp
deleted file mode 100644
index 44f46e7..0000000
--- a/modules/role/manifests/cache/2layer.pp
+++ /dev/null
@@ -1,80 +0,0 @@
-# To be included by all concrete 2layer cache roles
-class role::cache::2layer(
-    $storage_parts = undef
-) {
-    include role::cache::base
-    include ::standard
-
-    $varnish_version4 = hiera('varnish_version4', false)
-
-    if $varnish_version4 {
-        salt::grain { 'varnish_version':
-            ensure  => present,
-            replace => true,
-            value   => 4,
-        }
-    } else {
-        salt::grain { 'varnish_version':
-            ensure  => present,
-            replace => true,
-            value   => 3,
-        }
-    }
-
-    # Ganglia monitoring
-    if $::standard::has_ganglia {
-        class { 'varnish::monitoring::ganglia':
-            varnish_instances => [ '', 'frontend' ],
-        }
-    }
-
-    # mma: mmap addrseses for fixed persistent storage on x86_64 Linux:
-    #  This scheme fits 4x fixed memory mappings of up to 4TB each
-    #  into the range 0x500000000000 - 0x5FFFFFFFFFFF, which on
-    #  x86_64 Linux is in the middle of the user address space and thus
-    #  unlikely to ever be used by normal, auto-addressed allocations,
-    #  as those grow in from the edges (typically from the top, but
-    #  possibly from the bottom depending).  Regardless of which
-    #  direction heap grows from, there's 32TB or more for normal
-    #  allocations to chew through before they reach our fixed range.
-    $mma = [
-        '0x500000000000',
-        '0x540000000000',
-        '0x580000000000',
-        '0x5C0000000000',
-    ]
-
-    # everything from here down is related to backend storage/weight config
-
-    $storage_size = $::hostname ? {
-        /^cp1008$/          => 117, # Intel X-25M 160G (test host!)
-        /^cp30(0[3-9]|10)$/ => 460, # Intel M320 600G via H710
-        /^cp400[1234]$/     => 220, # Seagate ST9250610NS - 250G (only non-SSD 
left!)
-        /^cp[0-9]{4}$/      => 360, # Intel S3700 400G (prod default)
-        default             => 6,   # 6 is the bare min, for e.g. virtuals
-    }
-
-    $filesystems = unique($storage_parts)
-    varnish::setup_filesystem { $filesystems: }
-    Varnish::Setup_filesystem <| |> -> Varnish::Instance <| |>
-
-    if ($varnish_version4) {
-        # https://www.varnish-cache.org/docs/trunk/phk/persistent.html
-        $persistent_name = 'deprecated_persistent'
-    }
-    else {
-        $persistent_name = 'persistent'
-    }
-
-    # This is the "normal" persistent storage varnish args, for consuming all 
available space
-    # (upload uses something more complex than this based on our storage vars 
above as well!)
-    $persistent_storage_args = join([
-        "-s 
main1=${persistent_name},/srv/${storage_parts[0]}/varnish.main1,${storage_size}G,${mma[0]}",
-        "-s 
main2=${persistent_name},/srv/${storage_parts[1]}/varnish.main2,${storage_size}G,${mma[1]}",
-    ], ' ')
-
-    $file_storage_args = join([
-        "-s 
main1=file,/srv/${storage_parts[0]}/varnish.main1,${storage_size}G",
-        "-s 
main2=file,/srv/${storage_parts[1]}/varnish.main2,${storage_size}G",
-    ], ' ')
-}
diff --git a/modules/role/manifests/cache/base.pp 
b/modules/role/manifests/cache/base.pp
index a586b85..a0820ad 100644
--- a/modules/role/manifests/cache/base.pp
+++ b/modules/role/manifests/cache/base.pp
@@ -2,6 +2,7 @@
     $zero_site = 'https://zero.wikimedia.org',
     $purge_host_only_upload_re = '^upload\.wikimedia\.org$',
     $purge_host_not_upload_re = '^(?!upload\.wikimedia\.org)',
+    $storage_parts = ['sda3', 'sdb3'],
 ) {
     include standard
     include nrpe
@@ -14,6 +15,48 @@
     system::role { "role::cache::${cache_cluster}":
         description => "${cache_cluster} Varnish cache server",
     }
+
+    # Ganglia monitoring
+    if $::standard::has_ganglia {
+        class { 'varnish::monitoring::ganglia':
+            varnish_instances => [ '', 'frontend' ],
+        }
+    }
+
+    # Only production needs system perf tweaks and NFS client disable
+    if $::realm == 'production' {
+        include role::cache::perf
+        include base::no_nfs_client
+    }
+
+    # Not ideal factorization to put this here, but works for now
+    class { 'varnish::zero_update':
+        site         => $zero_site,
+    }
+
+    ###########################################################################
+    # Varnish4 Transition
+    ###########################################################################
+
+    $varnish_version4 = hiera('varnish_version4', false)
+
+    if $varnish_version4 {
+        salt::grain { 'varnish_version':
+            ensure  => present,
+            replace => true,
+            value   => 4,
+        }
+    } else {
+        salt::grain { 'varnish_version':
+            ensure  => present,
+            replace => true,
+            value   => 3,
+        }
+    }
+
+    ###########################################################################
+    # Analytics/Logging stuff
+    ###########################################################################
 
     # Client connection stats from the 'X-Connection-Properties'
     # header set by the SSL terminators.
@@ -41,17 +84,6 @@
     ::varnish::logging::xcache { 'xcache':
         key_prefix    => "varnish.${::site}.${cache_cluster}.xcache",
         statsd_server => hiera('statsd'),
-    }
-
-    # Only production needs system perf tweaks and NFS client disable
-    if $::realm == 'production' {
-        include role::cache::perf
-        include base::no_nfs_client
-    }
-
-    # Not ideal factorization to put this here, but works for now
-    class { 'varnish::zero_update':
-        site         => $zero_site,
     }
 
     ###########################################################################
@@ -90,4 +122,59 @@
         require  => File[$tp_unit_path],
         critical => false, # promote to true once better-tested in the real 
world
     }
+
+
+    ###########################################################################
+    # Storage configuration
+    ###########################################################################
+
+    # mma: mmap addrseses for fixed persistent storage on x86_64 Linux:
+    #  This scheme fits 4x fixed memory mappings of up to 4TB each
+    #  into the range 0x500000000000 - 0x5FFFFFFFFFFF, which on
+    #  x86_64 Linux is in the middle of the user address space and thus
+    #  unlikely to ever be used by normal, auto-addressed allocations,
+    #  as those grow in from the edges (typically from the top, but
+    #  possibly from the bottom depending).  Regardless of which
+    #  direction heap grows from, there's 32TB or more for normal
+    #  allocations to chew through before they reach our fixed range.
+    $mma = [
+        '0x500000000000',
+        '0x540000000000',
+        '0x580000000000',
+        '0x5C0000000000',
+    ]
+
+    # everything from here down is related to backend storage/weight config
+
+    $storage_size = $::hostname ? {
+        /^cp1008$/          => 117, # Intel X-25M 160G (test host!)
+        /^cp30(0[3-9]|10)$/ => 460, # Intel M320 600G via H710
+        /^cp400[1234]$/     => 220, # Seagate ST9250610NS - 250G (only non-SSD 
left!)
+        /^cp[0-9]{4}$/      => 360, # Intel S3700 400G (prod default)
+        default             => 6,   # 6 is the bare min, for e.g. virtuals
+    }
+
+    $filesystems = unique($storage_parts)
+    varnish::setup_filesystem { $filesystems: }
+    Varnish::Setup_filesystem <| |> -> Varnish::Instance <| |>
+
+    if ($varnish_version4) {
+        # https://www.varnish-cache.org/docs/trunk/phk/persistent.html
+        $persistent_name = 'deprecated_persistent'
+    }
+    else {
+        $persistent_name = 'persistent'
+    }
+
+    # This is the "normal" persistent storage varnish args, for consuming all 
available space
+    # (upload uses something more complex than this based on our storage vars 
above as well!)
+    $persistent_storage_args = join([
+        "-s 
main1=${persistent_name},/srv/${storage_parts[0]}/varnish.main1,${storage_size}G,${mma[0]}",
+        "-s 
main2=${persistent_name},/srv/${storage_parts[1]}/varnish.main2,${storage_size}G,${mma[1]}",
+    ], ' ')
+
+    $file_storage_args = join([
+        "-s 
main1=file,/srv/${storage_parts[0]}/varnish.main1,${storage_size}G",
+        "-s 
main2=file,/srv/${storage_parts[1]}/varnish.main2,${storage_size}G",
+    ], ' ')
 }
diff --git a/modules/role/manifests/cache/instances.pp 
b/modules/role/manifests/cache/instances.pp
index d52d3b4..0f653fd 100644
--- a/modules/role/manifests/cache/instances.pp
+++ b/modules/role/manifests/cache/instances.pp
@@ -1,4 +1,4 @@
-# This defines the pair of varnish::instance for a 2layer/2tier cache cluster
+# This defines the pair of varnish::instance for a 2-layer (fe+be) cache node
 define role::cache::instances (
     $fe_mem_gb,
     $fe_jemalloc_conf,
diff --git a/modules/role/manifests/cache/maps.pp 
b/modules/role/manifests/cache/maps.pp
index c71317a..2bb0f5a 100644
--- a/modules/role/manifests/cache/maps.pp
+++ b/modules/role/manifests/cache/maps.pp
@@ -1,5 +1,5 @@
 class role::cache::maps {
-    include role::cache::2layer
+    include role::cache::base
     include role::cache::ssl::unified
     include ::standard
 
@@ -64,7 +64,7 @@
         be_vcl_config     => $common_vcl_config,
         fe_extra_vcl      => [],
         be_extra_vcl      => [],
-        be_storage        => $::role::cache::2layer::file_storage_args,
+        be_storage        => $::role::cache::base::file_storage_args,
         fe_cache_be_opts  => $fe_cache_be_opts,
         be_cache_be_opts  => $be_cache_be_opts,
         cluster_nodes     => hiera('cache::maps::nodes'),
diff --git a/modules/role/manifests/cache/misc.pp 
b/modules/role/manifests/cache/misc.pp
index 27df631..e56e77a 100644
--- a/modules/role/manifests/cache/misc.pp
+++ b/modules/role/manifests/cache/misc.pp
@@ -1,5 +1,5 @@
 class role::cache::misc {
-    include role::cache::2layer
+    include role::cache::base
     include role::cache::ssl::misc
 
     class { 'varnish::htcppurger':
@@ -311,7 +311,7 @@
         be_vcl_config     => $be_vcl_config,
         fe_extra_vcl      => ['misc-common'],
         be_extra_vcl      => ['misc-common'],
-        be_storage        => $::role::cache::2layer::file_storage_args,
+        be_storage        => $::role::cache::base::file_storage_args,
         fe_cache_be_opts  => $fe_cache_be_opts,
         be_cache_be_opts  => $be_cache_be_opts,
         cluster_nodes     => hiera('cache::misc::nodes'),
diff --git a/modules/role/manifests/cache/text.pp 
b/modules/role/manifests/cache/text.pp
index 3a4ed76..5648714 100644
--- a/modules/role/manifests/cache/text.pp
+++ b/modules/role/manifests/cache/text.pp
@@ -6,7 +6,7 @@
 ) {
     require geoip
     require geoip::dev # for VCL compilation using libGeoIP
-    include role::cache::2layer
+    include role::cache::base
     include role::cache::ssl::unified
     include ::standard
     if $::standard::has_ganglia {
@@ -123,7 +123,7 @@
         be_vcl_config     => $be_vcl_config,
         fe_extra_vcl      => ['text-common', 'zero', 'normalize_path', 
'geoip'],
         be_extra_vcl      => ['text-common', 'normalize_path'],
-        be_storage        => $::role::cache::2layer::persistent_storage_args,
+        be_storage        => $::role::cache::base::persistent_storage_args,
         fe_cache_be_opts  => $fe_cache_be_opts,
         be_cache_be_opts  => $be_cache_be_opts,
         cluster_nodes     => hiera('cache::text::nodes'),
diff --git a/modules/role/manifests/cache/upload.pp 
b/modules/role/manifests/cache/upload.pp
index a182db1..590b636 100644
--- a/modules/role/manifests/cache/upload.pp
+++ b/modules/role/manifests/cache/upload.pp
@@ -1,7 +1,7 @@
 class role::cache::upload(
     $upload_domain = 'upload.wikimedia.org',
 ) {
-    include role::cache::2layer
+    include role::cache::base
     include role::cache::ssl::unified
     include ::standard
     if $::standard::has_ganglia {
@@ -82,9 +82,9 @@
     })
 
     # See T145661 for storage binning rationale
-    $sda = $::role::cache::2layer::storage_parts[0]
-    $sdb = $::role::cache::2layer::storage_parts[1]
-    $ssm = $::role::cache::2layer::storage_size * 2 * 1024
+    $sda = $::role::cache::base::storage_parts[0]
+    $sdb = $::role::cache::base::storage_parts[1]
+    $ssm = $::role::cache::base::storage_size * 2 * 1024
     $bin0_size = floor($ssm * 0.03)
     $bin1_size = floor($ssm * 0.20)
     $bin2_size = floor($ssm * 0.43)
diff --git a/modules/varnish/manifests/htcppurger.pp 
b/modules/varnish/manifests/htcppurger.pp
index 36da6fa..1512f02 100644
--- a/modules/varnish/manifests/htcppurger.pp
+++ b/modules/varnish/manifests/htcppurger.pp
@@ -9,7 +9,7 @@
 #
 # [*varnishes*]
 #   Array of 'IP:Port' for local varnish instances to forward to, defaults to
-#   ports 80 and 3128 on localhost (our standard 2layer frontend + backend
+#   ports 3127 and 3128 on localhost (our standard 2-layer frontend + backend
 #   instances).
 #
 # === Multicast assignments:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I538f5838d42d1e1d4f2a030f6f803dbf7252a519
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BBlack <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Ema <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to