]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python: datamodel: **/enabled configuration renamed to **/enable
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 2 Jun 2025 11:47:13 +0000 (13:47 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Tue, 5 Aug 2025 09:44:44 +0000 (11:44 +0200)
22 files changed:
NEWS
doc/_static/config.schema.json
doc/user/config-defer.rst
doc/user/config-dns64.rst
doc/user/config-dnssec.rst
doc/user/config-monitoring-stats.rst
doc/user/config-rate-limiting.rst
etc/config/config.test-defer.yaml
python/knot_resolver/client/commands/migrate.py
python/knot_resolver/datamodel/cache_schema.py
python/knot_resolver/datamodel/defer_schema.py
python/knot_resolver/datamodel/dns64_schema.py
python/knot_resolver/datamodel/dnssec_schema.py
python/knot_resolver/datamodel/monitoring_schema.py
python/knot_resolver/datamodel/rate_limiting_schema.py
python/knot_resolver/datamodel/templates/defer.lua.j2
python/knot_resolver/datamodel/templates/dns64.lua.j2
python/knot_resolver/datamodel/templates/dnssec.lua.j2
python/knot_resolver/datamodel/templates/rate_limiting.lua.j2
python/knot_resolver/manager/manager.py
python/knot_resolver/manager/metrics/prometheus.py
tests/manager/datamodel/test_config_schema.py

diff --git a/NEWS b/NEWS
index a2ab490989c961d8aea92113461832c94023615f..3c5efe89e8a5577b60e9bd796db23e8695ec106b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,18 +19,18 @@ Incompatible changes
   - /network/tls/auto-discovery
   - /webmgmt
 - Renamed/moved options in the declarative configuration model (YAML).
-  - /cache/garbage-collector -> /cache/garbage-collector/enabled
-  - /dns64: true|false -> /dns64/enabled: true|false
+  - /cache/garbage-collector -> /cache/garbage-collector/enable
+  - /dns64: true|false -> /dns64/enable: true|false
   - /dns64/rev-ttl -> /dns64/reverse-ttl
-  - /dnssec: true|false -> /dnssec/enabled: true|false
+  - /dnssec: true|false -> /dnssec/enable: true|false
   - /dnssec/keep-removed -> /dnssec/trust-anchors-keep-removed
   - /dnssec/trust-anchor-sentinel -> /dnssec/sentinel
   - /dnssec/trust-anchor-signal-query -> /dnssec/signal-query
   - /logging/dnssec-bogus -> /dnssec/log-bogus
   - /monitoring/enabled -> /monitoring/metrics
-  - /monitoring/graphite -> /monitoring/graphite/enabled
+  - /monitoring/graphite -> /monitoring/graphite/enable
   - /network/tls/files-watchdog -> /network/tls/watchdog
-  - /rate-limiting -> /rate-limiting/enabled
+  - /rate-limiting -> /rate-limiting/enable
 
 
 Knot Resolver 6.0.15 (2025-07-17)
index 85ae6a36507ab8e67f283a06d3857af3bebdb7a1..82d5217d506ac056fc945be0f7544530427edf1c 100644 (file)
                     "description": "Use the garbage collector (kres-cache-gc) to periodically clear cache.",
                     "type": "object",
                     "properties": {
-                        "enabled": {
+                        "enable": {
                             "type": "boolean",
                             "description": "Enable/disable cache garbage collector.",
                             "default": true
                         }
                     },
                     "default": {
-                        "enabled": true,
+                        "enable": true,
                         "interval": "1s",
                         "threshold": 80,
                         "release": 10,
                 "storage": "/var/cache/knot-resolver",
                 "size_max": "100M",
                 "garbage_collector": {
-                    "enabled": true,
+                    "enable": true,
                     "interval": "1s",
                     "threshold": 80,
                     "release": 10,
             "description": "DNSSEC configuration.",
             "type": "object",
             "properties": {
-                "enabled": {
+                "enable": {
                     "type": "boolean",
                     "description": "Enable/disable DNSSEC.",
                     "default": true
                 }
             },
             "default": {
-                "enabled": true,
+                "enable": true,
                 "log_bogus": false,
                 "sentinel": true,
                 "signal_query": true,
             "description": "DNS64 (RFC 6147) configuration.",
             "type": "object",
             "properties": {
-                "enabled": {
+                "enable": {
                     "type": "boolean",
                     "description": "Enable/disable DNS64.",
                     "default": false
                 }
             },
             "default": {
-                "enabled": false,
+                "enable": false,
                 "prefix": "64:ff9b::/96",
                 "reverse_ttl": null,
                 "exclude_subnets": null
                 "graphite": {
                     "type": "object",
                     "properties": {
-                        "enabled": {
+                        "enable": {
                             "type": "boolean",
                             "default": false
                         },
                     },
                     "description": "optionally configures where should graphite metrics be sent to",
                     "default": {
-                        "enabled": false,
+                        "enable": false,
                         "host": null,
                         "port": 2003,
                         "prefix": "",
             "default": {
                 "metrics": "lazy",
                 "graphite": {
-                    "enabled": false,
+                    "enable": false,
                     "host": null,
                     "port": 2003,
                     "prefix": "",
             "description": "Configuration of rate limiting.",
             "type": "object",
             "properties": {
-                "enabled": {
+                "enable": {
                     "type": "boolean",
                     "description": "Enable/disable rate limiting",
                     "default": false
                 }
             },
             "default": {
-                "enabled": false,
+                "enable": false,
                 "rate_limit": null,
                 "instant_limit": 50,
                 "capacity": 524288,
             "description": "Configuration of request prioritization (defer).",
             "type": "object",
             "properties": {
-                "enabled": {
+                "enable": {
                     "type": "boolean",
                     "description": "Use request prioritization.",
                     "default": false
                 }
             },
             "default": {
-                "enabled": false,
+                "enable": false,
                 "log_period": "0s"
             }
         },
index 4d26ee403c21f2637bde85de7c76cd545789d6d7..bd0a30cffad6a33a3f28c091dbf2aef2a7d704dd 100644 (file)
@@ -23,7 +23,7 @@ The limits can be adjusted for different packet origins using :option:`price-fac
 
    The data of all deferred queries may occupy 64 MiB of memory per :ref:`worker <config-multiple-workers>`.
 
-.. option:: defer/enabled: true|false
+.. option:: defer/enable: true|false
 
     :default: false
 
index 6e87518cf8a96d66f0abb42eb7e4bee901b63fb5..5d36ca720fdaf94f299d8ab9f978e7d1e09b2ea6 100644 (file)
@@ -15,14 +15,14 @@ By default, the well-known prefix ``64:ff9b::/96`` is used.
 .. code-block:: yaml
 
    dns64:
-     enabled: true
+     enable: true
 
 It is also possible to configure own prefix.
 
 .. code-block:: yaml
 
    dns64:
-     enabled: true
+     enable: true
      prefix: 2001:db8::aabb:0:0/96
 
 .. warning::
index f3cd45f60f713644fa05b97e842bad9ee86baf5b..7b05578be9af9b0fccfe74742510e4651ca1138c 100644 (file)
@@ -21,7 +21,7 @@ system by doing so, add the following snippet to your configuration file.
 
    # turns off DNSSEC validation
    dnssec:
-     enabled: false
+     enable: false
 
 The resolver supports DNSSEC including :rfc:`5011` automated DNSSEC TA updates
 and :rfc:`7646` negative trust anchors.  Depending on your distribution, DNSSEC
@@ -37,7 +37,7 @@ Following :option:`dnssec <dnssec: <options>>` section allows to modify DNSSEC c
 
    DNSSEC configuration options.
 
-   .. option:: enabled: true|false
+   .. option:: enable: true|false
 
       :default: true
 
index e5c41f443b8944cda70e86bbc7e6bce32759825d..d5782f52980cd99f9f7d2407dcc64f0c73810095 100644 (file)
@@ -11,7 +11,7 @@ and server internals, and offers them as a key-value storage.
 .. code-block:: yaml
 
    monitoring:
-     enabled: always
+     enable: always
 
 These metrics can be either exported to :ref:`config-monitoring-graphite` or
 exposed as :ref:`config-monitoring-prometheus`.
@@ -62,14 +62,14 @@ Example configuration:
 
    monitoring:
      graphite:
-       enabled: true
+       enable: true
        host: 127.0.0.1 # graphite server address
        port: 200       # optional graphite server port (2003 is default)
        interval: 5s    # optional publish interval (5s is default)
 
 .. option:: monitoring/graphite:
 
-   .. option:: enabled: true|false
+   .. option:: enable: true|false
 
       :default: false
 
index d455c4a40ffa2c70fb62a1f71b6e45691550c7fc..18c5578f82eba0f834869ddd0d9aea7f9c881f8d 100644 (file)
@@ -21,7 +21,7 @@ that's common in other DNS servers.
 
 The limits can be adjusted for different packet origins using :option:`price-factor <price-factor: <float>` in :ref:`views <config-views>`.
 
-.. option:: rate-limiting/enabled: true|false
+.. option:: rate-limiting/enable: true|false
 
   :default: false
 
index f1dd8a568450b361e5bdadb2000db9cafe47feae..3b463e3080068af4827b225452a2518ea8d559d7 100644 (file)
@@ -1,3 +1,3 @@
 defer:
-  enabled: true
+  enable: true
   log-period: 1s
index bad7d3097532591863835517542f1591d27c5ecd..2b11f83d11b060fef9280baf9ce0ea4a455c1701 100644 (file)
@@ -129,20 +129,20 @@ class MigrateCommand(Command):
             if gc_key in new[cache_key]:
                 gc = new[cache_key][gc_key]
                 if gc is False:
-                    _add(new, "/cache/garbage-collector/enabled", False)
+                    _add(new, "/cache/garbage-collector/enable", False)
                 else:
-                    _add(new, "/cache/garbage-collector/enabled", True)
+                    _add(new, "/cache/garbage-collector/enable", True)
         dns64_key = "dns64"
         if dns64_key in new:
             if new[dns64_key] is False:
-                _add(new, "/dns64/enabled", False, rewrite=True)
+                _add(new, "/dns64/enable", False, rewrite=True)
             else:
-                _add(new, "/dns64/enabled", True, rewrite=True)
+                _add(new, "/dns64/enable", True, rewrite=True)
         _rename(new, "/dns64/rev-ttl", "/dns64/reverse-ttl")
         dnssec_key = "dnssec"
         if dnssec_key in new:
             if new[dnssec_key] is False:
-                _add(new, "/dnssec/enabled", False, rewrite=True)
+                _add(new, "/dnssec/enable", False, rewrite=True)
             else:
                 # by default the DNSSEC is enabled
                 pass
@@ -157,13 +157,13 @@ class MigrateCommand(Command):
             if graphite_key in new[monitoring_key]:
                 graphite = new[monitoring_key][graphite_key]
                 if graphite is False:
-                    _add(new, "/monitoring/graphite/enabled", False)
+                    _add(new, "/monitoring/graphite/enable", False)
                 else:
-                    _add(new, "/monitoring/graphite/enabled", True)
+                    _add(new, "/monitoring/graphite/enable", True)
         _rename(new, "/network/tls/files-watchdog", "/network/tls/watchdog")
         rate_limiting_key = "rate-limiting"
         if rate_limiting_key in new:
-            _add(new, "/rate-limiting/enabled", True)
+            _add(new, "/rate-limiting/enable", True)
 
         # remove empty dicts
         new = {k: v for k, v in new.items() if v}
index 630728207931c3bcad1c2255e2ae51c445045f97..a4d525c6c5c6a455a81482c45e5a026294af0a3c 100644 (file)
@@ -62,7 +62,7 @@ class GarbageCollectorSchema(ConfigSchema):
     Configuration options of the cache garbage collector (kres-cache-gc).
 
     ---
-    enabled: Enable/disable cache garbage collector.
+    enable: Enable/disable cache garbage collector.
     interval: Time interval how often the garbage collector will be run.
     threshold: Cache usage in percent that triggers the garbage collector.
     release: Percent of used cache to be freed by the garbage collector.
@@ -74,7 +74,7 @@ class GarbageCollectorSchema(ConfigSchema):
     dry_run: Run the garbage collector in dry-run mode.
     """
 
-    enabled: bool = True
+    enable: bool = True
     interval: TimeUnit = TimeUnit("1s")
     threshold: Percent = Percent(80)
     release: Percent = Percent(10)
index 81546a0756841e5a2671e7b2e47281763a3f8f83..abe5f0b0dcffba75d73ce08d86a5b2a6f080e428 100644 (file)
@@ -7,9 +7,9 @@ class DeferSchema(ConfigSchema):
     Configuration of request prioritization (defer).
 
     ---
-    enabled: Use request prioritization.
+    enable: Use request prioritization.
     log_period: Minimal time between two log messages, or '0s' to disable.
     """
 
-    enabled: bool = False
+    enable: bool = False
     log_period: TimeUnit = TimeUnit("0s")
index 130ad972218302d873c1a8f1bcd41ef9741b78d4..f742c64eb2b46b5eee44ffa4adcc347022ffa1aa 100644 (file)
@@ -9,13 +9,13 @@ class Dns64Schema(ConfigSchema):
     DNS64 (RFC 6147) configuration.
 
     ---
-    enabled: Enable/disable DNS64.
+    enable: Enable/disable DNS64.
     prefix: IPv6 prefix to be used for synthesizing AAAA records.
     reverse_ttl: TTL in CNAME generated in the reverse 'ip6.arpa.' subtree.
     exclude_subnets: IPv6 subnets that are disallowed in answer.
     """
 
-    enabled: bool = False
+    enable: bool = False
     prefix: IPv6Network96 = IPv6Network96("64:ff9b::/96")
     reverse_ttl: Optional[TimeUnit] = None
     exclude_subnets: Optional[List[IPv6Network]] = None
index 4044a0b8ee9f9a9fa95cf730ff702b378a1d2731..50f5dcaa083079a3b22e8e3a0f1d2a215342318f 100644 (file)
@@ -23,7 +23,7 @@ class DnssecSchema(ConfigSchema):
     DNSSEC configuration.
 
     ---
-    enabled: Enable/disable DNSSEC.
+    enable: Enable/disable DNSSEC.
     log_bogus: Enable logging for each DNSSEC validation failure if '/logging/level' is set to at least 'notice'.
     sentinel: Allows users of DNSSEC validating resolver to detect which root keys are configured in resolver's chain of trust. (RFC 8509)
     signal_query: Signaling Trust Anchor Knowledge in DNSSEC Using Key Tag Query, according to (RFC 8145#section-5).
@@ -34,7 +34,7 @@ class DnssecSchema(ConfigSchema):
     negative_trust_anchors: List of domain names representing negative trust-anchors. (RFC 7646)
     """
 
-    enabled: bool = True
+    enable: bool = True
     log_bogus: bool = False
     sentinel: bool = True
     signal_query: bool = True
index 9308e333840e661f6390a7f7332cb1e289c0bdc7..31dc6a0f23c4740ab06c3b57c16372e3e293f22b 100644 (file)
@@ -5,7 +5,7 @@ from knot_resolver.utils.modeling import ConfigSchema
 
 
 class GraphiteSchema(ConfigSchema):
-    enabled: bool = False
+    enable: bool = False
     host: Union[None, IPAddress, DomainName] = None
     port: PortNumber = PortNumber(2003)
     prefix: EscapedStr = EscapedStr("")
@@ -13,7 +13,7 @@ class GraphiteSchema(ConfigSchema):
     tcp: bool = False
 
     def _validate(self) -> None:
-        if self.enabled and not self.host:
+        if self.enable and not self.host:
             raise ValueError("'host' option must be configured to enable graphite bridge")
 
 
index 3a8116dabcce0dc0668fcd2a9d3a67e90c19cb20..846a95c03b1e959d11b2e2243559105d0f7d91f0 100644 (file)
@@ -13,7 +13,7 @@ class RateLimitingSchema(ConfigSchema):
     Configuration of rate limiting.
 
     ---
-    enabled: Enable/disable rate limiting
+    enable: Enable/disable rate limiting
     rate_limit: Maximal number of allowed queries per second from a single host.
     instant_limit: Maximal number of allowed queries at a single point in time from a single host.
     capacity: Expected maximal number of blocked networks/hosts at the same time.
@@ -22,7 +22,7 @@ class RateLimitingSchema(ConfigSchema):
     dry_run: Perform only classification and logging but no restrictions.
     """
 
-    enabled: bool = False
+    enable: bool = False
     rate_limit: Optional[IntPositive] = None
     instant_limit: IntPositive = IntPositive(50)
     capacity: IntPositive = IntPositive(524288)
@@ -31,7 +31,7 @@ class RateLimitingSchema(ConfigSchema):
     dry_run: bool = False
 
     def _validate(self) -> None:
-        if self.enabled and not self.rate_limit:
+        if self.enable and not self.rate_limit:
             raise ValueError("'rate-limit' has to be configured to enable rate limiting")
 
         max_instant_limit = int(2**32 // 768 - 1)
index 5dacff75fbc60f76c8d901a01a8c90dcbdd6122d..9961435bcc21b03947e08efe36a6331ea2bf72d4 100644 (file)
@@ -1,6 +1,6 @@
 {% from 'macros/common_macros.lua.j2' import boolean %}
 
-{% if cfg.defer.enabled and disable_defer is not defined -%}
+{% if cfg.defer.enable and disable_defer is not defined -%}
 assert(C.defer_init(
        '{{ cfg.rundir }}/defer',
        {{ cfg.defer.log_period.millis() }},
index f230934648984080fcfb64961e154a72dc797244..98a49703d8d9121b357ec379f5febe153bed6136 100644 (file)
@@ -1,6 +1,6 @@
 {% from 'macros/common_macros.lua.j2' import string_table %}
 
-{% if cfg.dns64.enabled %}
+{% if cfg.dns64.enable %}
 
 -- Enable DNS64 by loading module
 modules.load('dns64')
index 1fbaf4d2b66e0a624c3a70c38ea72ef40d706a86..e3a3efdf76301f94b765cf016956f9f57fba2e14 100644 (file)
@@ -1,6 +1,6 @@
 {% from 'macros/common_macros.lua.j2' import boolean %}
 
-{% if cfg.dnssec.enabled %}
+{% if cfg.dnssec.enable %}
 
 -- dnssec.logging-bogus
 {% if cfg.dnssec.log_bogus %}
index 0b6bd81424202604f28603cdb076c6aa39b44fe4..be24f627ec6d2c32f0333ef7734fa402e30f53c0 100644 (file)
@@ -1,6 +1,6 @@
 {% from 'macros/common_macros.lua.j2' import boolean %}
 
-{% if cfg.rate_limiting.enabled %}
+{% if cfg.rate_limiting.enable %}
 assert(
     C.ratelimiting_init(
         '{{ cfg.rundir }}/ratelimiting',
index 3acdd3d4c61b37fdfe473808c826a18fea083d7e..5eff54b40996b584d1aac089bcc11ffab07c56af 100644 (file)
@@ -291,8 +291,8 @@ class KresManager:  # pylint: disable=too-many-instance-attributes
                 await self._rolling_restart(config)
                 await self._ensure_number_of_children(config, int(config.workers))
 
-                if self._is_gc_running() != config.cache.garbage_collector.enabled:
-                    if config.cache.garbage_collector.enabled:
+                if self._is_gc_running() != config.cache.garbage_collector.enable:
+                    if config.cache.garbage_collector.enable:
                         logger.debug("Starting cache GC")
                         await self._start_gc(config)
                     else:
index 659e110cd933ca4d2d8f44024db6c240b9ef387b..e180186865e18134e846eb4b5a9ca71caab847e0 100644 (file)
@@ -400,7 +400,7 @@ if PROMETHEUS_LIB:
         Starts graphite bridge if required
         """
         global _graphite_bridge
-        if config.monitoring.graphite.enabled and _graphite_bridge is None:
+        if config.monitoring.graphite.enable and _graphite_bridge is None:
             logger.info(
                 "Starting Graphite metrics exporter for [%s]:%d",
                 str(config.monitoring.graphite.host),
@@ -414,14 +414,14 @@ if PROMETHEUS_LIB:
             )
 
     async def _deny_turning_off_graphite_bridge(old_config: KresConfig, new_config: KresConfig) -> Result[None, str]:
-        if old_config.monitoring.graphite.enabled and not new_config.monitoring.graphite.enabled:
+        if old_config.monitoring.graphite.enable and not new_config.monitoring.graphite.enable:
             return Result.err(
                 "You can't turn off graphite monitoring dynamically. If you really want this feature, please let the developers know."
             )
 
         if (
-            old_config.monitoring.graphite.enabled
-            and new_config.monitoring.graphite.enabled
+            old_config.monitoring.graphite.enable
+            and new_config.monitoring.graphite.enable
             and old_config.monitoring.graphite != new_config.monitoring.graphite
         ):
             return Result.err("Changing graphite exporter configuration in runtime is not allowed.")
index 9ad424c15bdf43a086745b69fd42079ee6ca0cc1..4e9dfbc0b77e5616178164dd373af14273c5713d 100644 (file)
@@ -50,20 +50,20 @@ def test_config_defaults():
     config = KresConfig()
 
     # DNS64 default
-    assert config.dns64.enabled == False
+    assert config.dns64.enable == False
 
 
 def test_dnssec_false():
-    config = KresConfig({"dnssec": {"enabled": False}})
+    config = KresConfig({"dnssec": {"enable": False}})
 
-    assert config.dnssec.enabled == False
+    assert config.dnssec.enable == False
 
 
 def test_dnssec_default_true():
     config = KresConfig()
 
     # DNSSEC defaults
-    assert config.dnssec.enabled == True
+    assert config.dnssec.enable == True
     assert config.dnssec.sentinel == True
     assert config.dnssec.signal_query == True
     assert int(config.dnssec.trust_anchors_keep_removed) == 0
@@ -73,9 +73,9 @@ def test_dnssec_default_true():
 
 
 def test_dns64_prefix_default():
-    config = KresConfig({"dns64": {"enabled": True}})
+    config = KresConfig({"dns64": {"enable": True}})
 
-    assert config.dns64.enabled == True
+    assert config.dns64.enable == True
     assert str(config.dns64.prefix) == "64:ff9b::/96"