Handle the hardcoded configuration values

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

  ironic:
    api:
      configmap:
        DEFAULT:
          enabled_drivers: pxe_ipmitool
          enabled_hardware_types: ipmi
          enabled_boot_interfaces: pxe
        api:
          host_ip: 0.0.0.0
          port: 6385
          max_limit: 1000
    conductor:
      configmap:
        DEFAULT:
          enabled_drivers: pxe_ipmitool
          enabled_hardware_types: ipmi
          enabled_boot_interfaces: pxe
        disk_partitioner:
          check_device_interval: 1
          check_device_max_retries: 20
        disk_utils:
          efi_system_partition_size: 200
          bios_boot_partition_size: 1

Change-Id: I0876284d7dcf9b4dd40478c6ef5fd66878b1c0bd
Related-Prod: PROD-29627
diff --git a/README.rst b/README.rst
index 218c333..ddf253f 100644
--- a/README.rst
+++ b/README.rst
@@ -230,6 +230,35 @@
           sleep_time: 10
           timeout: 15
 
+Change default options using configmap template settings
+========================================================
+
+.. code-block:: yaml
+
+  ironic:
+    api:
+      configmap:
+        DEFAULT:
+          enabled_drivers: pxe_ipmitool
+          enabled_hardware_types: ipmi
+          enabled_boot_interfaces: pxe
+        api:
+          host_ip: 0.0.0.0
+          port: 6385
+          max_limit: 1000
+    conductor:
+      configmap:
+        DEFAULT:
+          enabled_drivers: pxe_ipmitool
+          enabled_hardware_types: ipmi
+          enabled_boot_interfaces: pxe
+        disk_partitioner:
+          check_device_interval: 1
+          check_device_max_retries: 20
+        disk_utils:
+          efi_system_partition_size: 200
+          bios_boot_partition_size: 1
+
 Upgrades
 ========
 
diff --git a/ironic/files/ocata/ironic.conf b/ironic/files/ocata/ironic.conf
index 0c030bd..55a6c2d 100644
--- a/ironic/files/ocata/ironic.conf
+++ b/ironic/files/ocata/ironic.conf
@@ -4064,3 +4064,8 @@
 # Username (string value)
 # Deprecated group/name - [swift]/user-name
 #username = <None>
+
+{%- if ironic.configmap is defined %}
+{%- set _data = ironic.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/ironic/files/pike/ironic.conf b/ironic/files/pike/ironic.conf
index 9066e2d..f8dc1eb 100644
--- a/ironic/files/pike/ironic.conf
+++ b/ironic/files/pike/ironic.conf
@@ -4281,3 +4281,8 @@
 # Username (string value)
 # Deprecated group/name - [swift]/user-name
 #username = <None>
+
+{%- if ironic.configmap is defined %}
+{%- set _data = ironic.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/ironic/files/queens/ironic.conf b/ironic/files/queens/ironic.conf
index 207032b..8eb5ff6 100644
--- a/ironic/files/queens/ironic.conf
+++ b/ironic/files/queens/ironic.conf
@@ -2577,3 +2577,8 @@
 # Maximum number of times to retry a Swift request, before
 # failing. (integer value)
 #swift_max_retries = 2
+
+{%- if ironic.configmap is defined %}
+{%- set _data = ironic.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/ironic/files/rocky/ironic.conf b/ironic/files/rocky/ironic.conf
index 07ac07c..4be00e2 100644
--- a/ironic/files/rocky/ironic.conf
+++ b/ironic/files/rocky/ironic.conf
@@ -3077,3 +3077,8 @@
 # Minimum value: 0
 # Maximum value: 65535
 #port = 443
+
+{%- if ironic.configmap is defined %}
+{%- set _data = ironic.configmap %}
+{%- include "oslo_templates/files/configmap/configmap.conf" %}
+{%- endif %}
diff --git a/tests/pillar/api_single.sls b/tests/pillar/api_single.sls
index 72800fe..365a526 100644
--- a/tests/pillar/api_single.sls
+++ b/tests/pillar/api_single.sls
@@ -32,3 +32,12 @@
         enabled: true
         strategy: ENCRYPT
         secret_key: secret
+    configmap:
+      DEFAULT:
+        enabled_drivers: pxe_ipmitool
+        enabled_hardware_types: ipmi
+        enabled_boot_interfaces: pxe
+      api:
+        host_ip: 0.0.0.0
+        port: 6385
+        max_limit: 1000
diff --git a/tests/pillar/conductor_single.sls b/tests/pillar/conductor_single.sls
index 4c86486..2a4d113 100644
--- a/tests/pillar/conductor_single.sls
+++ b/tests/pillar/conductor_single.sls
@@ -28,6 +28,17 @@
       subprocess_timeout: 10
       socat_address: 127.0.0.1
     pxe_append_params: nofb nomodeset vga=normal
+    configmap:
+      DEFAULT:
+        enabled_drivers: pxe_ipmitool
+        enabled_hardware_types: ipmi
+        enabled_boot_interfaces: pxe
+      disk_partitioner:
+        check_device_interval: 1
+        check_device_max_retries: 20
+      disk_utils:
+        efi_system_partition_size: 200
+        bios_boot_partition_size: 1
   tftpd_hpa:
     server:
       bind: