Skip to content

Commit a24769d

Browse files
pierrejeambrundadonnelly316
authored andcommitted
Move webserver config options to api (apache#50693)
* Move log_fetch_timeout_sec config to api section * Move hide_paused_dags_by_default config to api section * Refac config route * Move page_size config to api section * Move default_wrap config to api section * Remove instance_name_has_markup config * Move auto_refresh_interval config to api * Remove warn_deployment_exposure config * Move require_confirmation_dag_change config to api * Add newsfragment * Fix CI
1 parent ffe4118 commit a24769d

File tree

14 files changed

+164
-135
lines changed

14 files changed

+164
-135
lines changed

airflow-core/docs/howto/customize-ui.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ After
6161

6262
.. image:: ../img/change-site-title/example_instance_name_configuration.png
6363

64-
.. note::
65-
66-
From version 2.3.0 you can include markup in ``instance_name`` variable for further customization. To enable, set ``instance_name_has_markup`` under the ``[webserver]`` section inside ``airflow.cfg`` to ``True``.
67-
6864

6965
Add custom alert messages on the dashboard
7066
------------------------------------------
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Unused webserver configuration options have been removed
2+
3+
The following webserver options were moved into the ``api`` section:
4+
5+
* ``[webserver] log_fetch_timeout_sec`` → ``[api] log_fetch_timeout_sec``
6+
* ``[webserver] hide_paused_dags_by_default`` → ``[api] hide_paused_dags_by_default``
7+
* ``[webserver] page_size`` → ``[api] page_size``
8+
* ``[webserver] default_wrap`` → ``[api] default_wrap``
9+
* ``[webserver] require_confirmation_dag_change`` → ``[api] require_confirmation_dag_change``
10+
* ``[webserver] auto_refresh_interval`` → ``[api] auto_refresh_interval``
11+
12+
The following configuration options are now unused and have been removed:
13+
14+
- ``[webserver] instance_name_has_markup``
15+
- ``[webserver] warn_deployment_exposure``
16+
17+
* Types of change
18+
19+
* [ ] Dag changes
20+
* [x] Config changes
21+
* [ ] API changes
22+
* [ ] CLI changes
23+
* [ ] Behaviour changes
24+
* [ ] Plugin changes
25+
* [ ] Dependency changes
26+
* [ ] Code interface changes
27+
28+
.. List the migration rules needed for this change (see https://github.com/apache/airflow/issues/41641)
29+
30+
* Migration rules needed
31+
32+
* ``airflow config lint``
33+
34+
* [ ] Remove configuration option ``[webserver] instance_name_has_markup``
35+
* [ ] Remove configuration option ``[webserver] warn_deployment_exposure``
36+
* [ ] [webserver] log_fetch_timeout_sec`` → ``[api] log_fetch_timeout_sec``
37+
* [ ] [webserver] hide_paused_dags_by_default`` → ``[api] hide_paused_dags_by_default``
38+
* [ ] [webserver] page_size`` → ``[api] page_size``
39+
* [ ] [webserver] default_wrap`` → ``[api] default_wrap``
40+
* [ ] [webserver] require_confirmation_dag_change`` → ``[api] require_confirmation_dag_change``
41+
* [ ] [webserver] auto_refresh_interval`` → ``[api] auto_refresh_interval``

airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ class ConfigResponse(BaseModel):
3232
auto_refresh_interval: int
3333
hide_paused_dags_by_default: bool
3434
instance_name: str
35-
instance_name_has_markup: bool
3635
enable_swagger_ui: bool
3736
require_confirmation_dag_change: bool
3837
default_wrap: bool
39-
warn_deployment_exposure: bool
4038
audit_view_excluded_events: str
4139
audit_view_included_events: str
4240
test_connection: str

airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,6 @@ components:
764764
instance_name:
765765
type: string
766766
title: Instance Name
767-
instance_name_has_markup:
768-
type: boolean
769-
title: Instance Name Has Markup
770767
enable_swagger_ui:
771768
type: boolean
772769
title: Enable Swagger Ui
@@ -776,9 +773,6 @@ components:
776773
default_wrap:
777774
type: boolean
778775
title: Default Wrap
779-
warn_deployment_exposure:
780-
type: boolean
781-
title: Warn Deployment Exposure
782776
audit_view_excluded_events:
783777
type: string
784778
title: Audit View Excluded Events
@@ -811,11 +805,9 @@ components:
811805
- auto_refresh_interval
812806
- hide_paused_dags_by_default
813807
- instance_name
814-
- instance_name_has_markup
815808
- enable_swagger_ui
816809
- require_confirmation_dag_change
817810
- default_wrap
818-
- warn_deployment_exposure
819811
- audit_view_excluded_events
820812
- audit_view_included_events
821813
- test_connection

airflow-core/src/airflow/api_fastapi/core_api/routes/ui/config.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@
3232

3333
WEBSERVER_CONFIG_KEYS = [
3434
"navbar_color",
35-
"page_size",
36-
"auto_refresh_interval",
37-
"hide_paused_dags_by_default",
38-
"warn_deployment_exposure",
39-
"default_wrap",
40-
"require_confirmation_dag_change",
41-
"enable_swagger_ui",
42-
"instance_name_has_markup",
4335
"navbar_text_color",
4436
"navbar_hover_color",
4537
"navbar_text_hover_color",
38+
"enable_swagger_ui",
39+
]
40+
41+
API_CONFIG_KEYS = [
42+
"hide_paused_dags_by_default",
43+
"page_size",
44+
"default_wrap",
45+
"auto_refresh_interval",
46+
"require_confirmation_dag_change",
4647
]
4748

4849

@@ -57,6 +58,8 @@ def get_configs() -> ConfigResponse:
5758

5859
config = {key: conf_dict["webserver"].get(key) for key in WEBSERVER_CONFIG_KEYS}
5960

61+
config.update({key: conf_dict["api"].get(key) for key in API_CONFIG_KEYS})
62+
6063
task_log_reader = TaskLogReader()
6164
additional_config: dict[str, Any] = {
6265
"instance_name": conf.get("webserver", "instance_name", fallback="Airflow"),

airflow-core/src/airflow/cli/commands/config_command.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,44 @@ def message(self) -> str | None:
478478
config=ConfigParameter("webserver", "default_dag_run_display_number"),
479479
was_deprecated=False,
480480
),
481+
ConfigChange(
482+
config=ConfigParameter("webserver", "log_fetch_timeout_sec"),
483+
renamed_to=ConfigParameter("api", "log_fetch_timeout_sec"),
484+
breaking=True,
485+
),
486+
ConfigChange(
487+
config=ConfigParameter("webserver", "hide_paused_dags_by_default"),
488+
renamed_to=ConfigParameter("api", "hide_paused_dags_by_default"),
489+
breaking=True,
490+
),
491+
ConfigChange(
492+
config=ConfigParameter("webserver", "page_size"),
493+
renamed_to=ConfigParameter("api", "page_size"),
494+
breaking=True,
495+
),
496+
ConfigChange(
497+
config=ConfigParameter("webserver", "default_wrap"),
498+
renamed_to=ConfigParameter("api", "default_wrap"),
499+
breaking=True,
500+
),
501+
ConfigChange(
502+
config=ConfigParameter("webserver", "require_confirmation_dag_change"),
503+
renamed_to=ConfigParameter("api", "require_confirmation_dag_change"),
504+
breaking=True,
505+
),
506+
ConfigChange(
507+
config=ConfigParameter("webserver", "instance_name_has_markup"),
508+
was_deprecated=False,
509+
),
510+
ConfigChange(
511+
config=ConfigParameter("webserver", "warn_deployment_exposure"),
512+
was_deprecated=False,
513+
),
514+
ConfigChange(
515+
config=ConfigParameter("webserver", "auto_refresh_interval"),
516+
renamed_to=ConfigParameter("api", "auto_refresh_interval"),
517+
breaking=True,
518+
),
481519
ConfigChange(
482520
config=ConfigParameter("webserver", "enable_proxy_fix"),
483521
renamed_to=ConfigParameter("fab", "enable_proxy_fix"),

airflow-core/src/airflow/config_templates/config.yml

Lines changed: 48 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,54 @@ api:
14121412
type: string
14131413
example: ~
14141414
default: "topological"
1415+
log_fetch_timeout_sec:
1416+
description: |
1417+
The amount of time (in secs) webserver will wait for initial handshake
1418+
while fetching logs from other worker machine
1419+
version_added: ~
1420+
type: string
1421+
example: ~
1422+
default: "5"
1423+
hide_paused_dags_by_default:
1424+
description: |
1425+
By default, the webserver shows paused DAGs. Flip this to hide paused
1426+
DAGs by default
1427+
version_added: ~
1428+
type: string
1429+
example: ~
1430+
default: "False"
1431+
page_size:
1432+
description: |
1433+
Consistent page size across all listing views in the UI
1434+
version_added: ~
1435+
type: string
1436+
example: ~
1437+
default: "50"
1438+
default_wrap:
1439+
description: |
1440+
Default setting for wrap toggle on DAG code and TI log views.
1441+
version_added: 1.10.4
1442+
type: boolean
1443+
example: ~
1444+
default: "False"
1445+
auto_refresh_interval:
1446+
description: |
1447+
How frequently, in seconds, the DAG data will auto-refresh in graph or grid view
1448+
when auto-refresh is turned on
1449+
version_added: 2.2.0
1450+
type: integer
1451+
example: ~
1452+
default: "3"
1453+
require_confirmation_dag_change:
1454+
description: |
1455+
Require confirmation when changing a DAG in the web UI. This is to prevent accidental changes
1456+
to a DAG that may be running on sensitive environments like production.
1457+
When set to ``True``, confirmation dialog will be shown when a user tries to Pause/Unpause,
1458+
Trigger a DAG
1459+
version_added: 2.9.0
1460+
type: boolean
1461+
example: ~
1462+
default: "False"
14151463
workers:
14161464
description: Configuration related to workers that run Airflow tasks.
14171465
options:
@@ -1714,29 +1762,6 @@ webserver:
17141762
sensitive: true
17151763
example: ~
17161764
default: "{SECRET_KEY}"
1717-
log_fetch_timeout_sec:
1718-
description: |
1719-
The amount of time (in secs) webserver will wait for initial handshake
1720-
while fetching logs from other worker machine
1721-
version_added: ~
1722-
type: string
1723-
example: ~
1724-
default: "5"
1725-
hide_paused_dags_by_default:
1726-
description: |
1727-
By default, the webserver shows paused DAGs. Flip this to hide paused
1728-
DAGs by default
1729-
version_added: ~
1730-
type: string
1731-
example: ~
1732-
default: "False"
1733-
page_size:
1734-
description: |
1735-
Consistent page size across all listing views in the UI
1736-
version_added: ~
1737-
type: string
1738-
example: ~
1739-
default: "50"
17401765
navbar_color:
17411766
description: |
17421767
Define the color of navigation bar
@@ -1765,13 +1790,6 @@ webserver:
17651790
type: string
17661791
example: ~
17671792
default: "#51504f"
1768-
default_wrap:
1769-
description: |
1770-
Default setting for wrap toggle on DAG code and TI log views.
1771-
version_added: 1.10.4
1772-
type: boolean
1773-
example: ~
1774-
default: "False"
17751793
x_frame_enabled:
17761794
description: |
17771795
Allow the UI to be rendered in a frame
@@ -1786,28 +1804,6 @@ webserver:
17861804
type: string
17871805
example: ~
17881806
default:
1789-
instance_name_has_markup:
1790-
description: |
1791-
Whether the custom page title for the DAGs overview page contains any Markup language
1792-
version_added: 2.3.0
1793-
type: boolean
1794-
example: ~
1795-
default: "False"
1796-
auto_refresh_interval:
1797-
description: |
1798-
How frequently, in seconds, the DAG data will auto-refresh in graph or grid view
1799-
when auto-refresh is turned on
1800-
version_added: 2.2.0
1801-
type: integer
1802-
example: ~
1803-
default: "3"
1804-
warn_deployment_exposure:
1805-
description: |
1806-
Boolean for displaying warning for publicly viewable deployment
1807-
version_added: 2.3.0
1808-
type: boolean
1809-
example: ~
1810-
default: "True"
18111807
audit_view_excluded_events:
18121808
description: |
18131809
Comma separated string of view events to exclude from dag audit view.
@@ -1833,16 +1829,6 @@ webserver:
18331829
type: boolean
18341830
example: ~
18351831
default: "True"
1836-
require_confirmation_dag_change:
1837-
description: |
1838-
Require confirmation when changing a DAG in the web UI. This is to prevent accidental changes
1839-
to a DAG that may be running on sensitive environments like production.
1840-
When set to ``True``, confirmation dialog will be shown when a user tries to Pause/Unpause,
1841-
Trigger a DAG
1842-
version_added: 2.9.0
1843-
type: boolean
1844-
example: ~
1845-
default: "False"
18461832
email:
18471833
description: |
18481834
Configuration email backend and whether to

airflow-core/src/airflow/configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ def sensitive_config_values(self) -> set[tuple[str, str]]:
359359
("fab", "access_denied_message"): ("webserver", "access_denied_message", "3.0.2"),
360360
("fab", "expose_hostname"): ("webserver", "expose_hostname", "3.0.2"),
361361
("api", "grid_view_sorting_order"): ("webserver", "grid_view_sorting_order", "3.1.0"),
362+
("api", "log_fetch_timeout_sec"): ("webserver", "log_fetch_timeout_sec", "3.1.0"),
363+
("api", "hide_paused_dags_by_default"): ("webserver", "hide_paused_dags_by_default", "3.1.0"),
364+
("api", "page_size"): ("webserver", "page_size", "3.1.0"),
365+
("api", "default_wrap"): ("webserver", "default_wrap", "3.1.0"),
366+
("api", "auto_refresh_interval"): ("webserver", "auto_refresh_interval", "3.1.0"),
367+
("api", "require_confirmation_dag_change"): ("webserver", "require_confirmation_dag_change", "3.1.0"),
362368
}
363369

364370
# A mapping of new section -> (old section, since_version).

airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6027,10 +6027,6 @@ export const $ConfigResponse = {
60276027
type: "string",
60286028
title: "Instance Name",
60296029
},
6030-
instance_name_has_markup: {
6031-
type: "boolean",
6032-
title: "Instance Name Has Markup",
6033-
},
60346030
enable_swagger_ui: {
60356031
type: "boolean",
60366032
title: "Enable Swagger Ui",
@@ -6043,10 +6039,6 @@ export const $ConfigResponse = {
60436039
type: "boolean",
60446040
title: "Default Wrap",
60456041
},
6046-
warn_deployment_exposure: {
6047-
type: "boolean",
6048-
title: "Warn Deployment Exposure",
6049-
},
60506042
audit_view_excluded_events: {
60516043
type: "string",
60526044
title: "Audit View Excluded Events",
@@ -6092,11 +6084,9 @@ export const $ConfigResponse = {
60926084
"auto_refresh_interval",
60936085
"hide_paused_dags_by_default",
60946086
"instance_name",
6095-
"instance_name_has_markup",
60966087
"enable_swagger_ui",
60976088
"require_confirmation_dag_change",
60986089
"default_wrap",
6099-
"warn_deployment_exposure",
61006090
"audit_view_excluded_events",
61016091
"audit_view_included_events",
61026092
"test_connection",

airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,11 +1504,9 @@ export type ConfigResponse = {
15041504
auto_refresh_interval: number;
15051505
hide_paused_dags_by_default: boolean;
15061506
instance_name: string;
1507-
instance_name_has_markup: boolean;
15081507
enable_swagger_ui: boolean;
15091508
require_confirmation_dag_change: boolean;
15101509
default_wrap: boolean;
1511-
warn_deployment_exposure: boolean;
15121510
audit_view_excluded_events: string;
15131511
audit_view_included_events: string;
15141512
test_connection: string;

0 commit comments

Comments
 (0)