-
Notifications
You must be signed in to change notification settings - Fork 70
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
config/fcos: Add extensions param and generate treefile with packages #304
Conversation
4944049
to
78cc5b7
Compare
4f2c5dd
to
365d663
Compare
@bgilbert is the way I am marshaling the YAML correct? It's OK to add that dependency of |
Still seeing:
after merges trying to figure it out. |
We already have a dependency on
What does |
594f244
to
c052917
Compare
Yeah yaml.v3 works, I did not think of searching the other versions in the imports we are already using. Thanks.
That output comes from butane -D.
Which if I understand is because the translation set from the procressPackages() sets the file at index 0 but after appending it is of index 2. If that is correct do I need to modify that manually or is there other method I am missing that is better than merge to deal with this? |
c052917
to
3039d41
Compare
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.
You'll want MergeTranslatedConfigs
; see below.
65f6687
to
416b7b3
Compare
Working on a test now. Thanks for all the help @bgilbert |
Moving back to WIP. This depends on the outcome of: |
b7d95dc
to
ec1a5d1
Compare
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.
LGTM generally, pending tests.
@@ -38,3 +39,5 @@ type BootDeviceLuks struct { | |||
type BootDeviceMirror struct { | |||
Devices []string `yaml:"devices"` | |||
} | |||
|
|||
type Extensions []string |
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.
Are we sure we won't have additional options related to extensions in the future? This schema doesn't allow for any.
The usual way we do this is:
extensions:
- name: foo
- name: bar
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.
We are basically adding something like the RHCOS extensions to butane: https://github.com/openshift/machine-config-operator/blob/master/docs/MachineConfiguration.md#rhcos-extensions . But I am not sure how this will evolve. This is still being discussed but for the first pass AFAIK we just care about a list of packages.
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.
Once this spec version has been stabilized, we lose the ability to add metadata in this way without making a new top-level field. We could merge this as-is and revisit before stabilization, but if we do, we should make sure to leave clear signposts in the issue tracker so we don't forget. Or we could go for the extensible approach now. It might be worth raising with the team.
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.
@cgwalters @jlebon any preference on how to handle this?
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.
Agree with the concern, but not sure what to recommend since it's hard to predict what we'll need to generalize (container-based extensions? more treefile support? repo-pinned extensions?).
So... I'd say let's roll with this for now and revisit before stabilization. In the worst case, we should be able to change the spec in future versions, right?
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.
Discussed this more with @jlebon OOB. If we wanted to add extensibility in future versions, and didn't want to have a major spec bump (i.e. one that requires config changes when bumping the version number), we'd need to deprecate the extensions
field and add e.g. extensions2
. We've done that before but it's a bit awkward.
I think the maximum possible extensibility is:
extensions:
packages:
- name: foo
- name: bar
which lets us add system-wide extension options, per-package ones, and new extension types:
extensions:
global-option: z
packages:
- name: foo
package-option: z
- name: bar
containers:
- name: baz
Global options don't play well with config merging, since a child config that adds a package would be affected by global parameters it isn't aware of. New extension types could be implemented as a package field:
extensions:
- name: foo
package-option: z
- name: bar
- name: baz
type: container
which is consistent with the design elsewhere in the schema.
I think that's a reasonable middle ground. Let's not block the current PR on this, but as a followup I think we should switch from an array of strings to an array of structs.
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.
This is very related to what happened to packages
in
https://github.com/coreos/rpm-ostree/blob/main/docs/treefile.md
We ended up adding repo-packages
which allows to pin to packages from a specific repo.
--
The idea of type: container
is a really interesting idea. Definitely touches on https://www.freedesktop.org/software/systemd/man/systemd-sysext.html etc.
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.
In rpm-ostree's treefiles today to be nice we allow multiple packages in single YAML list entry. See for example https://github.com/coreos/fedora-coreos-config/blob/aa50439847f34282b41bf2eb60d478a45d2a27d7/manifests/system-configuration.yaml#L7
Might make sense to do that too to avoid the overhead in the simple cases?
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.
We generally don't do that in Ignition configs because it wouldn't work with the config merging logic, which (with one unfortunate exception) doesn't know the semantics of what it's merging. That argument doesn't directly apply here, since this is sugar, but it still doesn't feel very Butane-like. We've favored explicitness over ergonomics when they're in conflict.
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.
Followup in #316.
b142f42
to
f764f4a
Compare
@@ -38,3 +39,5 @@ type BootDeviceLuks struct { | |||
type BootDeviceMirror struct { | |||
Devices []string `yaml:"devices"` | |||
} | |||
|
|||
type Extensions []string |
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.
Once this spec version has been stabilized, we lose the ability to add metadata in this way without making a new top-level field. We could merge this as-is and revisit before stabilization, but if we do, we should make sure to leave clear signposts in the issue tracker so we don't forget. Or we could go for the extensible approach now. It might be worth raising with the team.
f764f4a
to
23c2f04
Compare
23c2f04
to
3521238
Compare
3521238
to
db55a8d
Compare
3c78294
to
8741af6
Compare
8741af6
to
a7943bd
Compare
One concern @jmarrero mentioned in a chat about this is that we're implicity supporting whatever CLI arguments can be passed to I think that's probably OK. This also relates though to a discussion happening in libdnf |
Did the question come up of potentially having butane generate default configuration files or kernel arguments when a specific extension is requested? There may be others where we'd want to drop some config file in IOW, should butane ever try to recognize specific extensions, or should we just pass through to |
Can we filter those out e.g. by rejecting slashes? Explicit > implicit, and we can always loosen validation rules later.
If certain extensions need additional configuration, we should add explicit sugar for those. Otherwise, validation has no way to know that a particular extension will invoke additional logic in a future Butane release, so a newer Butane config could produce a subtly broken Ignition config with older Butane. |
Actually I realized I was wrong, since the change to generate a treefile instead of forking |
This PR adds the sugar to take a list of extensions (packages) on the butane config and turns them into a treefile which rpm-ostree will consume as part of the derivation/layering enhancement. This specific PR is raised based on the discussions on: coreos/fedora-coreos-tracker#1054