Handle the hardcoded configuration values
This patch allows to customize the hardcoded configuration values,
as well as introduce new configuration options for designate services
by configmap template with the specified section:
designate:
server:
configmap:
DEFAULT:
default_soa_refresh_min: 3500
default_soa_refresh_max: 3600
default_soa_minimum: 3600
'network_api:neutron':
admin_username: admin
admin_password: password
admin_tenant_name: tenant1
Change-Id: I43224d260bed265b21c748abe294c0a97bfb7f32
Related-Prod: PROD-29626
diff --git a/README.rst b/README.rst
index d43206c..2ed2f57 100644
--- a/README.rst
+++ b/README.rst
@@ -268,6 +268,23 @@
name: test.zone.
email: admin@test.zone
+Change default options using configmap template settings
+========================================================
+
+.. code-block:: yaml
+
+ designate:
+ server:
+ configmap:
+ DEFAULT:
+ default_soa_refresh_min: 3500
+ default_soa_refresh_max: 3600
+ default_soa_minimum: 3600
+ 'network_api:neutron':
+ admin_username: admin
+ admin_password: password
+ admin_tenant_name: tenant1
+
Upgrades
========
diff --git a/designate/files/ocata/designate.conf.Debian b/designate/files/ocata/designate.conf.Debian
index 89ed2ca..65857fc 100644
--- a/designate/files/ocata/designate.conf.Debian
+++ b/designate/files/ocata/designate.conf.Debian
@@ -651,3 +651,8 @@
{%- if server.identity.get('protocol', 'http') == 'https' %}
cafile = {{ server.identity.get('cacert_file', server.cacert_file) }}
{%- endif %}
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/designate/files/pike/designate.conf.Debian b/designate/files/pike/designate.conf.Debian
index ac3b91b..d0283b6 100644
--- a/designate/files/pike/designate.conf.Debian
+++ b/designate/files/pike/designate.conf.Debian
@@ -665,3 +665,8 @@
{%- if server.identity.get('protocol', 'http') == 'https' %}
cafile = {{ server.identity.get('cacert_file', server.cacert_file) }}
{%- endif %}
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/designate/files/queens/designate.conf.Debian b/designate/files/queens/designate.conf.Debian
index f27c6b8..854a7c1 100644
--- a/designate/files/queens/designate.conf.Debian
+++ b/designate/files/queens/designate.conf.Debian
@@ -1058,3 +1058,8 @@
{%- if 'cacert_file' not in server.database.ssl.keys() %}{% do _data['ssl'].update({'cacert_file': server.cacert_file}) %}{% endif %}
{%- endif %}
{%- include "oslo_templates/files/queens/oslo/_database.conf" %}
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/designate/files/rocky/designate.conf.Debian b/designate/files/rocky/designate.conf.Debian
index bce6609..432e76d 100644
--- a/designate/files/rocky/designate.conf.Debian
+++ b/designate/files/rocky/designate.conf.Debian
@@ -1088,3 +1088,8 @@
{%- if 'cacert_file' not in server.database.ssl.keys() %}{% do _data['ssl'].update({'cacert_file': server.cacert_file}) %}{% endif %}
{%- endif %}
{%- include "oslo_templates/files/queens/oslo/_database.conf" %}
+
+{%- if server.configmap is defined %}
+{%- set _data = server.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/tests/integration/ocata/server_cluster/config_spec.rb b/tests/integration/ocata/server_cluster/config_spec.rb
index 9330b40..714f7b2 100644
--- a/tests/integration/ocata/server_cluster/config_spec.rb
+++ b/tests/integration/ocata/server_cluster/config_spec.rb
@@ -24,6 +24,18 @@
'formatv6' => "'%(hostname)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -59,5 +71,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/ocata/server_single/config_spec.rb b/tests/integration/ocata/server_single/config_spec.rb
index 6ffe944..21147bb 100644
--- a/tests/integration/ocata/server_single/config_spec.rb
+++ b/tests/integration/ocata/server_single/config_spec.rb
@@ -25,6 +25,18 @@
'formatv6' => "'%(hostname)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -61,5 +73,17 @@
end
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/pike/server_cluster/config_spec.rb b/tests/integration/pike/server_cluster/config_spec.rb
index 870ac21..f9746c0 100644
--- a/tests/integration/pike/server_cluster/config_spec.rb
+++ b/tests/integration/pike/server_cluster/config_spec.rb
@@ -31,6 +31,18 @@
'formatv6' => "'%(hostname)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -69,5 +81,17 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/pike/server_single/config_spec.rb b/tests/integration/pike/server_single/config_spec.rb
index c872c61..3a5fdff 100644
--- a/tests/integration/pike/server_single/config_spec.rb
+++ b/tests/integration/pike/server_single/config_spec.rb
@@ -31,6 +31,18 @@
'formatv6' => "'%(hostname)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -69,5 +81,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/queens/server_cluster/config_spec.rb b/tests/integration/queens/server_cluster/config_spec.rb
index 6c5a738..967f1fe 100644
--- a/tests/integration/queens/server_cluster/config_spec.rb
+++ b/tests/integration/queens/server_cluster/config_spec.rb
@@ -31,6 +31,18 @@
'formatv4' => "'%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -73,5 +85,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/queens/server_single/config_spec.rb b/tests/integration/queens/server_single/config_spec.rb
index ee8ca13..4d9f8ae 100644
--- a/tests/integration/queens/server_single/config_spec.rb
+++ b/tests/integration/queens/server_single/config_spec.rb
@@ -31,6 +31,18 @@
'formatv4' => "'%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -73,5 +85,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/rocky/server_cluster/config_spec.rb b/tests/integration/rocky/server_cluster/config_spec.rb
index 6c5a738..967f1fe 100644
--- a/tests/integration/rocky/server_cluster/config_spec.rb
+++ b/tests/integration/rocky/server_cluster/config_spec.rb
@@ -31,6 +31,18 @@
'formatv4' => "'%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -73,5 +85,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/integration/rocky/server_single/config_spec.rb b/tests/integration/rocky/server_single/config_spec.rb
index ee8ca13..4d9f8ae 100644
--- a/tests/integration/rocky/server_single/config_spec.rb
+++ b/tests/integration/rocky/server_single/config_spec.rb
@@ -31,6 +31,18 @@
'formatv4' => "'%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s'",
}
+section1 = {
+ 'default_soa_refresh_min' => '3500',
+ 'default_soa_refresh_max' => '3600',
+ 'default_soa_minimum' => '3600',
+}
+
+section2_subsection1 = {
+ 'admin_username' => 'admin',
+ 'admin_password' => 'password',
+ 'admin_tenant_name' => 'tenant1',
+}
+
control 'Designate' do
describe parse_config_file('/etc/designate/designate.conf') do
@@ -73,5 +85,18 @@
end
end
+
+ describe 'Custom configmap settings' do
+
+ its('section1') do
+ should include(section1)
+ end
+
+ its('section2:subsection1') do
+ should include(section2_subsection1)
+ end
+
+ end
+
end
-end
\ No newline at end of file
+end
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index 2313ef7..4a3a74e 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -86,6 +86,19 @@
port: 53
quota:
zones: 40
+ configmap:
+ # Inspec framework used for kitchen integration tests
+ # doesn't support merging of section with identical names
+ # in ini files, to unblock patches it was decided to use
+ # custom names section names here
+ section1:
+ default_soa_refresh_min: 3500
+ default_soa_refresh_max: 3600
+ default_soa_minimum: 3600
+ 'section2:subsection1':
+ admin_username: admin
+ admin_password: password
+ admin_tenant_name: tenant1
worker:
enabled: true
logging:
@@ -96,4 +109,4 @@
fluentd:
enabled: false
ossyslog:
- enabled: false
\ No newline at end of file
+ enabled: false
diff --git a/tests/pillar/server_single.sls b/tests/pillar/server_single.sls
index ea81a3b..e744f15 100644
--- a/tests/pillar/server_single.sls
+++ b/tests/pillar/server_single.sls
@@ -84,6 +84,19 @@
port: 53
quota:
zones: 40
+ configmap:
+ # Inspec framework used for kitchen integration tests
+ # doesn't support merging of section with identical names
+ # in ini files, to unblock patches it was decided to use
+ # custom names section names here
+ section1:
+ default_soa_refresh_min: 3500
+ default_soa_refresh_max: 3600
+ default_soa_minimum: 3600
+ 'section2:subsection1':
+ admin_username: admin
+ admin_password: password
+ admin_tenant_name: tenant1
worker:
enabled: true
logging:
@@ -94,4 +107,4 @@
fluentd:
enabled: false
ossyslog:
- enabled: false
\ No newline at end of file
+ enabled: false