-
Notifications
You must be signed in to change notification settings - Fork 50
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
Expose RHSM configuration as BP customization (COMPOSER-2308) #824
Conversation
❤️ ❤️
Yeah, I'm not sure either. There's a lot of code in there to accommodate this and I'm wondering if it's worth it. I think this blueprint customization is mostly for us (I don't expect users to be fiddling with RHSM configs) and the brew build configs will be pretty stable, not changing much if at all. Given all that, it's probably not worth having a bunch of code to support conveniently changing a small subset of the configuration. If this was a more user-facing customization, I'd argue for making it easier to tweak individual options without completely changing the config, but if I'm right that it's not, maybe simplifying the code (and the behaviour) is better in the long run. |
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.
Requesting changes for the package move (from pkg/subscription
to pkg/customizations/subscription
).
Otherwise LGTM (pending discussion about merging vs overriding the full config).
Just to add to the open question with additional questions. If we go the route of overriding the configs this means that the |
I literally felt bad while writing all that code. 😅 I also don't like the end result and agree that it is too much code for a little benefit. While I agree that the customization is mostly for us, it will get exposed to end users because Cloud API uses the I can think of only one relatively good reason to keep the merging behavior. The default image RHSM config may contain configuration for subscription-manager itself and for its DNF plugins. Imagine that one provides only subscription-manager config in the BP, which would then wipe out DNF plugins config if these were part of the default configuration. This felt weird. But we can clearly document it. There's maybe a middle-ground to do the merging only one level higher. This means that if ones provides DNF plugins config, we override only that part and don't touch the sub-man part. If one provides sub-man config, we override only that part and don't touch DNF plugins config. But this may still mean quite a lot of code to handle the logic... IOW, I'm happy to simplify this in any way, just want to find out what majority of people think is the best option. 😇 |
Fair question. So, the reason why So in this regard, a complete override or the middle-ground that I outlined in my previous comment would probably be cleaner. |
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.
Thank you! Inline are two quick drive-by ideas
Right, of course. I just meant that users probably wont be using it much, but I could be wrong. I don't imagine many users would want to change the configuration for subman. Or would they? |
Right. Hopefully none of the end users will use it 🤞 They shouldn't need to. |
ultimately this will imply an additional section in https://github.com/osbuild/osbuild.github.io/blob/main/docs/user-guide/01-blueprint-reference.md |
Needs to land in osbuild-composer first but yes. |
I forgot to fix the unit test function name when I renamed the 'rpm' BP customization to its current name. Fixing it now. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Add an internal representation of the RHSM configuration, which can be applied to an image. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Add a helper function for converting `subscription.RHSMConfig` to the `org.osbuild.rhsm` stage options. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Replace the use of `org.osbuild.rhsm` stage options for in `distro.ImageConfig` with the internal representation `subscription.RHSMConfig`. The same applies also to `manifest.OSCustomizations`, which inherits the value from `distro.ImageConfig`. Adjust all image definitions accordingly. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Add a new BP customization, allowing the user to configure RHSM and DNF plugins shipped by subscription-manager. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
d1095dc
to
3c44cf1
Compare
I implemented all of the suggestions, except for the override behavior. The reason is that removal of pointers from the internal representation of RHSMConfig simplified the code enough that it may be acceptable. Nevertheless, I'm happy to change it. To summarize the options for BP RHSM customization behavior when interacting with the image default configuration:
Summary:
[edit] I force pushed once more, because I additionally simplified |
Add a helper function for converting the RHSM BP customization to RHSMConfig. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Historically, the RHSMConfig is defined for two scenarios in the default image definition - when the image should be subscribed and when not. The config for both scenarios has been previously copied to the `OSCustomizations` struct and the appropriate RHSMConfig would be picked when serializing the `OS` pipeline. Simplify the flow and make `OSCustomizations` struct contain only the infal RHSMConfig that should be applied to the image, if any. Move the logic deciding which RHSMConfig should be used, to the function handling the creation of `OSCustomizations` from the BP customizations, default `ImageConfig` and `ImageOptions`. This means to the `osCustomizations()` function, which is part of the distro implementation. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Add helper functions for creating a deep copy of RHSMConfig and for creating an updated RHSMConfig instance from an existing one, with overridden values set in a second instance. This will be useful for merging the RHSM configuration from BP with the one in the default image configuration. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Update the `osCustomizations()` function to take the RHSM customization provided in the BP into account and update the RHSM configuration in `OSCustomizations` instance accordingly. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Refactor the handling of RHSMConfig to reduce the nesting of conditions by one level. Co-authored-by: Michael Vogt <michael.vogt@gmail.com> Signed-off-by: Tomáš Hozza <thozza@redhat.com>
Co-authored-by: Michael Vogt <michael.vogt@gmail.com> Signed-off-by: Tomáš Hozza <thozza@redhat.com>
3c44cf1
to
8454123
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.
Great stuff.
LGTM
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
@mvo5 Can you take a look at your comments and resolve them (if you're happy :) )? |
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.
Thank you!
RHSM in the image definitions is the last difference between RHEL RHUI images on el9 / el10, which can't be expressed as a BP customization. To enable the unification of RHUI and non-RHUI images and simplification of the image definitions, expose the RHSM configuration as a BP customization.
I considered naming the high-level customization
Subscription
, however the name is already used by a customization exposed only by the Cloud API in osbuild-composer. So using it for the BP customization would make it clash with the existing one and look different for on-prem vs. service scenario.Notable changes
OSCustomizations
by having only a single instance of the RHSM configuration, which should be applied to the image, instead of having two and deciding which one to use based on the fact if the image should be subscribed or not. The decision logic is now moved to the function which producesOSCustomization
instance fromImageConfig
,ImageOptions
and BP customizations.Open questions