[proof of concept] Add _reload directive support for config reload framework.#13110
Draft
brbzull0 wants to merge 2 commits intoapache:masterfrom
Draft
[proof of concept] Add _reload directive support for config reload framework.#13110brbzull0 wants to merge 2 commits intoapache:masterfrom
brbzull0 wants to merge 2 commits intoapache:masterfrom
Conversation
added 2 commits
April 21, 2026 14:02
Config handlers need a way to receive operational parameters (e.g. scoping a reload to a single entry) without conflating them with config content. This adds a reserved _reload key inside the configs YAML node that the framework extracts before invoking handlers. Framework: ConfigContext gains reload_directives() getter; the _reload node is extracted in ConfigRegistry::execute_reload() and stripped from supplied_yaml(). Fixes stale _passed_configs entries not being erased after consumption. CLI: traffic_ctl config reload gains --directive (-D) flag using dot-notation (config_key.directive_key=value). Multiple directives are space-separated after a single -D. Tests: unit tests for parse_directive and ConfigContext directive propagation; autest coverage for directive RPC structure handling. Docs: developer guide and traffic_ctl reference updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
_reloaddirective support to config reload frameworkTL;DR
Adds a generic way to pass operational parameters to config reload handlers.
Instead of per-config flags like
--virtualhost, handlers now receive directivesvia a reserved
_reloadkey that the framework extracts automatically.Handlers read directives with
ctx.reload_directives()["id"], whilectx.supplied_yaml()stays clean (content only, no directives). Also fixes a bugwhere stale RPC-supplied config data could replay on subsequent file-based reloads.
Summary
Config handlers sometimes need operational parameters that modify how a reload
is performed — for example, scoping a reload to a single entry by ID, or some other key to pass.
Currently there's no standard way to pass these parameters;
PR #13108 (virtualhost) works around this by adding a per-config
--virtualhostflagto
traffic_ctl.This PR adds a generic reload directive mechanism:
_reloadkey inside each config's YAML node carries directives_reloadbefore invoking the handlertraffic_ctlgains a--directive(-D) flag with dot-notation syntaxConfigContext::reload_directives()Motivation
The virtualhost PR (#13108) needs to tell the handler which virtualhost to reload
from file. Without a generic mechanism, every config that needs parameters would require
its own
traffic_ctlflag and custom parsing — leading to flag proliferation andduplicated code.
The
_reloaddirective solves this once for all handlers.Usage
traffic_ctlCLIWire format
-D virtualhost.id=myhostproduces:{ "configs": { "my_config": { "_reload": { "id": "myhost" } } } }Handler API
Key behavior:
reload_directives()returns the extracted_reloadYAML mapsupplied_yaml()is clean — never contains_reloadkeys_reloadis not a YAML map, a warning is logged and directives are ignoredChanges
Framework (
src/mgmt/config/)ConfigContext: Addedreload_directives()getter,set_reload_directives()setter, and propagation to child contexts via
add_dependent_ctx()ConfigRegistry::execute_reload(): Extracts_reloadfrom the config's YAMLnode before passing content to the handler. Also fixes a bug where
_passed_configsentries were not erased after consumption, causing stale RPC data to replay on
subsequent file-based reloads
CLI (
src/traffic_ctl/)traffic_ctl.cc: Added--directive(-D) option toconfig reloadCtrlCommands.cc: Addedparse_directive()helper that parsesconfig_key.directive_key=valueand injects intoconfigs[key]["_reload"][dir] = val