-
Notifications
You must be signed in to change notification settings - Fork 523
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
Migrate to schnauzer v2 for configuration file templates #3346
Migrate to schnauzer v2 for configuration file templates #3346
Conversation
This is what I get for doing some rebasing and not re-running the build 😅 |
@@ -1,3 +1,4 @@ | |||
+++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep seeing this and wondering if we should make the +++
delimiter optional, but then I think what a weird template this is and start wondering why it's a template at all.
We've gotten to a good place as far as ownership for the settings themselves and for related helper functions, but we still don't have a clear picture for who should own the template, which seems like it's inherently a cross-cutting concern that has to reflect the builder's intent.
For Kubernetes, we try to have a one-size-fits-all template, but it ends up requiring a lot of extensions. For containerd, we package all the templates with the software, which leads to this no-op template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we must always require the +++
delimiter at the start of a template, otherwise it is impossible for the parser to appropriately disambiguate a template body with +++
in it, especially if that body is a TOML document.
As far as who owns the templates, I've been thinking they may want to live in their own sub-packages that can be overridden, and use e.g. Provides: template(kubelet-kubeconfig))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-reading this while not being in a rush, I agree that this probably shouldn't be a template at all.
@@ -1,3 +1,7 @@ | |||
[required-extensions] | |||
kubernetes = { version = "v1", helpers = ["any_enabled"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make any_enabled
a std
helper or does it assume too much about the data shape to work for anything other than Kubernetes?
7f6e634
to
6efc144
Compare
^ Rebases onto develop |
The above:
|
6efc144
to
d88fae3
Compare
Bottlerocket invokes thar-be-settings whenever it needs to re-render configuration file templates defined in the Bottlerocket API. This change modifies thar-be-settings to use the schnauzer v2 renderer, and also modifies all existing configuration templates in Bottlerocket to use the new template format.
In order for helpers to be composable, they must implement the `call_inner` method for the `HelperDef` trait. By failing to implement this for `SettingExtensionTemplateHelper`, helpers used e.g. in an `if` block would not return correct results.
This should be ready to merge. I finished fuzz testing, which uncovered two bugs:
|
Some details about fuzz testing:
All 135,000 models now render identically for both tools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great testing coverage!
NOTE This is against the
ootb-settings-extension
feature branch.Issue number:
#3133
Description of changes:
thar-be-settings
, and changes all current templates to the new formatOption
types to have aserde(default)
.Existing templates were found by checking for all files installed into
%{_cross_templatedir}
.Testing done:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.