-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Today we have variable sources which create other variable sources which create variables. While this gives us very short and simple units - it makes harder to follow and creates a lot of boilerplate (e.g. need for support of nested variable soruces).
For example OperatorVariableSource creates RequiredPackageVariableSource which creates RequiredPackageVariable:
operator-controller/internal/resolution/variablesources/operator.go
Lines 42 to 47 in 6808a50
| rps, err := NewRequiredPackageVariableSource( | |
| o.catalogClient, | |
| operator.Spec.PackageName, | |
| InVersionRange(operator.Spec.Version), | |
| InChannel(operator.Spec.Channel), | |
| ) |
operator-controller/internal/resolution/variablesources/required_package.go
Lines 88 to 90 in 6808a50
| return []deppy.Variable{ | |
| olmvariables.NewRequiredPackageVariable(r.packageName, resultSet), | |
| }, nil |
BundleDeploymentVariableSource creates InstalledPackageVariableSource which creates InstalledPackageVariable:
| ips, err := NewInstalledPackageVariableSource(o.catalogClient, bundleDeployment.Spec.Template.Spec.Source.Image.Ref) |
operator-controller/internal/resolution/variablesources/installed_package.go
Lines 53 to 55 in 6808a50
| return []deppy.Variable{ | |
| variables.NewInstalledPackageVariable(installedBundle.Package, upgradeEdges), | |
| }, nil |