Skip to content

Ignore soft dependencies of LCM and chart prioritization - #559

Open
dharmit wants to merge 2 commits into
SUSE:mainfrom
dharmit:core-645
Open

Ignore soft dependencies of LCM and chart prioritization#559
dharmit wants to merge 2 commits into
SUSE:mainfrom
dharmit:core-645

Conversation

@dharmit

@dharmit dharmit commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Ignore soft dependencies, i.e., SUC and cert-manager, of LCM during elemental3 customize.

Also, prioritze charts in core manifest over the one in solution manifest.

@dharmit
dharmit requested a review from a team as a code owner August 18, 2026 11:20
If Rancher chart is listed in `release.yaml` or custom certificate is
configured through `values.yaml` for LCM chart, `elemental3 customize`
would implicitly remove SUC and cert-manager from LCM's dependencies.

Signed-off-by: Dharmit Shah <dharmit.shah@suse.com>
To prevent users from overriding the version of chart(s) required by
Elemental, this commit prioritizes chart in Core manifest over the same
one in Solution manifest

Signed-off-by: Dharmit Shah <dharmit.shah@suse.com>

@ipetrov117 ipetrov117 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on this. I left a couple of suggestions/comments, please let me know what you think.

Comment thread internal/config/lcm.go
)

// lcmWebhookValues is used to marshal data from values file for LCM chart
type lcmWebhookValues struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not foresee this type being every used outside of evaluateLCMDeps, as such would it make sense to include it as an anonymous struct inside the func?

Also we could maybe simplify the struct itself to something like:

var lcmWebhookValues struct {
		Webhook struct {
			Cert *struct {
				CreateDefault bool `yaml:"createDefault"`
			} `yaml:"cert"`
		} `yaml:"webhook"`
	}

And then check against the Cert struct pointer and the CreateDefault field themselves. That would be enough, as if the user has continuously provided the "cert:" field with a non-true createDefault, then it is up to them to define the other fields, in our eyes this should be enough for the trigger to disable the cert-manager dependency.

Comment thread internal/config/lcm.go
// evaluateLCMDeps removes dependencies of LCM if they are satisfied separately, i.e.,
// - if Rancher chart is enabled in release.yaml, it removes dependency on system-upgrade-controller
// - if the values files contains custom certificate configuration, it removes dependency on cert-manager
func evaluateLCMDeps(enabled []release.HelmChart, corePlatform *core.ReleaseManifest, valueFiles map[string]string, valuesResolver helmValuesResolver) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of suggestions here:

  1. I am not sure that the valueFiles map[string]string parameter is needed here. The values file location can be taken from the LCM entry in the enabled []release.HelmChart slice.
  2. This function seems to be doing too much, could we perhaps split out some of its logic in separate functions. For example:
    • We could extract the logic to find a chart from the core manifest in a separate generic function that could be reused for other use-cases in the future.
    • We could extract the logic to resolve a specific charts values (or a portion of it) in a separate generic function that could then be reused for other use-cases in the future.

Comment thread internal/config/lcm.go
)
for _, chart := range enabled {
if chart.Name == rancher {
rancherEnabled = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a personal preference, but instead of populating boolean values, would it make sense to convert the enabled slice to a map and check against the map keys. That way we could do the dependency removal in the same block that we check whether the chart is enabled.

Comment thread internal/config/lcm.go
}
if !lcmEnabled {
// nothing to do!
return nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we error out here? IIRC, we agreed that LCM is a required chart that should be specified by the user under release.yaml. By returning nil here, we do not have any gate that ensures that LCM will be on the cluster. Probably missing something.

Comment thread internal/config/lcm.go
if lcmChart == nil {
// this could be the case if using core manifest that doesn't contain LCM charts which is the case currently
// TODO (dharmit): remove this check once the core manifest includes LCM chart by default
return nil // nothing to do!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also error out here as well? My main thinking is that LCM will always be a part of the core manifest, so it not being present in the parsed corePlatform struct should be flagged.

Or did you want to make the elemental3 binary backwards compatible? If that is the case, I guess we need to decide how we want to handle this. IMO if LCM is going to be an expected component in our setup we need to be explicit here and guard against a missing LCM in release.yaml as well as in the core manifest. Let me know what you think.

Comment thread internal/config/lcm.go
// remove system-upgrade-controller from list of dependencies
for i, dep := range lcmChart.DependsOn {
if dep.Name == systemUpgradeController {
lcmChart.DependsOn = slices.Delete(lcmChart.DependsOn, i, i+1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a personal preference, so feel free to ignore, but would it make sense to use the slices.DeleteFunc here and instead of this whole block, have something like:

lcmChart.DependsOn = slices.DeleteFunc(lcmChart.DependsOn,
			func(d api.HelmChartDependency) bool { return d.Name == systemUpgradeController })

Comment thread internal/config/lcm.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this file consists of a single function and is doing essentially a helm chart configuration, would it make sense to merge its logic and its _test.go with the helm.go file? That way we would have all the chart handling logic at a single place and will keep the number of files for this package to a minimum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants