-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dnsdist: Add a new, optional, YAML-based configuration format #14969
base: master
Are you sure you want to change the base?
dnsdist: Add a new, optional, YAML-based configuration format #14969
Conversation
…o generate all this
The previous method didn't account for TCP workers for backends.
This works around a linker issue with the default linker (bfd) and LTO when building against a static Rust library.
Pull Request Test Coverage Report for Build 12356327481Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
name = boost::uuids::to_string(uuid); | ||
} | ||
|
||
auto [it, inserted] = s_registeredTypesMap.lock()->try_emplace(name, entry); |
Check notice
Code scanning / CodeQL
Unused local variable Note
return true; | ||
} | ||
|
||
static std::shared_ptr<DownstreamState> createBackendFromConfiguration(const dnsdist::rust::settings::BackendsConfiguration& config, bool configCheck) |
Check warning
Code scanning / CodeQL
Poorly documented large function Warning
} | ||
#endif /* defined(HAVE_YAML_CONFIGURATION) */ | ||
|
||
bool loadConfigurationFromFile(const std::string& fileName, bool isClient, bool configCheck) |
Check warning
Code scanning / CodeQL
Poorly documented large function Warning
auto globalConfig = dnsdist::rust::settings::from_yaml_string(data); | ||
|
||
if (!globalConfig.console.listen_address.empty()) { | ||
const auto& consoleConf = globalConfig.console; |
Check notice
Code scanning / CodeQL
Unused local variable Note
/* entries are ordered from least recently seen to more recently | ||
seen, as soon as we see one that has not expired yet, we are | ||
done */ | ||
lookedAt++; |
Check notice
Code scanning / CodeQL
For loop variable changed in body Note
Short description
This PR adds support for a new, optional, YAML-based configuration format. At this point this is still a work in progress!
If the configuration file passed to dnsdist via the
-C
command-line switch ends in.yml
, it is assumed to be in the new YAML format, and an attempt to load a Lua configuration file with the same name but the.lua
will be done before loading the YAML configuration. If the names ends in.lua
, there will also be an attempt to find a file with the same name but ending in.yml
. Otherwise the existing Lua configuration format is assumed.The parsing of the YAML configuration is done using Serde, so Rust is a requirement for the new configuration format, but the existing Lua configuration format is still supported so DNSdist can still be built without Rust. This might change in the future.
A fair amount of the new code is generated, based on a (YAML) description of the configuration settings, including the selectors and actions composing DNSdist's rules. Lua bindings for a fair amount of supported selectors and actions are now generated as well. My plan is to generate Lua bindings for most of the settings as well in the future.
The documentation of the new configuration format is not yet done, although a fair amount can already be generated from the definitions of settings, selectors and actions.
I have added several regression tests using the new configuration format, so for now it's possible to look at these to get a fell of the new format.
Checklist
I have: