Allow to enable admin api
This patch adds ability to enable admin api from pillar.
Change-Id: I9feee7b8081f23fcb89bf6e91543e09c2542cbe3
Related-Prod: https://mirantis.jira.com/browse/PROD-15865
diff --git a/README.rst b/README.rst
index 943fbea..c07a44d 100644
--- a/README.rst
+++ b/README.rst
@@ -24,6 +24,9 @@
rndc_algorithm: hmac-sha512
api:
base_uri: 'http://127.0.0.1:9001'
+ admin_api:
+ enabled: true
+ enabled_extensions_admin: quotas
bind:
api:
address: 127.0.0.1
diff --git a/designate/files/liberty/designate.conf.Debian b/designate/files/liberty/designate.conf.Debian
index bcba3ae..1099a90 100644
--- a/designate/files/liberty/designate.conf.Debian
+++ b/designate/files/liberty/designate.conf.Debian
@@ -149,12 +149,16 @@
#max_limit_v2 = 1000
# Enable Admin API (experimental)
-#enable_api_admin = False
+enable_api_admin = {{ server.get('admin_api', {}).get('enabled', False) }}
# Enabled Admin API extensions
# Can be one or more of : reports, quotas, counts, tenants, zones
# zone export is in zones extension
+{%- if server.get('admin_api', {}).get('enabled_extensions_admin', False) %}
+enabled_extensions_admin = {{ server.admin_api.enabled_extensions_admin }}
+{%- else %}
#enabled_extensions_admin =
+{%- endif %}
# Default per-page limit for the Admin API, a value of None means show all results
# by default
diff --git a/designate/files/mitaka/designate.conf.Debian b/designate/files/mitaka/designate.conf.Debian
index ba1a21c..abd9a53 100644
--- a/designate/files/mitaka/designate.conf.Debian
+++ b/designate/files/mitaka/designate.conf.Debian
@@ -188,12 +188,16 @@
#max_limit_v2 = 1000
# Enable Admin API (experimental)
-#enable_api_admin = False
+enable_api_admin = {{ server.get('admin_api', {}).get('enabled', False) }}
# Enabled Admin API extensions
# Can be one or more of : reports, quotas, counts, tenants, target_sync
# zone export is in zones extension
+{%- if server.get('admin_api', {}).get('enabled_extensions_admin', False) %}
+enabled_extensions_admin = {{ server.admin_api.enabled_extensions_admin }}
+{%- else %}
#enabled_extensions_admin =
+{%- endif %}
# Default per-page limit for the Admin API, a value of None means show all results
# by default
diff --git a/designate/files/ocata/designate.conf.Debian b/designate/files/ocata/designate.conf.Debian
index 5dc78ef..32b811b 100644
--- a/designate/files/ocata/designate.conf.Debian
+++ b/designate/files/ocata/designate.conf.Debian
@@ -185,12 +185,16 @@
#max_limit_v2 = 1000
# Enable Admin API (experimental)
-#enable_api_admin = False
+enable_api_admin = {{ server.get('admin_api', {}).get('enabled', False) }}
# Enabled Admin API extensions
# Can be one or more of : reports, quotas, counts, tenants, target_sync
# zone export is in zones extension
+{%- if server.get('admin_api', {}).get('enabled_extensions_admin', False) %}
+enabled_extensions_admin = {{ server.admin_api.enabled_extensions_admin }}
+{%- else %}
#enabled_extensions_admin =
+{%- endif %}
# Default per-page limit for the Admin API, a value of None means show all results
# by default
diff --git a/tests/pillar/designate_liberty.sls b/tests/pillar/designate_liberty.sls
index 8022e0c..320489a 100644
--- a/tests/pillar/designate_liberty.sls
+++ b/tests/pillar/designate_liberty.sls
@@ -9,6 +9,9 @@
mdns:
address: 0.0.0.0
port: 5354
+ admin_api:
+ enabled: true
+ enabled_extensions_admin: quotas
database:
engine: mysql
host: 127.0.0.1
diff --git a/tests/pillar/designate_mitaka.sls b/tests/pillar/designate_mitaka.sls
index caffa4f..7c8a53d 100644
--- a/tests/pillar/designate_mitaka.sls
+++ b/tests/pillar/designate_mitaka.sls
@@ -9,6 +9,9 @@
mdns:
address: 0.0.0.0
port: 5354
+ admin_api:
+ enabled: true
+ enabled_extensions_admin: quotas
database:
engine: mysql
host: 127.0.0.1
diff --git a/tests/pillar/designate_ocata.sls b/tests/pillar/designate_ocata.sls
index 68ce620..acf1f8f 100644
--- a/tests/pillar/designate_ocata.sls
+++ b/tests/pillar/designate_ocata.sls
@@ -10,6 +10,9 @@
bind:
api:
address: 127.0.0.1
+ admin_api:
+ enabled: true
+ enabled_extensions_admin: quotas
database:
engine: mysql
host: 127.0.0.1