From: Aleš Mrázek Date: Tue, 25 Mar 2025 12:35:14 +0000 (+0100) Subject: datamodel: remove webmgmt X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ada3aa8df9ce5c72b71767dba2d1bcf554c52dc1;p=thirdparty%2Fknot-resolver.git datamodel: remove webmgmt --- diff --git a/NEWS b/NEWS index e76b20765..960c4cee6 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Incompatible changes - Removed options from declarative configuration model (YAML). These are mostly experimental and debugging/testing options that are not useful for general users (remain in Lua): - /logging/debugging + - /webmgmt Knot Resolver 6.0.15 (2025-07-17) diff --git a/doc/_static/config.schema.json b/doc/_static/config.schema.json index 4fc731f77..24c3c10f4 100644 --- a/doc/_static/config.schema.json +++ b/doc/_static/config.schema.json @@ -79,53 +79,6 @@ "interface": null } }, - "webmgmt": { - "description": "Configuration of legacy web management endpoint.", - "type": [ - "object", - "null" - ], - "properties": { - "unix-socket": { - "type": [ - "string", - "null" - ], - "description": "Path to unix domain socket to listen to.", - "default": null - }, - "interface": { - "type": [ - "string", - "null" - ], - "description": "IP address or interface name with port number to listen to.", - "default": null - }, - "tls": { - "type": "boolean", - "description": "Enable/disable TLS.", - "default": false - }, - "cert-file": { - "type": [ - "string", - "null" - ], - "description": "Path to certificate file.", - "default": null - }, - "key-file": { - "type": [ - "string", - "null" - ], - "description": "Path to certificate key.", - "default": null - } - }, - "default": null - }, "options": { "description": "Fine-tuning global parameters of DNS resolver operation.", "type": "object", diff --git a/python/knot_resolver/datamodel/config_schema.py b/python/knot_resolver/datamodel/config_schema.py index 2cc2680c9..dc51abfa7 100644 --- a/python/knot_resolver/datamodel/config_schema.py +++ b/python/knot_resolver/datamodel/config_schema.py @@ -21,7 +21,6 @@ from knot_resolver.datamodel.rate_limiting_schema import RateLimitingSchema from knot_resolver.datamodel.templates import POLICY_CONFIG_TEMPLATE, WORKER_CONFIG_TEMPLATE from knot_resolver.datamodel.types import EscapedStr, IntPositive, WritableDir from knot_resolver.datamodel.view_schema import ViewSchema -from knot_resolver.datamodel.webmgmt_schema import WebmgmtSchema from knot_resolver.utils.modeling import ConfigSchema from knot_resolver.utils.modeling.base_schema import lazy_default from knot_resolver.utils.modeling.exceptions import AggregateDataValidationError, DataValidationError @@ -96,7 +95,6 @@ class KresConfig(ConfigSchema): workers: The number of running kresd (Knot Resolver daemon) workers. If set to 'auto', it is equal to number of CPUs available. max_workers: The maximum number of workers allowed. Cannot be changed in runtime. management: Configuration of management HTTP API. - webmgmt: Configuration of legacy web management endpoint. options: Fine-tuning global parameters of DNS resolver operation. network: Network connections and protocols configuration. views: List of views and its configuration. @@ -119,7 +117,6 @@ class KresConfig(ConfigSchema): workers: Union[Literal["auto"], IntPositive] = IntPositive(1) max_workers: IntPositive = IntPositive(WORKERS_MAX) management: ManagementSchema = lazy_default(ManagementSchema, {"unix-socket": str(API_SOCK_FILE)}) - webmgmt: Optional[WebmgmtSchema] = None options: OptionsSchema = OptionsSchema() network: NetworkSchema = NetworkSchema() views: Optional[List[ViewSchema]] = None @@ -142,7 +139,6 @@ class KresConfig(ConfigSchema): workers: IntPositive max_workers: IntPositive management: ManagementSchema - webmgmt: Optional[WebmgmtSchema] options: OptionsSchema network: NetworkSchema views: Optional[List[ViewSchema]] diff --git a/python/knot_resolver/datamodel/templates/webmgmt.lua.j2 b/python/knot_resolver/datamodel/templates/webmgmt.lua.j2 deleted file mode 100644 index 938ea8da5..000000000 --- a/python/knot_resolver/datamodel/templates/webmgmt.lua.j2 +++ /dev/null @@ -1,25 +0,0 @@ -{% from 'macros/common_macros.lua.j2' import boolean %} - -{% if cfg.webmgmt -%} --- webmgmt -modules.load('http') -http.config({tls = {{ boolean(cfg.webmgmt.tls) }}, -{%- if cfg.webmgmt.cert_file -%} - cert = '{{ cfg.webmgmt.cert_file }}', -{%- endif -%} -{%- if cfg.webmgmt.cert_file -%} - key = '{{ cfg.webmgmt.key_file }}', -{%- endif -%} -}, 'webmgmt') -net.listen( -{%- if cfg.webmgmt.unix_socket -%} - '{{ cfg.webmgmt.unix_socket }}',nil, -{%- elif cfg.webmgmt.interface -%} - {%- if cfg.webmgmt.interface.addr -%} - '{{ cfg.webmgmt.interface.addr }}',{{ cfg.webmgmt.interface.port }}, - {%- elif cfg.webmgmt.interface.if_name -%} - net.{{ cfg.webmgmt.interface.if_name }},{{ cfg.webmgmt.interface.port }}, - {%- endif -%} -{%- endif -%} -{ kind = 'webmgmt' }) -{%- endif %} \ No newline at end of file diff --git a/python/knot_resolver/datamodel/templates/worker-config.lua.j2 b/python/knot_resolver/datamodel/templates/worker-config.lua.j2 index be7fe1508..14b862913 100644 --- a/python/knot_resolver/datamodel/templates/worker-config.lua.j2 +++ b/python/knot_resolver/datamodel/templates/worker-config.lua.j2 @@ -22,9 +22,6 @@ nsid.name('{{ cfg.nsid }}' .. worker.id) -- MONITORING section ------------------------------- {% include "monitoring.lua.j2" %} --- WEBMGMT section ---------------------------------- -{% include "webmgmt.lua.j2" %} - -- OPTIONS section ---------------------------------- {% include "options.lua.j2" %} diff --git a/python/knot_resolver/datamodel/webmgmt_schema.py b/python/knot_resolver/datamodel/webmgmt_schema.py deleted file mode 100644 index c39f84d22..000000000 --- a/python/knot_resolver/datamodel/webmgmt_schema.py +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Optional - -from knot_resolver.datamodel.types import InterfacePort, ReadableFile, WritableFilePath -from knot_resolver.utils.modeling import ConfigSchema - - -class WebmgmtSchema(ConfigSchema): - """ - Configuration of legacy web management endpoint. - - --- - unix_socket: Path to unix domain socket to listen to. - interface: IP address or interface name with port number to listen to. - tls: Enable/disable TLS. - cert_file: Path to certificate file. - key_file: Path to certificate key. - """ - - unix_socket: Optional[WritableFilePath] = None - interface: Optional[InterfacePort] = None - tls: bool = False - cert_file: Optional[ReadableFile] = None - key_file: Optional[ReadableFile] = None - - def _validate(self) -> None: - if bool(self.unix_socket) == bool(self.interface): - raise ValueError("One of 'interface' or 'unix-socket' must be configured.") diff --git a/python/knot_resolver/manager/manager.py b/python/knot_resolver/manager/manager.py index dcd14b537..70e8a8e08 100644 --- a/python/knot_resolver/manager/manager.py +++ b/python/knot_resolver/manager/manager.py @@ -130,7 +130,6 @@ class KresManager: # pylint: disable=too-many-instance-attributes config.hostname, config.workers, config.max_workers, - config.webmgmt, config.options, config.network, config.forward,