Support customizing pool attributes

Change-Id: Ic3093b91eddeeadbf9fb751df905e259a6f5c6c5
This commit is contained in:
Takashi Kajinami
2024-03-18 01:59:03 +09:00
parent e15d0acdc7
commit beb10536cb
5 changed files with 53 additions and 22 deletions

View File

@@ -54,6 +54,10 @@
# packets to. # packets to.
# Defaults to []. # Defaults to [].
# #
# [*attributes*]
# (Optional) Pool attribtes used by scheduling.
# Defaults to {}
#
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
# #
# [*configure_bind*] # [*configure_bind*]
@@ -66,21 +70,22 @@
# Defaults to true # Defaults to true
# #
class designate::backend::bind9 ( class designate::backend::bind9 (
$rndc_config_file = '/etc/rndc.conf', $rndc_config_file = '/etc/rndc.conf',
$rndc_key_file = '/etc/rndc.key', $rndc_key_file = '/etc/rndc.key',
$rndc_controls = undef, $rndc_controls = undef,
$rndc_port = 953, $rndc_port = 953,
Hash[Integer, String] $ns_records = {1 => 'ns1.example.org.'}, Hash[Integer, String] $ns_records = {1 => 'ns1.example.org.'},
Array[String[1], 1] $nameservers = ['127.0.0.1'], Array[String[1], 1] $nameservers = ['127.0.0.1'],
Array[String[1], 1] $bind9_hosts = ['127.0.0.1'], Array[String[1], 1] $bind9_hosts = ['127.0.0.1'],
$dns_port = 53, $dns_port = 53,
Array[String[1], 1] $mdns_hosts = ['127.0.0.1'], Array[String[1], 1] $mdns_hosts = ['127.0.0.1'],
$mdns_port = 5354, $mdns_port = 5354,
Boolean $clean_zonefile = false, Boolean $clean_zonefile = false,
Array[String[1]] $also_notifies = [], Array[String[1]] $also_notifies = [],
Hash[String[1], String[1]] $attributes = {},
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
Boolean $configure_bind = true, Boolean $configure_bind = true,
Boolean $manage_pool = true, Boolean $manage_pool = true,
) { ) {
include designate::deps include designate::deps

View File

@@ -37,6 +37,10 @@
# packets to. # packets to.
# Defaults to []. # Defaults to [].
# #
# [*attributes*]
# (Optional) Pool attribtes used by scheduling.
# Defaults to {}
#
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
# #
# [*manage_pool*] # [*manage_pool*]
@@ -45,15 +49,16 @@
# #
class designate::backend::pdns4 ( class designate::backend::pdns4 (
String[1] $api_token, String[1] $api_token,
Array[String[1], 1] $pdns4_hosts = ['127.0.0.1'], Array[String[1], 1] $pdns4_hosts = ['127.0.0.1'],
$pdns4_port = 53, $pdns4_port = 53,
Array[String[1], 1] $mdns_hosts = ['127.0.0.1'], Array[String[1], 1] $mdns_hosts = ['127.0.0.1'],
$mdns_port = 5354, $mdns_port = 5354,
String[1] $api_endpoint = 'http://127.0.0.1:8081', String[1] $api_endpoint = 'http://127.0.0.1:8081',
Optional[String[1]] $tsigkey_name = undef, Optional[String[1]] $tsigkey_name = undef,
Array[String[1]] $also_notifies = [], Array[String[1]] $also_notifies = [],
Hash[String[1], String[1]] $attributes = {},
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
Boolean $manage_pool = true, Boolean $manage_pool = true,
) { ) {
include designate::deps include designate::deps

View File

@@ -0,0 +1,7 @@
---
features:
- |
The ``attributes`` parameter has been added to the following classes.
- ``designate::backend::bind9``
- ``designate::backend::pdns4``

View File

@@ -1,7 +1,14 @@
--- ---
- name: default - name: default
description: Default pool description: Default pool
<% if @attributes.empty? -%>
attributes: {} attributes: {}
<% else -%>
attributes:
<% @attributes.sort.each do |key, val| -%>
<%= key %>: <%= val %>
<% end -%>
<% end -%>
ns_records: ns_records:
<% @ns_records.sort.each do |priority, hostname| -%> <% @ns_records.sort.each do |priority, hostname| -%>

View File

@@ -1,7 +1,14 @@
--- ---
- name: default - name: default
description: Default pool description: Default pool
<% if @attributes.empty? -%>
attributes: {} attributes: {}
<% else -%>
attributes:
<% @attributes.sort.each do |key, val| -%>
<%= key %>: <%= val %>
<% end -%>
<% end -%>
targets: targets:
<% @pdns4_hosts.each do |pdns4_host| -%> <% @pdns4_hosts.each do |pdns4_host| -%>