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
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/barbican/files/rocky/barbican.conf.Debian b/barbican/files/rocky/barbican.conf.Debian
index afd45f2..61eaec4 100644
--- a/barbican/files/rocky/barbican.conf.Debian
+++ b/barbican/files/rocky/barbican.conf.Debian
@@ -424,3 +424,8 @@
 [cache]
 {%- include "oslo_templates/files/" ~ server.version ~ "/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 e485a24..2efac2a 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 515a2b0..9b1c642 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