Handle the hardcoded configuration values

This patch allows to customize the hardcoded configuration values,
as well as introduce new configuration options for barbican services
by configmap template with the specified section:

  barbican:
    server:
      configmap:
        DEFAULT:
          max_allowed_secret_in_bytes: 10000
          max_allowed_request_size_in_bytes: 1000000
          sql_pool_max_overflow: 10
          default_limit_paging: 10
          max_limit_paging: 100
        quotas:
          quota_secrets: -1
          quota_orders: -1
          quota_containers: -1
          quota_consumers: -1
          quota_cas: -1

Change-Id: Ibef6f409396bb862436ac747e4fa7cf3564d8eff
Related-Prod: PROD-29627
(cherry picked from commit ad898b285e9bfbf9e39e8bf343f998bc316e988f)
diff --git a/README.rst b/README.rst
index 0557f46..904bf22 100644
--- a/README.rst
+++ b/README.rst
@@ -460,6 +460,27 @@
             strategy: ENCRYPT
             secret_key: secret
 
+Change default options using configmap template settings
+========================================================
+
+.. code-block:: yaml
+
+  barbican:
+    server:
+      configmap:
+        DEFAULT:
+          max_allowed_secret_in_bytes: 10000
+          max_allowed_request_size_in_bytes: 1000000
+          sql_pool_max_overflow: 10
+          default_limit_paging: 10
+          max_limit_paging: 100
+        quotas:
+          quota_secrets: -1
+          quota_orders: -1
+          quota_containers: -1
+          quota_consumers: -1
+          quota_cas: -1
+
 Read more
 =========
 
diff --git a/barbican/files/ocata/barbican.conf.Debian b/barbican/files/ocata/barbican.conf.Debian
index 0eac5f9..0c17305 100644
--- a/barbican/files/ocata/barbican.conf.Debian
+++ b/barbican/files/ocata/barbican.conf.Debian
@@ -626,3 +626,8 @@
 
 # Config Section from which to load plugin specific options (string value)
 #auth_section = <None>
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/barbican/files/pike/barbican.conf.Debian b/barbican/files/pike/barbican.conf.Debian
index cedba13..c132ee8 100644
--- a/barbican/files/pike/barbican.conf.Debian
+++ b/barbican/files/pike/barbican.conf.Debian
@@ -664,3 +664,8 @@
 
 # Config Section from which to load plugin specific options (string value)
 #auth_section = <None>
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/barbican/files/queens/barbican.conf.Debian b/barbican/files/queens/barbican.conf.Debian
index 6a88c7d..c9d230d 100644
--- a/barbican/files/queens/barbican.conf.Debian
+++ b/barbican/files/queens/barbican.conf.Debian
@@ -431,3 +431,8 @@
 [cache]
 {%- include "oslo_templates/files/queens/oslo/_cache.conf" %}
 {%- endif %}
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index 51e4e7e..e9e4cac 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -103,6 +103,19 @@
           enabled: false
         ossyslog:
           enabled: false
+    configmap:
+      DEFAULT:
+        max_allowed_secret_in_bytes: 10000
+        max_allowed_request_size_in_bytes: 1000000
+        sql_pool_max_overflow: 10
+        default_limit_paging: 10
+        max_limit_paging: 100
+      quotas:
+        quota_secrets: -1
+        quota_orders: -1
+        quota_containers: -1
+        quota_consumers: -1
+        quota_cas: -1
 apache:
   server:
     enabled: true
diff --git a/tests/pillar/control_single.sls b/tests/pillar/control_single.sls
index 7dde92d..91ea05e 100644
--- a/tests/pillar/control_single.sls
+++ b/tests/pillar/control_single.sls
@@ -94,6 +94,19 @@
           enabled: false
         ossyslog:
           enabled: false
+    configmap:
+      DEFAULT:
+        max_allowed_secret_in_bytes: 10000
+        max_allowed_request_size_in_bytes: 1000000
+        sql_pool_max_overflow: 10
+        default_limit_paging: 10
+        max_limit_paging: 100
+      quotas:
+        quota_secrets: -1
+        quota_orders: -1
+        quota_containers: -1
+        quota_consumers: -1
+        quota_cas: -1
 apache:
   server:
     enabled: true