Mark Bergsma has submitted this change and it was merged.

Change subject: Remove the upload-specific backend section in 
upload-backend.inc.vcl
......................................................................


Remove the upload-specific backend section in upload-backend.inc.vcl

This is no longer needed now the backend-specific options can be
specified for the backends generated by wikimedia.vcl as well

Change-Id: I63afa4e7d15aac85fe96fa831817c576c6261e3c
---
M manifests/role/cache.pp
M templates/varnish/upload-backend.inc.vcl.erb
2 files changed, 14 insertions(+), 61 deletions(-)

Approvals:
  Mark Bergsma: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/cache.pp b/manifests/role/cache.pp
index 6b8eeb3..363d68b 100644
--- a/manifests/role/cache.pp
+++ b/manifests/role/cache.pp
@@ -413,6 +413,7 @@
                                },
                                "esams" => {
                                        "backend" => 
$lvs::configuration::lvs_service_ips[$::realm]['upload']['eqiad']['uploadlb'],
+                                       "eqiad" => 
$role::cache::configuration::active_nodes[$::realm]['upload']['eqiad']
                                }
                        }
 
@@ -420,12 +421,10 @@
                                $storage_size_main = 100
                                $storage_size_bigobj = 10
                                $cluster_tier = 1
-                               $upstream_directors = {}
                        } else {
                                $storage_size_main = 300
                                $storage_size_bigobj = 50
                                $cluster_tier = 2
-                               $upstream_directors = { "eqiad" => 
$role::cache::configuration::active_nodes[$::realm]['upload']['eqiad'] }
                        }
 
                        if regsubst($::memorytotal, "^([0-9]+)\.[0-9]* GB$", 
"\1") > 96 {
@@ -473,15 +472,20 @@
                                        'retry5xx' => 0,
                                        'cache4xx' => "1m",
                                        'cluster_tier' => $cluster_tier,
-                                       'upstream_directors' => 
$upstream_directors
                                },
-                               backend_options => {
-                                       'port' => 80,
-                                       'connect_timeout' => "5s",
-                                       'first_byte_timeout' => "35s",
-                                       'between_bytes_timeout' => "4s",
-                                       'max_connections' => 1000,
-                               },
+                               backend_options => [
+                                       {
+                                               'backend_match' => 
"^cp[0-9]+\.eqiad\.wmnet$",
+                                               'port' => 3128,
+                                               'probe' => "varnish",
+                                       },
+                                       {
+                                               'port' => 80,
+                                               'connect_timeout' => "5s",
+                                               'first_byte_timeout' => "35s",
+                                               'between_bytes_timeout' => "4s",
+                                               'max_connections' => 1000,
+                                       }],
                                wikimedia_networks => 
$network::constants::all_networks,
                                xff_sources => $network::constants::all_networks
                        }
diff --git a/templates/varnish/upload-backend.inc.vcl.erb 
b/templates/varnish/upload-backend.inc.vcl.erb
index 335e286..83c05e1 100644
--- a/templates/varnish/upload-backend.inc.vcl.erb
+++ b/templates/varnish/upload-backend.inc.vcl.erb
@@ -1,57 +1,6 @@
 # Varnish VCL include file for upload backends
 
 import std;
-<%
-def backend_option(backend, option, default)
-       if varnish_backend_options.kind_of?(Array)
-               r = default
-               # List of hashes of options, 'backend_match' key is a regexp 
against the FQDN
-               varnish_backend_options.each do |be_options|
-                       if Regexp.new(be_options.fetch("backend_match", 
"^.*$")).match(backend)
-                               r = be_options.fetch(option, r)
-                       end
-               end
-               return r
-       else
-               return varnish_backend_options.fetch(option, default)
-       end
-end
--%>
-
-<% if vcl_config.fetch("cluster_tier", "1") == "2" -%>
-# Define backends and directors specific for upload
-
-# List of Puppet generated backends
-
-<%
-       vcl_config.fetch("upstream_directors", {}).values.flatten.sort.each do 
|backend|
-               name = backend =~ /^[0-9]\.]+$/ ? "ipv4_" + backend.gsub(".", 
"_") : backend.split(".")[0].gsub("-", "_")
--%>
-backend <%= name %> {
-       .host = "<%= backend %>";
-       .port = "3128";
-       .connect_timeout = <%= backend_option(backend, "connect_timeout", "2s") 
%>;
-       .first_byte_timeout = <%= backend_option(backend, "first_byte_timeout", 
"35s") %>;
-       .between_bytes_timeout = <%= backend_option(backend, 
"between_bytes_timeout", "2s") %>;
-       .max_connections = <%= backend_option(backend, "max_connections", 
"100") %>;
-       .probe = varnish;
-}
-<%     end -%>
-
-# Directors
-<%     vcl_config.fetch("upstream_directors", {}).each_pair do 
|director,backends| -%>
-director <%= director %> chash {
-<%
-               backends.sort.each do |backend|
-                       name = backend =~ /^[0-9]\.]+$/ ? "ipv4_" + 
backend.gsub(".", "_") : backend.split(".")[0].gsub("-", "_")
--%>
-       {       .backend = <%= name %>;
-               .weight = <%= backend_option(backend, "weight", 20) %>;
-       }
-<%             end -%>
-}
-<%     end -%>
-<% end -%>
 
 sub pick_main_stevedore {
        if (std.random(0, 2) < 1) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63afa4e7d15aac85fe96fa831817c576c6261e3c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mark Bergsma <[email protected]>
Gerrit-Reviewer: Mark Bergsma <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to