plugin.config to plugin.yaml migration. #13070
Open
brbzull0 wants to merge 2 commits intoapache:masterfrom
Open
plugin.config to plugin.yaml migration. #13070brbzull0 wants to merge 2 commits intoapache:masterfrom
plugin.config to plugin.yaml migration. #13070brbzull0 wants to merge 2 commits intoapache:masterfrom
Conversation
Introduce plugin.yaml, a YAML-based configuration file for global plugins that replaces the legacy line-based plugin.config format. New capabilities over plugin.config: - enabled: false to disable plugins without removing them - load_order for explicit plugin loading priority - NOTE-level startup log per plugin with load status - traffic_ctl plugin list via JSONRPC for runtime introspection - traffic_ctl config convert plugin_config for automated migration - Fallback: plugin.yaml takes precedence; plugin.config used if absent
10 tasks
7212d08 to
61c1493
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates global plugin configuration from the legacy plugin.config format to a new plugin.yaml format (with plugin.yaml taking precedence when both exist), adds runtime introspection via traffic_ctl plugin list, and provides a traffic_ctl conversion tool to assist with migration.
Changes:
- Implement
plugin.yamlparsing/loading (enabled/disabled entries,load_order, inlineconfig, startup logging) with fallback toplugin.config. - Add
traffic_ctl config convert plugin_configand gold tests for conversion output. - Add JSONRPC plumbing +
traffic_ctl plugin listfor reporting loaded/disabled plugins, plus documentation and unit/integration tests.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/gold_tests/traffic_ctl/convert_plugin_config/legacy_config/basic.config | Legacy input fixture for converter gold tests. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/legacy_config/commented.config | Legacy input fixture covering commented-out plugins. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/legacy_config/quoted.config | Legacy input fixture covering quoted args. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/gold/basic.yaml | Expected YAML output for basic conversion. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/gold/commented.yaml | Expected YAML output including enabled: false for commented lines. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/gold/quoted.yaml | Expected YAML output for quoted-arg conversion. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/gold/skip_disabled.yaml | Expected YAML output when --skip-disabled is used. |
| tests/gold_tests/traffic_ctl/convert_plugin_config/convert_plugin_config.test.py | Gold test runner for traffic_ctl config convert plugin_config. |
| tests/gold_tests/pluginTest/plugin_yaml/plugin_yaml.test.py | Integration coverage for plugin.yaml precedence, inline config, and enabled: false. |
| src/traffic_server/traffic_server.cc | Switch startup/verify paths to call plugin_yaml_init() and adjust messaging. |
| src/traffic_server/RpcAdminPubHandlers.cc | Register new JSONRPC handler for plugin listing. |
| src/mgmt/rpc/handlers/plugins/Plugins.cc | Implement admin_plugin_get_list JSONRPC handler. |
| src/traffic_ctl/traffic_ctl.cc | Add traffic_ctl config convert plugin_config and traffic_ctl plugin list commands. |
| src/traffic_ctl/CtrlCommands.h | Wire plugin list subcommand into CLI command class. |
| src/traffic_ctl/CtrlCommands.cc | Implement traffic_ctl plugin list output formatting. |
| src/traffic_ctl/jsonrpc/CtrlRPCRequests.h | Add request/response structs for plugin list RPC. |
| src/traffic_ctl/jsonrpc/ctrl_yaml_codecs.h | Add YAML codec to decode plugin list response. |
| src/traffic_ctl/ConvertConfigCommand.h | Add plugin_config conversion entry point + --skip-disabled flag storage. |
| src/traffic_ctl/ConvertConfigCommand.cc | Implement plugin.config → plugin.yaml conversion flow. |
| src/proxy/Plugin.cc | Add plugin.yaml parsing/loading, inline-config temp file support, and load summary tracking. |
| include/proxy/Plugin.h | Expose plugin_yaml_init, parse_plugin_yaml, and plugin load summary types/accessor. |
| include/tscore/Filenames.h | Add PLUGIN_YAML filename constant. |
| include/mgmt/rpc/handlers/plugins/Plugins.h | Declare new get_plugin_list handler. |
| src/config/plugin_config.cc | Add legacy plugin.config parser + YAML marshaller for the converter tool. |
| include/config/plugin_config.h | Public header for legacy plugin.config parse/marshal support. |
| src/config/unit_tests/test_plugin_config.cc | Unit tests for legacy plugin.config parser/marshaller. |
| src/config/CMakeLists.txt | Build/link new config converter library code and unit tests. |
| src/proxy/unit_tests/test_PluginYAML.cc | Unit tests for plugin.yaml parsing semantics (enabled, params, ordering, config scalar). |
| src/proxy/unit_tests/CMakeLists.txt | Link new plugin YAML unit tests into test_proxy. |
| doc/release-notes/whats-new.en.rst | Release note entry for plugin.yaml + new traffic_ctl commands. |
| doc/appendices/command-line/traffic_ctl.en.rst | Document traffic_ctl plugin list and config convert plugin_config. |
| doc/admin-guide/files/plugin.yaml.en.rst | New admin-guide reference for plugin.yaml schema and behavior. |
| doc/admin-guide/files/plugin.config.en.rst | Add deprecation guidance + migration instructions to plugin.yaml. |
| doc/admin-guide/files/index.en.rst | Add plugin.yaml to the configuration files index. |
Contributor
|
The inline config field with YAML block scalar seems neat. This is very useful for configs in few lines. |
3585d6e to
18e0948
Compare
Add the 'config' field to plugin.yaml entries, allowing plugin configuration to be embedded directly using a YAML block scalar (|). The literal text is written to a temporary file at startup and passed to the plugin as an argument. Only scalar values are accepted; structured YAML is rejected to preserve quoting semantics that plugins like txn_box rely on. Made-with: Cursor
18e0948 to
ef2db7f
Compare
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.
Migration from
plugin.configtoplugin.yaml. When both files exist,plugin.yamltakes precedence;plugin.configis used as a fallback.New??? capabilities over
plugin.config:enabled: false— replaces the old practice of commenting out lines inplugin.configto disable a plugin. In YAML, commenting out a multi-line plugin entry (path, params, etc) is more cumbersome than commenting a single line in the old format. Withenabled: falsethe entire entry stays in the file for visibility and easy re-enabling, but the plugin is completely skipped at startup (nodlopen, noTSPluginInit).load_order— optional integer that controls plugin loading priority. By default, plugins load top-to-bottom in YAML sequence order (same asplugin.config). Whenload_orderis set, those plugins load first sorted by ascending value; plugins sharing the same value keep their relative file order (stable sort). Plugins withoutload_orderload after all ordered ones. Most deployments won't need this — reordering a single line inplugin.configwas trivial, but moving a multi-line YAML block is more error-prone, soload_orderexists to let you change loading priority without rearranging entries. Useful for quick testing and troubleshooting, or when automation tools may reorder entries.params— YAML sequence of string arguments with$recordvariable expansionStartup logging — each plugin produces a
NOTE-level log line with its index, path, and load/skip status:traffic_ctl plugin list— new JSONRPC-based CLI command for runtime introspection of loaded plugins:traffic_ctl config convert plugin_config— automated migration tool that convertsplugin.configtoplugin.yaml; commented-out lines becomeenabled: falseentries (use--skip-disabledto omit them entirely)Example
Feedback requested: Inline
configfieldI take the liberty to add this feature to this PR, a
configfield that allows embedding a plugin's configuration directly inplugin.yamlinstead of maintaining a separate file. This is intended for quick tests and simple configs where a standalone file is overkill.How it works
The
configfield accepts a YAML block scalar (|). At startup the literal text is written to a temporary file in the config directory (named.<plugin_name>_inline_<index>.conf) and the path is passed to the plugin as an argument. Existing plugins work without code changes — they receive a file path inargvjust as they do today.The inline config file path is inserted as a bare positional argument at
argv[1], before anyparamsentries. This works for the common convention where plugins take a config file as their first argument (e.g.,header_rewrite.so,txn_box.so). Plugins that require a flag before the filename (e.g.,--config <file>) should useparamswith a separate file instead.Why block scalar only
Only literal block scalars (
|) are accepted. Structured YAML (mappings, sequences) is rejected. The reason: re-serializing structured YAML throughYAML::Emitterloses quoting semantics. Plugins liketxn_boxassign meaning to YAML quoting (e.g.,"literal"vsextractor-name), and round-tripping through an emitter strips those quotes. A block scalar preserves the exact text the operator wrote.Example
Notes
YAML::Emitterstrips quoting that plugins liketxn_boxrely on. Supporting structured YAML can be revisited if needed.PluginFactory::cleanup()pattern). This handles both graceful shutdowns and crashes.Part of #12753